Namespace declarations

Namespace declaration records are placed in the parsed data stream between the start and end element records for the elements that contain them. This is different than in SAX-like environments where the namespace declaration events precede the start element event for a given element.

Only the namespaces that have been declared within an element, including the default namespace, will have entries in the parsed data stream for that element. The caller may construct the complete namespace context for an element by keeping a stack of namespace declarations as they are encountered in the parsed data stream. Default namespaces will have URI values, but no associated prefix. When a default namespace is unset, it is represented in the parsed data stream as a namespace declaration record with no URI or prefix.

Note: The z/OS XML parser is an XML compliant namespace parser only, and not an XML non-namespace parser. Because of this, if the z/OS XML parser parses a document compliant with the XML non-namespace standard, it can attribute namespace characteristics to an element that is not intended to contain namespaces. This is because non-namespace documents can have a ":" in an element structure that does not actually indicate a namespace. Thus, if non-namespace documents are being parsed, the resulting parsed data stream may not match the expected parsed data stream or the parser may flag the document as erroneous.