Content deleted Content added
Tags: Mobile edit Mobile app edit Android app edit |
Rescuing 1 sources and tagging 0 as dead.) #IABot (v2.0.9.5 |
||
(18 intermediate revisions by 15 users not shown) | |||
Line 1:
{{short description|Method of providing unique elements and attributes in an XML document}}
'''XML namespaces''' are used for providing uniquely named [[Data element|elements]] and attributes in an [[XML]] document. They are defined in a [[
A simple example would be to consider an XML instance that contained references to a customer and an ordered product. Both the customer element and the product element could have a child element named '''id'''. References to the '''id''' element would therefore be ambiguous; placing them in different namespaces would remove the ambiguity.
Line 5 ⟶ 6:
== Namespace names ==
A ''namespace name''
Although the term ''namespace URI'' is widespread, the W3C Recommendation refers to it as the ''namespace name''. The specification is not entirely prescriptive about the precise rules for namespace names (it does not explicitly say that parsers must reject documents where the namespace name is not a valid [[Uniform Resource Identifier]]), and many XML parsers allow any character string to be used. In version 1.1 of the recommendation, the namespace name becomes an [[Internationalized Resource Identifier]], which licenses the use of non-ASCII characters that in practice were already accepted by nearly all XML software. The term ''namespace URI'' persists, however, not only in popular usage, but also in many other specifications from W3C and elsewhere.
Line 28 ⟶ 29:
In this case, any element without a namespace prefix is considered to be in the XHTML namespace, if it or an ancestor has the above default namespace declaration.
If there is no default namespace declaration in scope, the namespace name has no value.<ref>{{cite web|url=https://www.w3.org/TR/REC-xml-names/#dt-qualname|title=Namespaces in XML 1.0 (Third Edition)|publisher=W3C|
Attributes are never subject to the default namespace. An attribute without an explicit namespace prefix is considered not to be in any namespace.
==
Different specifications have taken different approaches on how namespace information is presented to applications.
|