Re: Why Doesn't IE5 use the DTD to Validate?

Subject: Re: Why Doesn't IE5 use the DTD to Validate?
From: Chris Lilley <chris@xxxxxx>
Date: Fri, 02 Apr 1999 17:30:04 +0200

James Clark wrote:
> 
> Chris Lilley wrote:
> 
> > Heh. What you are saying is, have some sort of switch in the document
> > which says whether the document is asserted to be valid or whether it is
> > just well formed?
> >
> > But that of course already exists, and people can choose to make just
> > well-formed documents if they want.
> 
> What switch is that?

<!ELEMENT

in the internal or external dtd subset.


> is well-formed but not valid.  This document also is well-formed but not
> valid:
> 
> <!DOCTYPE doc [
> <!ATTLIST doc a CDATA "default">
> ]>
> <doc>foo</doc>

Yes. You can add entities and you can default attributes; you can do
that in the internal subset or the external subset, but my understanding
is that as soon as you declare an element, you are asserting that the
document is supposed to be valid.

> Neither contains an assertion that is valid.  Systems that assume that a
> document is meant to be valid merely because it contains a DOCTYPE
> declaration are broken; there's nothing in the XML spec that licenses
> such an assumption.

I agree. Some systems do give that impression, true[1], but having read
the spec some more times and talked to the authors, my understanding is
that element declarations are indeed that switch.

> > > The inclusion of a DTD could be interpreted as switch indicating to
> > > the interpreter that structural integrity check has to be done on the
> > > document.
> >
> > Not "could be"; *is&*. That is the intent of the XML 1.0 spec.
> 
> That's news to me.

I was being lazy/careless, sorry. Yes, you can put attribute
declarations and entity declarations in the DTD and its still just well
formed; I was meaning using a dtd in the more usual sense (declaring all
your elements) and, yes, that wasn't at all clear the way I wrote it.
Apologies.


> So what is this switch?  The DOCTYPE declaration? 

Nope

> The DOCTYPE
> declaration unless it's just an internal subset containing entity
> declarations?  

Nope

> What if I have default attributes declared as well? 

Still fine

> What if I have so many entities that I use an external subset instead? 
In terms of logical structure, that makes no difference either (although
it would be useful to distinguish between parsers that *will* attempt to
follow this and ones that *won't*; "may" is of little use here.

These are all still just well formed, but my understanding is that as
soon as you have an element declaration somewhere, the assertion has
been made that the document is supposed to be valid.

Although, as others have noted, it would be useful to have a name,
somewhere inbetween "well formed parsing" and "validating parsing",
which means "parses the dtd and follows external entity references but
doesn't validate".

If that understanding (<!ELEMENT is the validating switch ) is wrong,
then please point it out.

> Where
> does the XML spec mention such a switch?

Which is why I wrote "the intent of the XML spec" rather than "section
a.b.c"

> I know Microsoft-bashing is good, clean fun, but actually they've done
> the right thing here.

Well the fact that it was Microsoft is irrelevant here[2], at least to
me; my concern was with a product that gives the appearance of being a
validating parser but in fact is not. This is likely to be particularly
confusing since IE5b2 did, indeed, use a validating parser.

--
Chris
[1] nsgmls:article.xsl:5:1:E: no document type declaration; will parse
without validation
[2] if it was some other company, I would complain too; then again, I'm
not going to hang back from complaining just because its Microsoft,
either.


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread