Namespace declarations
- Last Updated: June 3, 2021
- 1 minute read
- OpenEdge
- Version 13.0
- Documentation
An XML document that uses namespaces has one or more namespace declarations, which appear as attributes of elements. A namespace declaration might appear as an attribute of any element. Frequently, the document element (the one that encloses all the other elements) has a global namespace declaration or declarations.
A namespace declaration associates a prefix with a URI. Once associated,
the prefix might appear with element names, attributes names, or both, to distinguish
the names from identical names that might mean something else. For example, an XML
element whose name is memory might mean completely
different things and have different valid attributes, depending on whether it appears in
a computer inventory or in a psychological report. You can distinguish the uses by
having a computer-inventory namespace and a psychological-report namespace.
In the SAX2 interface, XML namespaces affect
the values of the parameters of the StartElement and
EndElement callback procedures or methods, as well
as the attribute data in the attributes parameter of
the StartElement callback. There can be slight
variations in the way that the SAX-reader object handles namespace processing, depending
on the configuration of the SAX-reader object.