Lists Home |
Date Index |
- From: email@example.com (Ron Bourret)
- To: firstname.lastname@example.org
- Date: Wed, 29 Jul 1998 10:44:42 +0200
[Forwarded for Murray Altheim]
email@example.com (Ron Bourret) writes:
> This is undoubtedly a no-brainer, but it has just now occurred to me that the
> following two DTDs are almost certainly not the same.
> <!ELEMENT A (B+)>
> <!ELEMENT B (#PCDATA)>
> <!ELEMENT FOO:A (FOO:B+)>
> <!ELEMENT FOO:B (#PCDATA)>
> Originally, I had thought that instances of the first case would be recognized
> by applications designed for the second -- that is, an application would have
> "default" namespace) -- but now I am leaning the other way. The namespace
> does not describe how to compare names, so I am assuming that they are first
> resolved into fully qualified names and then compared stringwise.
This is the only way that a comparison could occur. XML 1.0 processors would
not be capable of this, so the DTD itself must be modified.
> One of the consequences of this is that if namespace prefixes are used in a
> they must be used in both the instance file and in the application. (Of
> it is easy to imagine an application implementing a default namespace for
> backward compatibility, but this is outside the spec.)
> Could somebody confirm that these DTD are, in fact, different?
It really depends on how you frame your question. In the context of
namespaces, they are theoretically the same since the element type names
are now merely qualified by a namespace prefix.
But strictly from an SGML and XML 1.0 standpoint, they are of course not
the same. The element type 'A' is now transformed to an element type
'FOO:A'. As some are wont to note, computers are stupid, so parsing a
ns-qualified document with an unqualified DTD will (quite correctly)
throw a validation error.
If a namespace-aware processor reads an unqualified external DTD and has
access to the proper prefix (ie., the ns declaration occurs before the
parser begins reading the DTD), then theoretically it could modify the DTD
on the fly to grok the qualified document instance. I've been playing with
this idea for several weeks. It relies on the ability of the parser to
have access to the ns declaration before the DTD.
But to answer your question, these two DTDs are in fact different.
Murray Altheim, SGML Grease Monkey <mailto:firstname.lastname@example.org>
Member of Technical Staff, Tools Development & Support
Sun Microsystems, 901 San Antonio Rd., UMPK17-102, Palo Alto, CA 94303-4900
"Give a monkey the tools and he'll build a typewriter."
xml-dev: A list for W3C XML Developers. To post, mailto:email@example.com
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/
To (un)subscribe, mailto:firstname.lastname@example.org the following message;
To subscribe to the digests, mailto:email@example.com the following message;
List coordinator, Henry Rzepa (mailto:firstname.lastname@example.org)