Namespaces and XML validation

Charles Frankston cfranks at microsoft.com
Sat Aug 8 08:47:52 BST 1998


John Cowan wrote:
> This is quite separate from locality *as such*; locality of prefixes
> just means that a given prefix isn't legal outside the scope of
> its declaration.  However, following the Algol precedents, you have
> allowed declarations to supersede conflicting outer declarations
> and to coexist with conflicting non-overlapping declarations.
> There is some, if not overwhelming, software engineering experience
> to indicate that this is a Bad Idea.
> 

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.

John --

I think you and some others on this list are being insufficiently
imaginative in tackling the problem of figuring out how to validate
documents that use the namespace spec.  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.  I.e. pre-processing the DTD and the
instance to convert all names to URI, name pairs, and what some have called
fragment validation using as the root of each fragment any element that
introduces a tag from a new namespace.  A new namespace for this purpose is
defined as one from a different namespace than its parent.

I do not believe the new namespace proposal with local scoping makes it any
harder to do than the old PI based namespace proposal.  It may make it
harder to think about it.  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.

However, the approach I've outlined above still has a severe problem, which
I don't think is so easily solved.  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.

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.  The XML-Data submission clearly
showed how this could work.  The new namespace proposal does no violence to
XML-Data's use of namespaces.  I would therefore rather spend my time
working on the new schema language, as the XML WG will shortly be doing,
than patching DTDs.  

(The XSchema work that's been going on in XML-Dev is hopefully equally
adaptable -- the volume of mail is simply too high so I have not been
following it closely.  The key is the use of XML syntax, which enables one
to use namespace declarations in the schema in a manner that mimics the
instance.)



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;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo at ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa at ic.ac.uk)




More information about the Xml-dev mailing list