>How wasteful is a SAX process that terminates after reading the root element node?
 
The two expensive parts are instantiating the XML parser and populating the stack trace in the exception object. Both costs can be cut to near zero with careful Java programming.
 
Opening the file and reading the first bufferful of content could also be expensive if the file is accessed over a network.
 
>I lost interest ... >I don't have  much patience 
 
I'm afraid those are psychological factors that I can't really take into account when I make design recommendations.
 
Happy Easter!
 
Michael Kay
http://www.saxonica.com/


From: Todd Gochenour [mailto:todd.gochenour@gmail.com]
Sent: 11 April 2009 16:58
To: Mailing list for the SAXON XSLT and XQuery processor
Subject: Re: [saxon] Using both Saxon and Xalan

How wasteful is a SAX process that terminates after reading the root element node?  It opens the file and reads the root element and its attributes and then closes the file.  Is that an expensive operation?
 
The namespace problem presented itself as "stylesheet requires attribute: version" when in fact the file had a version.  It took a day of research to figure out that the factory needed a boolean flag set to true for this to work.  Not at all intuitive.
 
When I got to the I/O exception when passing the DOMSource to the transformer I lost interest in the approach.  It wasn't til after the SAX strategy was finished that I came to realize the base URI isn't set for a DOMSource like it is automatically with a StreamSource.
 
I'm an XSL programmer more than a Java programmer.  I don't have  much patience dealing with object oriented plumbing issues like this.  Document centric functional programming is so much easier for me.