• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Namespace Scope

 
Ranch Hand
Posts: 1309
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I do not know why so many graimlins get into my previous post. Anyway ...
The following code is extracted from the Professional XML, 2nd Edition:

First, do we really need the explicit prefix for
I think without the prefix is in the Inv namespace. Isn't it?
Second, the book says that the <Description> element requires an explicit prefix to remain in the Inv namespace, instead of being considered part of the newly declared XHTML default namespace. (I understand this part.)
Then the book says "We can disable the default namespace completely by using an empty attribute value in the default namespace declaration:

Any unqualified element names within (and including) <Description> would not belong to any default namespace."
I am confused. Does xmlns="" also disables And does not belong to any default namespace? I think that the explicit prefix Inv makes in the Inv namespace.
 
JiaPei Jen
Ranch Hand
Posts: 1309
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Could anybody help? Thanks.
 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi there,
here below declaration override default namespace.
it is not disable Description element bcoz it is not follow default namespace due to we use Inv prefix .
<Inv : Description xmlns="" >
</Inv : Description>
cheers.
 
author and deputy
Posts: 3150
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by JiaPei Jen:

Second, the book says that the <Description> element requires an explicit prefix to remain in the Inv namespace, instead of being considered part of the newly declared XHTML default namespace. (I understand this part.)


I guess u missed here.Bescause if could have understand this point then you could have not comeup with the second questions?


Any unqualified element names within (and including) <Description> would not belong to any default namespace."


True: Because the Description element declares a new namespace for its childs which is "http://www.w3.org/1999/xhtml",since its directly declares a namespace without a specific qualifier,all the unqualified elements within the Description elements will belong to http://www.w3.org/1999/xhtml and not to default namespace declared at root of the element Toysco.


I am confused. Does xmlns="" also disables And does not belong to any default namespace? I think that the explicit prefix Inv makes in the Inv namespace.


Regarding your question,
First, do we really need the explicit prefix for <Inv:Name>Chess set</Inv:Name
Actually no,but with out that prefix u can't tell whether the name is a customer name or product name.This helps both Human(?) and XSLT.
Hope this helps,if not please questions us.
Regards
Balaji
 
reply
    Bookmark Topic Watch Topic
  • New Topic