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:
“In the one instance, the dreamer ... loses sight of this object in a wilderness of deductions and suggestions ... until ... he finds the incitamentum, or first cause of his musings,... forgotten. In my case, the primary object was invariably frivolous, although assuming, through the medium of my distempered vision, a refracted and unreal importance.”
—Edgar Allan Poe (18091849)
“The parents who wish to lead a quiet life I would say: Tell your children that they are very naughtymuch naughtier than most children; point to the young people of some acquaintances as models of perfection, and impress your own children with a deep sense of their own inferiority. You carry so many more guns than they do that they cannot fight you. This is called moral influence and it will enable you to bounce them as much as you please.”
—Samuel Butler (18351902)