Where can I find the specification of XML?
W3C document is just a recommendation?
https://www.oracle.com/technical-resources/articles/srivastava-namespaces.html
But here's a twist: although the W3C Namespaces in XML Recommendation declares that the namespace name should be an IRI, it enforces no such constraint. Therefore, I could also use something like:
> <someElement xmlns:pfx=" foo" />
which is perfectly legal
Then, what makes an XML legal?
CodePudding user response:
Two separate questions here.
Firstly, the term "Recommendation" is used by W3C for its most definitive specifications. The term has a history, it has always been used for example by CCITT and ITU for the specifications under which the world's phone networks operate. They avoid the term "Standard" because these documents have no legislative force, and possibly also originally to avoid any anti-trust challenges.
Secondly, does a namespace name have to be a valid URI (or IRI)? The specification is ambiguous on the point. On the one hand it says clearly:
Definition: An XML namespace is identified by an IRI reference
One the other hand, in section 7 ("Conformance") it states no requirement that namesspaces should be valid IRIs. This is not an accidental omission; the working group consciously decided to avoid making this a requirement. You might think that's a pretty unsatisfactory state of affairs, but if you've ever worked on standards, you'll know how compromises like that are reached.
Underlying this is the fact that there were people who thought namespace names should merely be names, and others who thought they should be some kind of pointer to a specification of the semantics of the namespace, and the spec represents a working compromise between these positions.
There's a further twist to the story. If you think that namespaces should be references to some resource on the web, then it follows that relative URI references like "foo" should be allowed. This led to a fierce argument, which culminated in a W3C decision that relative URIs were deprecated and should be avoided. So you're left with the odd situation that absolute URIs are definitely OK, relative URIs are definitely deprecated, but strings which are neither absolute URIs nor relative URI references are quietly tolerated.
CodePudding user response:
The specification for XML is W3C Extensible Markup Language (XML) 1.0 (Fifth Edition), or the newer v1.1.
What makes an XML document legal is indeed its conformance to the above standards document.
- A legal XML document is commonly said to be well-formed.
- A well-formed XML document that follows the recommendations of W3C Namespaces in XML 1.0 is further said to be namespace-well-formed.
- A well-formed XML document that adheres to an XML schema is said to be valid.
See also
- Well-formed vs Valid XML
- Must an XML namespace name URI be retrievable?
- Michael Kay's answer for the history behind W3C's Recommendation rather than Standard label and the namespace value standardization process.