SDD bogus

James Clark jjc at jclark.com
Sat May 9 06:49:19 BST 1998


Paul Prescod wrote:

> I'm concerned because I believe
> this to be a valid XML document:
> 
> <?xml version="1.0" standalone="yes"?>
> <!DOCTYPE MEMO SYSTEM "http://www.sgmlsource.com/memo.dtd" [
> <!ENTITY % mess-everything-up SYSTEM "mess.ent">
> <!ATTLIST MEMO SECURITY CDATA "TOP-SECRET">
> ]>
> <MEMO></MEMO>
> 
> In my opinion, section 5.1 will require the non-validating parser to skip
> the attribute list declaration, even if memo.dtd is an empty file.

This is very good point.

Your example isn't quite right: the entity must be referenced.  Also a
non-validating parser only has to skip the ATTLIST declaration if it
skips the entity reference.  Apart from this, your interpretation of 5.1
is the obvious one.  Expat behaves consistently this.

I think this is a serious problem, because it breaks the principle that
if you declare your document as standalone=yes and validate it, then you
will get the same result when you parse it with any non-validating
parser (which to me is the point of the SDD).

I think a bit of creative interpretation would be in order. Section 5.1
says:

 [Non-validating processors] must not process
 entity declarations or attribute-list declarations encountered after a 
reference to a parameter entity that is not read, since the
 entity may have contained overriding declarations. 

The "since" clause is false when standalone=yes, so I think this can
fairly be said to be an inconsistency in the spec (rather than simply a
poor design choice), which should be resolved by not applying this
requirement when standalone=yes.

The other way to fix this would be to tweak the definition of standalone
to say that declarations after the first reference to an external
parameter entity count as external for the purposes of determining
whether the document is standalone.

This is clearly needs to be fixed one way or the other.

> Despite its reputation to the contrary,
> XML is intricate and deep and I may have missed something important.

Yes. Entities and the SDD are both tricky: the interaction of the two is
particularily so.

James


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