OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Wellformedness

<?xml version="1.0"?>
<!DOCTYPE test [
<!ENTITY % zz '&#60;!ENTITY nonTricky "error-prone" >' >

First, the problem with this is that the parameter entity zz is
used before it is defined.  But what kind of error is it?

Technically, the document is well-formed but invalid.  This is because
the rule that parameter entities must be defined before they are used
is a validity constraint, rather than a well-formedness constraint.

If I understand correctly, the only reason it is a validity constraint
is to avoid the situation where a minimal processor, which doesn't
read the external subset, detects an error that a validating parser
doesn't.  This would happen if zz was externally defined,
for example:

<!DOCTYPE test [
<!ENTITY % moredtd SYSTEM "more.dtd">

where more.dtd contained a definition of zz.  This is perfectly legal,
but a minimal parser won't see the definition of zz, and thus can't
tell when it sees the reference to zz whether it is an error or not.

On the other hand, it is natural for a parser that *does* read the
external subset - and thus knows for sure whether the entity is
defined - to treat it as a fatal error.  I would expect most parsers
that process parameter entities to give up when they encounter the
undefined entity, even though it is technically only a validity
error.  Certainly mine (RXP) does.

To answer some of your other questions:

> Are internal DTDs mandatory to parse when only checking wellformedness?

All processors must process the internal subset.  Non-validating
parsers need not expand parameter entity references (which can only
occur at top level in the internal subset, and are thus easily
skipped).  If they don't expand a parameter entity reference, they
must not process any declarations after it (because the parameter
entity may contain declarations which override the later ones).

>Are internal entities required to be included if only checking

Parameter entities, whether internal or external, need not be expanded
by non-validating processors.  (Internal *general* entities must
always be expanded.)

-- Richard