• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

Question on default namespace

 
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??
 
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.
 
Hey! Wanna see my flashlight? It looks like this tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic