Namespaces in APIs and XML Object Models
Different specifications have taken different approaches on how namespace information is presented to applications.
Nearly all programming models allow the name of an element or attribute node to be retrieved as a three-part name: the local name, the namespace prefix, and the namespace URI. Applications should avoid attaching any significance to the choice of prefix, but the information is provided because it can be helpful to human readers. Names are considered equal, if the namespace URI and local name match.
In addition, most models provide some way of determining which namespaces have been declared for a given element. This information is needed because some XML vocabularies allow qualified names (containing namespace prefixes) to appear in the content of elements or attributes, as well as in their names. There are three main ways this information can be provided:
- As attribute nodes named "xmlns" or "xmlns:xxx", exactly as the namespaces are written in the source XML document. This is the model presented by DOM.
- As namespace declarations: distinguished from attributes, but corresponding one-to-one with the relevant attributes in the source XML document. This is the model presented by JDOM.
- As in-scope namespace bindings: in this model, the application is able to determine which namespaces are in scope for any given element, but is not able to determine which elements contain the actual declarations. This is the model used in XPath, XSLT, and XQuery.
Read more about this topic: XML Namespace
Famous quotes containing the words object and/or models:
“Mixed in one mighty torrent did appear,
Some flying from the thing they feared, and some
Seeking the object of anothers fear;”
—Percy Bysshe Shelley (17921822)
“Today it is not the classroom nor the classics which are the repositories of models of eloquence, but the ad agencies.”
—Marshall McLuhan (19111980)