[jdom-interest] about JDOM tree

Laurent Bihanic laurent.bihanic at atosorigin.com
Thu Sep 2 02:28:25 PDT 2004


×ÏÐþ wrote:

> Hi,everyone:
>     I'm now studying about JDOM structure.I want to know what is JDOM tree structure and the difference with DOM.
>     The next question is:if the XML file is large,for example,about more than 10M,how to optimize JDOM to save memory?

The best way to handle large XML files is to process them by small subsets. To
help with that, JDOM provides (in the jdom-contrib module) the
org.jdom.contrib.input.scanner.ElementScanner class which is a SAXBuilder
replacement that allows defining subsets as XPath-like expressions and
notifies listeners whenever a subset has been parsed. Once the listeners
return, ElementScanner does not keep any reference to the subset so that it
becomes elligible for garbage collection.

Laurent


More information about the jdom-interest mailing list