[XML-SIG] Tim Bray on XML

Malcolm Tredinnick malcolm@commsecure.com.au
Wed, 19 Mar 2003 10:52:24 +1100

On Tue, Mar 18, 2003 at 03:49:35PM -0500, Mark Bucciarelli wrote:
> On Tuesday 18 March 2003 2:01 pm, Uche Ogbuji wrote:
> > Yes, SAX is a bit of a pain for anyone who thinks state diagrams are
> > unfunny cartoons.  Luckily there are stream-like alternatives: XMLReader in
> > libxslt and .NET, pulldom in Python (though the latter has some warts).
> Someone said M$ got this right in .NET.  Would you care to elaborate on the 
> differences between these approaches and SAX?

Not sure about the .NET version (and don't really care), but here is
some documentation that Daniel Veillard did for the libxml2 version of


Having started to rewrite portions of a moderately complex application
that was using SAX to now use XMLTextReader in the past week or so, I
would say that I am fairly impressed. Namespace handling and validation
are huge benefits for my situation.

The programming model itself feels easier to set up, and slightly less
work overall than working with a SAX processor. At the end of the day,
you still end up doing "stuff" roughly once for each node in the
document; the real benefit of the TextReader interface is that you get a
whole bunch of information all at once, rather than having to buffer
things up (methods like isEmptyElement and Value is what I am thinking
about here). However, I may be biased here -- I find SAX pretty
comfortable to work with and I use it a fair bit.


Honk if you love peace and quiet.