Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Namespace Scope

 
JiaPei Jen
Ranch Hand
Posts: 1309
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
Could anybody help? Thanks.
 
Ronak Patel
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • 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.
 
Balaji Loganathan
author and deputy
Bartender
Posts: 3150
  • Mark post as helpful
  • send pies
  • 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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic