OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help



   RE: [xml-dev] Shall the targetNamespace be a valid URI?

[ Lists Home | Date Index | Thread Index ]

> To save you some time from digging into the reference below for your
> answer, the bottom line is: yes, it has to be a valid URI.

I think this is far from clear.

The schema spec seems to impose no requirement other than (a) the target
namespace must be a valid instance of xs:anyURI, and (b) it must be a valid
namespace name according to XML Namespaces 1.0.

The Namespaces 1.0 spec says repeatedly in the text that a namespace name is
a URI reference [*not* a URI], but if you read the conformance rules in
section 6, you find that a document is conformant to the specification if it
uses any old string as a namespace name. Therefore, XML parsers accept any
string as a namespace name (how could they reject conformant documents?).

XML Namespaces 1.0 also says explicitly that namespace names are compared
character by character. This definitive statement is qualified by an erratum
which says that relative URI references are deprecated and future W3C
specifications will define no interpretation for them. However, this erratum
falls short of saying that they are disallowed, or of changing the way they
are compared under Namespaces 1.0. It is carefully worded so that it doesn't
change the spec retrospectively, and it therefore has very little practical

The constraint in XML Schema that the targetNamespace be an xs:anyURI is a
far weaker constraint than saying it must be a valid URI. The xs:anyURI type
also allows "wannabe-URIs" - strings that would be legal URI references if
escaped. This in practice means that nearly all strings are legal. (The XML
Schema spec contains the notorious phrase "Thus in practice the above
definition imposes only very modest obligations on .minimally conforming.
processors" - and refuses to say what these obligations are.)

To make matters even worse, the XML schema specification normatively
references section 5.4 of the XLink specification, which says first that
"The value of the href attribute must be a URI reference as defined in [IETF
RFC 2396], or must result in a URI reference after the escaping procedure
described below is applied.", but then says that "Because it is impractical
for any application to check that a value is a URI reference, this
specification follows the lead of [IETF RFC 2396] in this matter and imposes
no such conformance testing requirement on XLink applications." - which I
take to mean that XLink applications, and by implication XML Schema
processors, are not expected to check that the supplied value conforms to
any particular syntax at all: in other words the "modest obligation" is to
do nothing.

Michael Kay


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS