Non-Validating XML Parsers: Requirements

John Cowan cowan at locke.ccil.org
Mon Aug 3 22:16:54 BST 1998


Chris Hubick wrote:

>         Meaning, it MUST check ALL the well formedness constraints, and
> MAY check validity constraints.

Correct.
 
>         default attribute values...mmm...that is what I am coding today
> :-)  If an attribute is REQUIRED or IMPLIED, an NVP doesn't have to touch
> it or deal with it at all.  Otherwise an NVP must check if there is a
> value for an attribute and if not, include the default value. If the
> attribute is FIXED, an NVP is not required to check if the instance value
> matches the declared value because that is a validity constraint.

So far so good.

> This means that if you supply an instance value for a FIXED attribute,
> where that instance differs from the declared fixed value, that an NVP
> MAY (if it supports the Fixed Attribute Default VC) or MAY NOT supply the
> correct declared value for this attribute.

That's not clear.  It is an error for the document to supply a value
other than the FIXED one, so the parser may return the FIXED value,
or the application's value, or make demons fly out of your nose.
(See previous posting, or comp.std.c++).

> > 5.  An NVP MUST NOT process attribute list and entity declarations that
> > logically follow references to any parameter entities that have not
> > been read by the NVP.  As usual, everything in the external
> > DTD subset logically follows everything in the internal DTD subset.
> 
> Feed the following document to an NVP which doesn't read any external
> entities:
> 
> <!DOCTYPE Test [
>   <!ENTITY % xx SYSTEM 'file.ent'>
>   <!ENTITY yy '2 %xx; 3'>
>   <!ENTITY zz '1 &yy; 4'>
> ]>
> <Test>A &yy; B &zz; C</Test>

This document is not WF, and every parser should detect it (but
some do not), to wit:  parameter entity references in the internal
subset can only come between declarations, not within one.
See clause 2.8, the WF constraint called "PEs in Internal Subset".

If you move the DTD into the external subset, then the result
is unclear to me.  I suspect that any parser that reads the
external subset is compelled to read external parameter entities
as well, so that the result is

	<Test>A 2 [whatever] 3 B 1 2 [whatever] 3 4 C</Test>
 
> When I feed this to AElfred (file.ent doesn't
> actually exist), it gives me "A    3 B 1    3 4 C",  which I think must be
> a bug.

It's a bug in that Aelfred should throw an error.

> XP throws an exception "parameter entity reference in entity value
> in internal subset", which means that it processed the declaration
> (correctly?)

That is the correct action.

> the thing here is the table in section 4.4 of the spec
> says that PE's are not recognized in content, so I thought XP would have
> passed right over this?

Entity values are not the same thing as "content", which means
literally the stuff within elements.  Parameter entity references
are allowed within (internal) entity values, general or parameter,
but only if the entities in question are defined within the
external subset.  See clause 4.4.5.  (Note that the following
example is in error: "&YN;" should read "%YN;".)  The table in
4.4 repays careful study.

-- 
John Cowan	http://www.ccil.org/~cowan		cowan at ccil.org
	You tollerday donsk?  N.  You tolkatiff scowegian?  Nn.
	You spigotty anglease?  Nnn.  You phonio saxo?  Nnnn.
		Clear all so!  'Tis a Jute.... (Finnegans Wake 16.5)

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