Interview Questions

How do I use the default XML namespace to refer to element type names in an XML namespace?

XML Interview Questions and Answers


(Continued from previous question...)

75. How do I use the default XML namespace to refer to element type names in an XML namespace?

Make sure you have declared the default XML namespace and that that declaration is still in scope . All you need to do then is use the local name of an element type. Even though it is not prefixed, the result is still a qualified name ), which the application parses to determine what XML namespace it belongs to.
For example, suppose you declared the http://www.w3.org/to/addresses namespace as the default XML namespace and that the declaration is still in scope. In the following, Address refers to the Address name in the http://www.w3.org/to/addresses namespace.

<!-- http://www.w3.org/to/addresses is the default XML namespace. -->
<Address>123.45.67.8</Address>

(Continued on next question...)

Other Interview Questions