• 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

Question on default namespace

 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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??
 
Ranch Hand
Posts: 177
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Harsha

Thanks for your response. I got your point

Thanks
Balaji.
 
reply
    Bookmark Topic Watch Topic
  • New Topic