XML namespace
≈ 3 min read
Names in other languages
No names in other languages are held for this entry yet.
Article bodies are English and are not machine-translated. A name in another language is not a translation of the article.
XML namespaces are used for providing uniquely named elements and attributes in an XML document. They are defined in a W3C recommendation. An XML instance may contain element or attribute names from more than one XML vocabulary. If each vocabulary is given a namespace, the ambiguity between identically named elements or attributes can be resolved. 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.
XML namespaces are used for providing uniquely named elements and attributes in an XML document. They are defined in a W3C recommendation. An XML instance may contain element or attribute names from more than one XML vocabulary. If each vocabulary is given a namespace, the ambiguity between identically named elements or attributes can be resolved. 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. xmlns:xhtml="http://www.w3.org/1999/xhtml" Any element or attribute whose name starts with the prefix "xhtml:" is considered to be in the XHTML namespace, if it or an ancestor has the above namespace declaration. It is also possible to declare a default namespace. For example: xmlns="http://www.w3.org/1999/xhtml" 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. In that case, an element without an explicit namespace prefix is considered not to be in any namespace. Attributes are never subject to the default namespace. An attribute without an explicit namespace prefix is considered not to be in any namespace. ==See also== Namespace ==References== ==External links== Namespaces in XML 1.0 (Third Edition) Namespaces in XML 1.1 (Second Edition) Namespaces Crash Course (Mozilla Developer Network) ja:Extensible Markup Language#XML名前空間
Text derived from https://en.wikipedia.org/w/index.php?oldid=1300931353 under CC BY-SA 4.0; modifications have been made.