I know that this is correct XML
<Data xmlns="http://w3.schools.com">
<One>Data1</One>
</Data>
xmlns is an attribute and using the above syntax means all nodes belong to the namespace in double quotes. What I can't understand is where is xmlns attribute defined?
See Namespaces in XML 1.0 W3C Recommendation for the definitions of both the xmlns attribute and xmlns: prefix.
Summary of reasons to use xmlns:
xmlns as an attribute to define an XML namespace, which is a
naming standard designed to allow parties to independently define
vocabularies of element and attribute names while avoiding naming
collisions.xmlns: as a prefix to define a custom prefix by which an XML
namespace value can be referenced by shorthand.xmlnsThe attribute xmlns is a reserved attribute and is defined as follows:
DefaultAttName ::= 'xmlns'
xmlns:The prefix xmlns: is a reserved prefix and defined as follows:
[2] PrefixedAttName ::= 'xmlns:' NCName
See also Namespace constraint: Reserved Prefixes and Namespace Names
The prefix xmlns is used only to declare namespace bindings and is by definition bound to the namespace name http://www.w3.org/2000/xmlns/. It MUST NOT be declared . Other prefixes MUST NOT be bound to this namespace name, and it MUST NOT be declared as the default namespace. Element names MUST NOT have the prefix xmlns.
2.3 Common Syntactic Constructs
Note:
The Namespaces in XML Recommendation [XML Names] assigns a meaning to names containing colon characters. Therefore, authors should not use the colon in XML names except for namespace purposes, but XML processors must accept the colon as a name character.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With