[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: [Sax-devel] XInclude and SAX Incompatibility


peter mccracken

> 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@w...        To:       <xml-dev@l...>, <sax-devel@l...>,                         
                      t>                        <sax-users@l...>, 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






PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.