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

Question on default namespace

 
Balaji Natarajan
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Assume an xml instance as below

<purchaseorder name="testBook"
xmlns:book="http://www.sample.book.com/book"
xmlns="http://www.sample.order.com/order">

<order>
<ordernumber>101010</ordernumber>
</order>

<book:bookdetails>
<numofpages>100</numofpages>
</book:bookddetails>
</purchaseorder>

In the above instance, what will be namespace for the <order> and <numofpages> elements??

will numofpages belong to the namespace "book" as it is nested inside that??
 
Harsha Jay
Ranch Hand
Posts: 177
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From looking at your instance document;

<order> belongs to default namespace thats straightforward.

<numofpages> also belongs to the default namespace.

if the <bookdetails> was declared as follows, the <numofpages> element would certainly belong to the 'book' namespace.


<bookdetails xmlns="http://www.sample.book.com/book">
<numofpages>100</numofpages>
</bookddetails>


Others can verify this also...

-Harsha
 
Balaji Natarajan
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Harsha

Thanks for your response. I got your point

Thanks
Balaji.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic