fixing (just) namespaces and validation

james anderson James.Anderson at
Wed Sep 8 19:04:14 BST 1999

David Carlisle wrote:
> I wrote
> > Simon St.Laurent wrote:
> > >
> > > Namespaces and validation are incompatible in cases where the namespace
> > > prefix changes for whatever reason,
> >
> > this claim is not universaly true. while there are dtd's for which it holds
> > (those with ambiguous prefixes are those with declarations with identical
> > prefixed names and no directly specified namespace binding.), this does not
> > hold for all dtd's
> Surely _all_ DTDs do have this problem with the namespace REC.

We disagree. It is not the dtd´s themselves which "have the problem". A dtd
can actually encode sufficient information to identify intended universal
names. It is the parsers which cause the problem by ignoring the information provided.

> The [illustrated equivalent documents]
can be validated against a dtd equivalent to

<!ATTLIST zap:x xmlns:zap CDATA #FIXED "http://here">

iff the parser provides adequate support for name management. for example,
where it maps the names "foo:x", "bar:x" and "zap:x" all to the same symbol
before the validation process/application ever has access to them.

The parser which i noted in my previous message recognizes PI's of the form

 xmlns:bar="http://here" ?>

as instructions to bind, within a given scope, the respective prefixes to
packages which are in addition bound statically to the identifier provided as
pseudo-attribute value. this works. no, it is not necessary. The bindings
implicit in attribute declarations are also be sufficient to enable the same
interning process - given the appropriate scoping rules. the name stem is then
interned into the respective package. the application works with the interned symbols.

> Well, you could write a DTD that worked for any finite set of prefixes,
> just by duplicating all the declarations, but you can not write one that
> works in general.

Please see above.
> So, to validate with namespaces, you either have to pre-process the
> document instance to normalise the prefixes to the prefix used in the
> DTD,

No, the processing happens in the course of parsing. There is no need for an
additional pass. No, it is better to map them all to a symbol associated with
the universal name. The prefixes are superfluous.

The application (and the validation process) works with these symbols only. It
never cares what the prefixes were. The "rewriting" happens on the fly as the
document is parsed. It is similar to the approach outlined by Mr Bray endless
months ago. 

>          or you have to invent a new declaration in the DTD that says
> `this DTD uses prefix foo: but a documenent instance may use any prefix,
> so long as is bound to the namespace "http://here"'
> This is (I assume) the intention of the PI in Simon's posting.

As i noted in the prior message, the pi is sufficient to support the process.
it is, however, not always necessary. For some dtds, the attribute
declarations suffice. I suspect that, with additional rules to specify their
scope, the attribute declarations would be as expressive as the proposed pi.

xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at
Archived as: and on CD-ROM/ISBN 981-02-3594-1
To (un)subscribe, mailto:majordomo at the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo at the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa at

More information about the Xml-dev mailing list