Namespaces and XML validation
cowan at locke.ccil.org
Mon Aug 10 16:47:01 BST 1998
Charles Frankston wrote:
> I find an assertion that "software engineering experience" has shown that
> Algol style lexical scoping is a bad idea quite surprising. Which school of
> software engineering believes this? Certainly not the one I went to.
Not scoping, but shadowing. The difficult context is something like this:
foo := 32;
comment which foo?
programmer means global,
but compiler assumes local ;
By making a (conventional) syntactic distinction between local and
global variables, as is done in Smalltalk, this error is made less
likely. As is well known, Dijkstra's _Discipline of Programming_ uses
a mini-language in which this type of variable shadowing is a syntax error.
> I believe it is possible to do
> fragment validation against DTDs, if that is so desired. However this
> certainly cannot be accomplished without some modification of the mechanics
> of DTD validation, as Tim outlined.
Precisely my complaint. In the previous ns draft, where ns declarations
were global, validation could proceed in the normal fashion.
With the current draft, it is possible to create documents that cannot
be validated without first transforming them into other documents.
> I do not believe the new namespace proposal with local scoping makes it any
> harder to do than the old PI based namespace proposal.
In the old proposal, there was nothing to "do"; just use normal XML
validation. All namespace prefixes were global and explicitly covered
the DTD (they could appear only before the DOCTYPE declaration).
> The fact that the namespace prefix may actually
> be declared physically in the document after the DOCTYPE doesn't matter. At
> the time when the instance is to be compared to see if it matches the
> declaration in the DTD, the prefix to URI mapping is available. Can you do
> this without modifying your validation code? Certainly not.
But in the previous draft, I didn't have to care about that mapping,
because prefix-to-URI was a 1-1 relationship.
> In order to do this form of validaton,
> what gets put in the DTD is the prefix, and not the URI. That is a fatal
> flaw, because it makes it impossible to re-use a DTD for more than one
> document unless all documents that use that DTD use the same prefix for the
> same URI. That elevates the prefix to the same status as the URI --
> something one must take care to keep globally unique. The prefix is not
> syntactically suited to this task.
Quite so. This is true of both the old draft and the new.
> For that reason, and because of other well known deficiencies in DTDs, I
> think the issue of validation and namespaces is better dealt with in the
> context of a whole new schema language. [...] I would therefore rather
> spend my time working on the new schema language, as the XML WG will
> shortly be doing, than patching DTDs.
This is precisely the attitude I characterized as "not giving a
RRRA about DTD validation", and attributed to the authors of the
current draft. (The anonymous authors, not necessarily the editors.)
John Cowan http://www.ccil.org/~cowan cowan at ccil.org
You tollerday donsk? N. You tolkatiff scowegian? Nn.
You spigotty anglease? Nnn. You phonio saxo? Nnnn.
Clear all so! 'Tis a Jute.... (Finnegans Wake 16.5)
xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/
To (un)subscribe, mailto:majordomo at ic.ac.uk the following message;
To subscribe to the digests, mailto:majordomo at ic.ac.uk the following message;
List coordinator, Henry Rzepa (mailto:rzepa at ic.ac.uk)
More information about the Xml-dev