JDOM

There's only one implementation of JDOM, and JDOM is designed around classes rather than interfaces. Thus, some of the same issues that arise with DOM and SAX don't apply here. It has always been intended that you use the classes directly in JDOM. However, JDOM does not include its own parser. Instead it relies on an underlying SAX parser. By default JDOM ships with and uses Xerces, but this can be changed. Simply pass the fully packaged qualified name of the SAX XMLReader implementation class you want to use to the SAXBuilder constructor, as shown below.

 SAXBuilder parser = new SAXBuilder("com.bluecast.xml.Piccolo"); 

This may speed up parsing a little and save some memory (Piccolo is quite a bit more efficient than Xerces). However, any improvement is limited to the actual parsing of the document. Everything after thatincluding building, manipulating, and serializing the object treetakes place with the same JDOM classes no matter which parser you used initially.

Whichever API you choose, try to stick to its well-documented parts . To the extent possible, use only those methods and classes that are part of the standard API. That way, if you do encounter performance problems or outright bugs , you'll have the opportunity to easily fix the problem by switching to a better implementation rather than having to adjust your processing to avoid the issues.



Effective XML. 50 Specific Ways to Improve Your XML
Effective XML: 50 Specific Ways to Improve Your XML
ISBN: 0321150406
EAN: 2147483647
Year: 2002
Pages: 144

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net