Skip to Content.
Sympa Menu

xom-interest - [XOM-interest] OutOfMemoryError

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: "Gsell Martin" <martin.gsell AT innosystec.de>
  • To: <xom-interest AT lists.ibiblio.org>
  • Subject: [XOM-interest] OutOfMemoryError
  • Date: Fri, 20 Jan 2006 12:38:30 +0100

Hi All,



I have downloaded xom-1.1.jar a few weeks ago and getting more and more
familiar with it. It provides a lot of great features; I ever missed
when using DOM.



One of my requirements is to store the content of very large XML files
in separate files and do some other changes to the XML. Therefore I
programmed my own NodeFactory and use the Builder to process these
files.



If the content is greater than about 50 MB, this fails due to an
OutOfMemoryError. The reason is that 'makeText(String data)' of the
underlying NodeFactory provides the content as String, already. This is
very memory consuming for big contents. To avoid it, I intended to
handle the problem on SAX level and developed a quick and (sofar) dirty
solution by overwriting the XOMHandler. The code to use it is this:



XMLReader parser =
XMLReaderFactory.createXMLReader("org.apache.xerces.parsers.SAXParser");


Builder builder = new Builder(parser);

parser.setContentHandler(new MyXOMHandler());

Document xmlDoc = builder.build(iInputStream);





Since 'XOMHandler' is package private, I have had to place
'MyXOMHandler' in the package 'nu.xom', either. Even worse, 'Sealed:
true' must be set for the package in the Manifest file of xom-1.1.jar to
get it running. As you can see - quick but dirty.



So I would like to ask, if 'XOMHandler' could be a public class in
future Versions of XOM or any body out there has a better solution for
the problem.



Thanks and best regards,



Martin



--

Martin Gsell

Actinium Consulting GmbH

Dammsteggasse 2

D-88131 Lindau



Bei InnoSysTec:

Tel: +49 (0)7553 9180-331

Fax: +49 (0)7553 9180-349

mailto:martin.gsell AT InnoSysTec.de <mailto:martin.gsell AT InnoSysTec.de>







Archive powered by MHonArc 2.6.24.

Top of Page