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

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Re: [Sax-devel] XInclude and SAX Incompatibility

[ Lists Home | Date Index | Thread Index ]


> 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.

foo.xml:
<!DOCTYPE x [
<!ELEMENT x (include)>
<!ELEMENT include EMPTY>
<!ATTLIST include
      href  CDATA #REQUIRED>
]>
<x>
    <include href="bar.xml"/>
</x>


bar.xml:
<!DOCTYPE stuff [
<!ENTITY foobar "hello world">
<!ELEMENT stuff (#PCDATA)>
]>
<stuff>&foobar;</stuff>

The document after processing would have the same infoset as if foo.xml
was:
<x>
    <stuff>&foobar;</stuff>
</x>

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.

Peter McCracken



                                                                                                                                             
                      "Karl Waclawek"                                                                                                        
                      <karl@waclawek.ne        To:       <xml-dev@lists.xml.org>, <sax-devel@lists.sourceforge.net>,                         
                      t>                        <sax-users@lists.sourceforge.net>, Peter McCracken/Toronto/IBM@IBMCA                         
                                               cc:                                                                                           
                      06/24/2003 12:00         Subject:  Re: [Sax-devel] XInclude and SAX Incompatibility                                    
                      PM                                                                                                                     
                                                                                                                                             
                                                                                                                                             





> (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
the
> document information item, as defined in the XML Infoset specification
[2],
> [3].  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
is
> no way of knowing which unparsed entities and notations must be sent
until
> 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?

Karl









 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS