Interview Questions

What is the scope of an XML namespace declaration?

XML Interview Questions and Answers


(Continued from previous question...)

78. What is the scope of an XML namespace declaration?

The scope of an XML namespace declaration is that part of an XML document to which the declaration applies. An XML namespace declaration remains in scope for the element on which it is declared and all of its descendants, unless it is overridden or undeclared on one of those descendants.
For example, in the following, the scope of the declaration of the http://www.google.org/ namespace is the element A and its descendants (B and C). The scope of the declaration of the http://www.bar.org/ namespace is only the element C.
<google:A xmlns:google="http://www.google.org/">
<google:B>
<bar:C xmlns:bar="http://www.bar.org/" />
</google:B>
</google:A>

(Continued on next question...)

Other Interview Questions