Non-Validating XML Parsers: Requirements
Chris Hubick
maillist at chris.hubick.com
Mon Aug 3 21:46:28 BST 1998
On Mon, 3 Aug 1998, John Cowan wrote:
> (There is nothing official about this: it is what I glean from
> reading the XML recommendation plus applying reason and common sense.)
> NVP = non-validating conforming parser(s). Other capitalized terms
> are used as in RFC 2119.
I am in the middle of implementing all this stuff in my HXP parser
right now and have been groveling through the spec sorting out many of
these issues, so this is very helpfull.
> 1. An NVP MUST check the document entity for well-formedness and
> report any violations.
Meaning, it MUST check ALL the well formedness constraints, and
MAY check validity constraints.
> 3. An NVP MUST process certain attribute list and entity declarations,
> and use them to normalize attribute values, include the replacement
> text of internal entities, and supply default attribute values.
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.
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.
> 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>
What should it print out? Currently HXP sees the reference to %xx; while
processing yy, realizes this has not been read, and from that moment on
will no longer process any entity declarations, including those of yy and
zz. It then throws a not well formed exception in Test content because
&yy; has not been declared. 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. XP throws an exception "parameter entity reference in entity value
in internal subset", which means that it processed the declaration
(correctly?), 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?
---
Chris Hubick
mailto:chris at hubick.com
http://www.hubick.com/
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