Interview Questions

Are the names of all element types and attributes in some XML namespace?

XML Interview Questions and Answers


(Continued from previous question...)

59. Are the names of all element types and attributes in some XML namespace?

No.
If an element type or attribute name is not specifically declared to be in an XML namespace -- that is, it is unprefixed and (in the case of element type names) there is no default XML namespace -- then that name is not in any XML namespace. If you want, you can think of it as having a null URI as its name, although no "null" XML namespace actually exists. For example, in the following, the element type name B and the attribute names C and E are not in any XML namespace:
<google:A xmlns:google="http://www.google.org/">
<B C="bar"/>
<google:D E="bar"/>
</google:A>

(Continued on next question...)

Other Interview Questions