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

Re: Does SAX make sense?


how does sax works
Daniel Veillard writes:

 > Personally I think SAX makes a terribly bad API for programmers,
 > forcing then to work with callback, i.e. loosing the thread of
 > control dusing parsing, and making hard to actually gather data
 > from just an event stream. SAX is too low level for most use,
 > through it certainly has its use as a lower API to implement the
 > lower level services. But those layers are not where the typical
 > programmer should meet the XML data.

I agree, for the most part.  SAX is a terribly difficult way for
programmers to deal with XML, especially if they are already
struggling just to get their minds around XML itself.

The problem is that they often hit a point where they have no choice
-- what works fine in the small, proof-of-concept implementation
suddenly falls to pieces under real-world-scale load testing in a busy
server.  That's why we see so many programmers posting to xml-dev
about SAX mid- to late-project, rather than at the during planning --
they've come to the point where learning SAX is less painful than
spending another month of late nights and weekends trying to figure
out some other way to make their server handle more than a couple of
hits per second.

In summary, then, SAX is the root canal of XML programming -- you try
less painful solutions first, but if nothing works, it's time to lie
back in the chair, close your eyes, and open wide, to avoid losing
your teeth altogether.

That aside, the other strength of SAX comes when you're going to be
building an in-memory tree anyway, but it does not happen to be a DOM
tree.  Using the low-level events from SAX to build (say) a tree of
geographical coordinates is much more efficient than building a DOM
tree, then building a second tree of geographical coordinates from
that, then garbage-collecting the DOM tree.  In that case, most
programmers in the project will never see SAX -- the load/save library
should hide it completely.


All the best,


David

-- 
David Megginson, david@m..., http://www.megginson.com/

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.