Interview Questions

Can the content model in an element type declaration contain element types whose names come from other XML namespaces?

XML Interview Questions and Answers


(Continued from previous question...)

89. Can the content model in an element type declaration contain element types whose names come from other XML namespaces?

Yes and no.
The answer to this question is yes in the sense that a qualified name in a content model can have a different prefix than the qualified name of the element type being declared. For example, the following is legal:
<!ELEMENT google:A (bar:B, baz:C)>
The answer to this question is no in the sense that XML namespace declarations do not apply to DTDs so the prefixes used in an element type declaration are technically meaningless. In particular, they do not specify that the name of a certain element type belongs to a certain namespace. Nevertheless, the ability to mix prefixes in this manner is crucial when: a) you have a document whose names come from multiple XML namespaces , and b) you want to construct that document in a way that is both valid and conforms to the XML namespaces recommendation .

(Continued on next question...)

Other Interview Questions