parser for xml-data?

Charles Frankston cfranks at
Sun May 24 05:09:51 BST 1998

> -----Original Message-----
> From: Paul Prescod [mailto:papresco at]
> Sent: Thursday, May 21, 1998 4:11 AM
> To: xml-dev at
> Subject: Re: parser for xml-data?
> Charles Frankston wrote:
> > 
> > DTDs are not well-equipped to handle namespaces.  It can 
> technically be
> > done: for example, you could allow your outer DTD to have 
> 'ANY' content.
> This example can be done in DTD syntax in the same way that 
> you do it with
> namespaces

No, it's not the same.  Your example clearly demonstrates that trying to use
namespaces with DTDs results in a perversion of the intent of the namespace
note.  See below.

> In fact, namespaces were specifically designed to 
> not break
> validation. (also, note that the ns pseudo-attribute is 
> supposed to be a
> URL)

The ns pseudo-attribute is NOT supposed to be a URL.  It's a URI.  It may be
a URL, but I would in fact claim it's generally a bad idea for it to be a
URL (the first example in the draft namespace note notwithstanding).  A URL
will inevitably end up tieing your unique name to an address on a specific
web site.  Web sites come and go, the organizations that control them come
and go.  At any given time they may be unavailable.  Something like a URN or
a UID would frankly make a better ns ID.  We just don't yet have good
mechanisms deployed for doing the lookup from the URN or a UID to find the
identified schema (if indeed you actually need a schema).  I think once we
define this, it would be better to avoid using URLs for the purpose of
uniquely identifying names.

> > XML-Data schemas are designed to integrate with namespaces:
> > 
> > <!-- Schema for xyz namespace -->
> > <elementType id="a">
> >   <string/>
> > </elementType>
> > 
> > <!-- Schema for zyx namespace (in a separate file) -->
> > <?xml:namespace ns="xyz" prefix="x"?>
> > <elementType id="b">
> >    <element type="x:a">
> > </elementType>
> > 
> > <!-- Instance file -->
> > <?xml:namespace ns="zyx" prefix="z"?>
> > <?xml:namespace ns="xyz" prefix="x"?>
> > <z:b>
> >   <x:a/>
> > </z:b>
> xyz.dtd:
> <!ELEMENT xyz:a (#PCDATA)>
> zyx.dtd:
> <!ELEMENT zyx:b (xyz:a)>
> instance.xml:
> <?xml:namespace ns="zyx.dtd" prefix="zyx"?>
> <?xml:namespace ns="xyz.dtd" prefix="xyz"?>
> <zyx:b>
> <xyz:a>
> </xyz:a>
> </zyx:b>
> You don't need "ANY" to use namespaces.

In order to use these DTDs you wrote, I MUST use the prefixes you chose for
your instance.  Your ns part, which probably should really read something
like ns="urn:schemas-abc-com:zyx" is now useless.  If I want to use your
DTDs and mix them with any other DTDs, I must ensure that the other DTDs do
not in fact also use any "zyx" or "xyz" prefixes.  The whole idea of using a
controlled namespace (such as DNS names) to guarantee uniqueness no longer
matters -- your prefix is now the part that must be unique.  This is
contrary to the intent of the XML-Data note, and it's simply not going to
CARE.  If others follow your example, pretty soon people are going to start
to choose long prefixes with company names and things in them to try to keep
them unique.  This will create a serious mess.

I repeat.  The only sensible ways to use namespace prefixes with DTDs are
(1) to use ANY content model or (2) careful use of qualified names in the
internal subset.

> > The ns, prefix, and src parameters to a namespace PI look a lot like
> > attributes (although they are not in a formal sense).  
> Since attributes in
> > XML do not have to be in a particular order, it would certainly be
> > surprising for people to discover that attributes in a 
> namespace have to be
> > a particular order.  You're suggesting that the syntax be 
> made harder to use
> > in order to make the productions easier to author.  I think 
> this is a bad
> > tradeoff.
> Note that the XML declaration has a required order of pseudo-attribute
> occurrence. It would be best if the XML-family of language were
> consistent.
> [23]  XMLDecl ::=  '<?xml' VersionInfo EncodingDecl? SDDecl? S? '?>' 

Yes, this is a good point about the XML Decl.  Does Tim Bray care to comment

xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at
Archived as:
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