[
Lists Home |
Date Index |
Thread Index
]
- From: "Simon St.Laurent" <simonstl@simonstl.com>
- To: XML-Dev Mailing list <xml-dev@ic.ac.uk>
- Date: Tue, 07 Sep 1999 18:27:14 -0400
I brought this up earlier on a list of things that could be done to improve
XML, and it keeps ringing in my ears.
Namespaces and validation are incompatible in cases where the namespace
prefix changes for whatever reason, because XML 1.0 will validate based
only on the prefix. The Namespaces in XML Recommendation doesn't even
provide a mechanism for telling DTDs what URI might be associated with a
given prefix.
James Clark provides an explanation of this at
http://www.jclark.com/xml/xmlns.htm:
>It would of course be very useful to have namespace-aware validation:
>to be able to associate each URI used in a universal name with some
>sort of schema (similar to a DTD) and be able to validate a document
>using multiple such URIs with respect to the schemas for all of the URIs.
>The XML Namespaces Recommendation does not provide this. The reason is
>is that DTDs have many other problems and missing features in addition
>to lack of namespace-awareness. So the plan is to come up with a new
>schema mechanism that fixes the problems with DTDs and, as part of this,
>provides namespace-awareness. This work is being done by the XML Schema WG.
At the same time, Namespaces REC says: (end of Section 6, conformance)
>Thus, unless the use of a validating processor has been specified,
>there can be no assurance that the contents of attribute values
>have been checked for conformance to this specification.
Most people seem to have disregarded this notice, and use non-validating
processors when they use namespaces, if indeed they do use namespaces.
Those who validate simply pray that in these early days of XML processing
no one will have gotten around to changing a prefix for whatever reason.
It seems like DTDs will be here for a while, and it doesn't seem like
fixing this problem is difficult. The PI from the 5/18 draft, which was
meant for documents, would serve just as well in DTDs. It could provide a
simple mapping for prefixes as used in the DTD to the namespace URI,
allowing processors to validate against both the namespace URI and the
local part, rather than simply the element or attribute name.
For example: (Yes, I changed the colon to a dash.)
<?xml-namespace ns="http://www.simonstl.com/ns/1999/xpdl" prefix="xpdl"?>
When it appeared in the DTD, this would tell a validating processor that
the prefix xpdl maps to http://www.simonstl.com/ns/1999/xpdl. If the
processor then encountered elements with a namespace URI of
http://www.simonstl.com/ns/1999/xpdl, it could validate them on the basis
of that URI and the local part even if the xpdl prefix had disappeared.
It seems very simple, even potentially worthwhile. I don't think that it
would give parser builders enormous headaches, and it would take away a lot
of the technical ammunition of the anti-namespaces crowd. Then we could
discuss the more painful issues of 'what does it mean?' without extra noise
about how weakly it's been implemented, and we wouldn't have to wait as
impatiently for the Schema WG to finish their labors.
Simon St.Laurent
XML: A Primer (2nd Ed - September)
Building XML Applications
Inside XML DTDs: Scientific and Technical
Sharing Bandwidth / Cookies
http://www.simonstl.com
xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev@ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on CD-ROM/ISBN 981-02-3594-1
To (un)subscribe, mailto:majordomo@ic.ac.uk the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo@ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa@ic.ac.uk)
|