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

Subject: Re: Why Doesn't IE5 use the DTD to Validate?
From: James Clark <jjc@xxxxxxxxxx>
Date: Sat, 03 Apr 1999 08:29:21 +0700
Jelks Cabaniss wrote:
> 
> James Clark wrote:
> 
> > > How can you apply the rule if you haven't read the DTD?
> 
> > Reading the DTD and validating aren't the same thing.  Unless a document
> > has standalone="yes", the browser should always read a provided DTD so
> > that it can correctly
> >
> > - - default attributes
> > - - normalize attribute values
> > - - expand entity references
> >
> > None of these things involve validation.
> 
> "should always read a provided DTD" ... including the *external* subset??? 

Yes. If the document has standalone="no" (which is the default for
standalone), then the external subset may change the document tree (eg
by declaring default attributes), so a processor should read the
external subset if it can.

> If
> you have
> 
>         <?xml version="1.0"?>
>         <!DOCTYPE masterpiece SYSTEM "external.dtd" [
>         <!ENTITY ref "World">
>         ]>
>         <masterpiece>Hello &ref;.</masterpiece>
> 
> and "external.dtd" contains only
> 
>         <!ATTLIST masterpiece
>                 author CDATA #FIXED "Dennis Ritchie"
>         >
> 
> what's going to happen in a non-validating processor?

It's going to produce the wrong tree unless it reads the external
subset.

>  Section 5.1 of the
> recommendation says
> 
>         Non-validating processors are required to check only the
>         document entity, including the entire internal DTD subset,
>         for well-formedness. While they are not required to check the
>         document for validity, they are required to process all the
>         declarations they read in the internal DTD subset ...
> 
> That suggests a non-validating processor can ignore the external subset, and
> thus not fully "read the DTD".  So how does it pick up those default attributes?

The XML spec tries to enable compact XML processors by not requiring
that all XML processors have the ability to read the external subset. 
In other words an XML processor can conform to the XML spec but be able
to correctly process (ie get the right tree for) only standalone XML
documents.  The XML spec is silent about what such a processor should do
when confronted by a non-standalone document.

However if an XML processor can process non-standalone documents, then
it should do so correctly, and that means it has to read the external
subset.

James


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


Current Thread