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

Re: Re: Streaming XML (WAS: More on taming SAX (was Re: [xml-d


Re:  Re: Streaming XML (WAS: More on taming SAX (was Re: [xml-d
Uche Ogbuji wrote,
> I don't see why a parallelized streaming architecture could not be
> expressed in terms of SAX events.  Perhaps you could persuade me SAX
> does not allow it, but I expect that this would be only by admitting
> to precious and entirely unnecessary restrictions in the definition
> of SAX.

I didn't say it couldn't.

What SAX-Java doesn't (or at least, definitely shouldn't) allow is a SAX 
parser delivering two or more events relating to the same parse to the 
same ContentHandler concurrently.

Why not? Trivial example,

  class SomeContentHandler implements ContentHandler {

    public void startElement(
      String ns, String local, String qname, Attributes atts) {
      // Do startElement stuff, eg. push name on internal stack

    }

    public void endElement(
      String ns, String local, String qname) {
      // Do endElement stuff, eg. pop name off internal stack
    }
  }

If these methods could be invoked concurrently the expected invariant 
that startElement completes before endElement is entered would be 
violated and the code would break horribly. So portable code which 
depended on that behaviour (almost every ContentHandler I've ever seen) 
would have to be rewritten to reinstate it. That would be _extremely_ 
ugly.

Note the the prohibition on concurrent event delivery doesn't prevent 
you from registering a single ContentHandler with two or more parsers 
and running each of them in a separate thread (tho' implementing a 
ContentHandler that could do something useful safely in such 
circumstances would be fiddly). Nor does it prevent you from building a 
specialized SAX parser and having it deliver the events corresponding 
to a single parse to two or more ContentHandlers each in a separate 
thread.

Is that enough for what you want?

Cheers,


Miles

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.