> What do you mean? Unparsed entity and Notation declarations are reported
> before the EndDTD event, so you know which ones are declared before
> the first StartElement call.
Perhaps I didn't explain well enough. Suppose you had two xml files,
foo.xml and bar.xml.
<!DOCTYPE x [
<!ELEMENT x (include)>
<!ELEMENT include EMPTY>
href CDATA #REQUIRED>
<!DOCTYPE stuff [
<!ENTITY foobar "hello world">
<!ELEMENT stuff (#PCDATA)>
The document after processing would have the same infoset as if foo.xml
When this is parsed, all of the DTD events from foo.xml are sent, and then
an EndDTD event. When we encounter the include, we start parsing bar.xml,
and merging it into the same information set as foo.xml. It's not
important that we send most of the DTD events -- XInclude doesn't specify
that the document type information needs to correct. However, it is
important that the foobar entity is added to the [entities] property of the
result infoset, because at some point &foobar; will need to be resolved. So
we need to put an UnparsedEntityDecl event into the stream. But this
UnparsedEntitiyDecl event can't be sent, because we already sent an EndDTD
event on the stream, at the end of the DTD for foo.xml.
The only way (that I can see) to solve this is to either relax the
restriction on UnparsedEntityDecl (and NotationDecl) events, or to buffer
all of the events at the level of XInclude processing.
<karl@... To: <xml-dev@...>, <sax-devel@...>,
t> <sax-users@...>, Peter McCracken/Toronto/IBM@...
06/24/2003 12:00 Subject: Re: [Sax-devel] XInclude and SAX Incompatibility
> (1) When attributes with references to unparsed entities or notations are
> encountered in included documents, these unparsed entities and notations
> must be added to the [unparsed entities] and [notations] properties of
> document information item, as defined in the XML Infoset specification
> . In SAX, this means sending DTD events.
Why? These are not declarations. They are reported by the content handler.
> SAX specifies that no DTD
> events can be sent after the endDTD/startElement event. However, there
> no way of knowing which unparsed entities and notations must be sent
> after element events start being processed.
What do you mean? Unparsed entity and Notation declarations are reported
before the EndDTD event, so you know which ones are declared before
the first StartElement call.
Maybe I am mis-understanding you?