It's not a secret anymore!
The moose likes XML and Related Technologies and the fly likes Can some one explain me several namespace usage in xml header? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Reply Bookmark "Can some one explain me several namespace usage in xml header?" Watch "Can some one explain me several namespace usage in xml header?" New topic
Author

Can some one explain me several namespace usage in xml header?

raminaa niilian
Ranch Hand

Joined: Jul 14, 2005
Posts: 550
Hi
Thank you for reading my post.
I can not understand one part of the following code snippet, I performed some search but I do not know whether my understanding is correct or not.


I can not understand what the following line

means when we have another similar line

in the code.


Thanks.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 16479
    
    2

Originally posted by raminaa niilian:

I can not understand what the following line

means

That means that the default namespace's URI is "http://rogers60.com/xmltutorial/2". Every element in the document whose name has no prefix is in that namespace, unless it's specifically declared to be in some other namespace.
when we have another similar line

in the code.
That second line doesn't change the meaning of the first line at all. It means that every element and attribute in the document whose name has the prefix "pub:" is in the namespace whose URI is "http://rogers60.com/xmltutorial/2".

You may find it confusing that elements whose names have the prefix "pub:" and elements whose names have no prefix are both in the same namespace, but that's what it means if both those declarations are in the document. However the default namespace doesn't apply to attributes whose name has no prefix, so the two declarations affect attributes differently.
 
I agree. Here's the link: jrebel
 
subject: Can some one explain me several namespace usage in xml header?
 
Similar Threads
a question about XML schema and XML (newbie)
JQuery multiple GET request URL
How to add a new tag in XML configuration file.
A question about namespace definition of an XSD document.
Question on images and packages