Hi,
I am using XML DOM documents with two namespaces. For example, consider the following document:
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:libx="http://libx.org/xml/libx2">
<id>5</id>
<title>Put Google Book results into Addison</title>
<updated>2009-02-23T10:12:15Z</updated>
<author>
<name>LibX Team</name>
<uri>http://libx.org</uri>
<email>[email protected]</email>
</author>
<libx:libapp>
<libx:entry xmlns:libx="http://libx.org/xml/libx2" src="6"/>
<libx:entry xmlns:libx="http://libx.org/xml/libx2" src="7"/>
</libx:libapp>
</entry>
I have the following doubts with respect to namespaces:
1) If I don't prefix the namespace to the nodes(id, title, author etc.) as in the above example, will they be assigned the default namespace: "http://www.w3.org/2005/Atom" ? If not, which namespace would they be assigned to ?
2) The getNameSpaceURI method of a Node returns - The namespace URI of the node, or null if it is unspecified. But, how do I get to know the namespace of the node if it is unspecified. Meaning is there a way to know whether default namespace is assigned to the node or if some other namespace is assigned?
3) When, I copy the nodes(with default namespaces) of a particular document into another document, will the nodes retain the original namespaces or will they take up the default namespace of the new document into which these nodes are copied ? If the latter is true, how do I retain the original namespaces ?
Lastly, could someone point me to a good online material to understand these conflicting namespace issues better?
Thanks, Sidhartha