Re: Should I use sax?
Chris Burdess <[email protected]> Tue, 23 May 2006 09:52:55 +0100
| Newsgroups | gmane.text.xml.sax.devel |
|---|---|
| Message-ID | <[email protected]> |
This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --Apple-Mail-1-415967960 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8; delsp=yes; format=flowed David Megginson wrote: > On 22/05/06, Michael Glavassevich <[email protected]> wrote: >> If you're writing new code, I would avoid using Xerces' native >> serializers. They are non-standard, not particularly well =20 >> maintained and >> likely to be deprecated [1] soon (perhaps in the next release). =20 >> JAXP's >> TransformerHandler [2] is a much better choice for serializing SAX =20= >> events. > > Speaking of new code, I should mention that another option is to use > StAX instead of SAX. Like SAX, StAX is a streaming API, so in theory, > it should be as efficient as SAX (I haven't run side-by-side tests). > However, since StAX is a pull parser, it leaves you in control of the > central loop instead of having to write event handlers. Here's an > intro: > > http://www.xml.com/pub/a/2003/09/17/stax.html > > StAX also covers writing. Does anyone know how stable and efficient > current StAX implementations are? The GNU Classpath default XML parser implementation is entirely based =20= on an underlying StAX parser. The SAX parser pulls events off this =20 StAX parser and delivers them as SAX events, and DOM trees are built =20 from this. This parser implementation is used in nearly all free Java runtimes =20 including gcj, kaffe, jamvm, cacao etc, and gets a lot of exercise in =20= free (gcj compiled-to-native) Eclipse, which makes extensive use of XML. Regarding efficiency, the SAX-over-StAX parser, despite delegating to =20= another implementation, takes approximately 48 seconds to parse a =20 typical set of documents that takes 60 seconds to parse with =C3=86lfred2.= =20 The same set of documents takes 42 seconds to parse with Xerces2's =20 SAX parser. I don't have straightforward comparison figures with =20 other StAX implementations like codehaus; I would suspect that it is =20 not as performant but is more conformant - attention to XML and SAX =20 conformance was the driving force behind this parser, and conformance =20= results can be found at http://builder.classpath.org/xml/SAXTest/ --=20 =E7=8A=AC Chris Burdess "They that can give up essential liberty to obtain a little safety deserve neither liberty nor safety." - Benjamin Franklin --Apple-Mail-1-415967960 content-type: application/pgp-signature; x-mac-type=70674453; name=PGP.sig content-description: This is a digitally signed message part content-disposition: inline; filename=PGP.sig content-transfer-encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2 (Darwin) iD8DBQFEcs1o3qhNIztqvgMRAplwAJ96zxGnk4brWkQCxtIOQh1G0XS+hQCfapD/ dPWM19tkqXVqesOWhNVi/Ao= =qFru -----END PGP SIGNATURE----- --Apple-Mail-1-415967960-- ------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ List: sax-devel, [email protected] See: http://www.saxproject.org/ https://lists.sourceforge.net/lists/listinfo/sax-devel