[XML-DEV Mailing List Archive Home]
[By Thread]
[By Date]
[Recent Entries]
[Reply To This Message]
Re: How to match targetNamespace URIs in XML Schemas tonamespa
- From: Michael Kay <mike@saxonica.com>
- To: xml-dev@lists.xml.org
- Date: Fri, 04 Nov 2011 10:51:18 +0000

On 03/11/2011 04:04, Geoff Shuetrim wrote:
CAB13hhaNbQz+e7qSpE+S3LWxfPkswh_UPoR3HCrCd=gPFBZTQA@mail.gmail.com"
type="cite">I have come across an XML Schema document with a
targetNamespace attribute that contains, among other characters, a
backslash character, for example "http://example.com/target%5Cnamespace".
The XML specifications, taken as a whole, are hopelessly muddled
about the exact rules on whether namespace names have to be valid
URIs, whether leading and trailing whitespace is ignored, and other
such details. For example the conformance section of the Namespaces
1.0 specification says nothing on the subject [
http://www.w3.org/TR/REC-xml-names/#Conformance ]
though the phrase
Definition: A document is namespace-well-formed if it conforms to
this specification.
is capable of being read many ways, one of which is as a
tautological self-reference.
The spec does say "[Definition: An XML namespace is identified by a
URI reference [RFC3986]... ]", but it nowhere has any kind of
"MUST", and I believe the omission is deliberate because I raised
the point while the spec was still in draft and the WG responded
saying they had decided to do nothing. So I believe the situation is
that the use of an invalid URI in a namespace declaration does not
prevent the document being namespace-well-formed.
There are other specs that do require namespace names to be legal
URIs, for example the Infoset and the Canonicalization spec. Other
specs such as XSD and XSLT/XQuery simply get caught in the
crossfire.
The best advice one can give is therefore to apply Postel's law:
when you have the choice, always use a valid URI, but when you are
accepting input from others, accept any string of characters (and
compare them 'as is', perhaps after trimming leading and trailing
whitespace).
XSD 1.1 has taken this route by allowing any sequence of characters
to appear in an xs:anyURI value, and by clarifying that the mapping
from the lexical space to the value space is one-to-one. (XSD 1.0
had the awful statement "Thus in practice the above definition
imposes only very modest obligations on ·minimally conforming·
processors [to check the value].", without offering any clear
guidance on what those obligations are.)
Michael Kay
Saxonica
|

[Date Prev]
| [Thread Prev]
| [Thread Next]
| [Date Next]
--
[Date Index]
| [Thread Index]
|
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format
RSS 2.0 |
 |
Atom 0.3 |
 |
|
Stylus Studio has published XML-DEV in RSS and ATOM formats,
enabling users to easily subcribe to the list from their preferred news reader application.
|
Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website.
they were not included by the author in the initial post. To view the content without the Sponsor Links please
click here.
|
|