Interview Questions

How are universal names represented?

XML Interview Questions and Answers


(Continued from previous question...)

112. How are universal names represented?

There is no standard way to represent a universal name. However, three representations are common.
The first representation keeps the XML namespace name (URI) and the local name separate. For example, many DOM level 1 implementations have different methods for returning the XML namespace name (URI) and the local name of an element or attribute node.
The second representation concatenates the namespace name (URI) and the local name with caret (^). The result is a universally unique name, since carets are not allowed in URIs or local names. This is the method used by John Cowan's Namespace SAX Filter . For example, the universal name that has the URI http://www.google.org/to/servers and the local name Address would be represented as:
http://www.foo.com/ito/servers^Address
The third representation places the XML namespace name (URI) in braces and concatenates this with the local name. This notation is suggested only for documentation and I am aware of no code that uses it. For example, the above name would be represented as:
{http://www.foo.com/ito/servers}Address

(Continued on next question...)

Other Interview Questions