None I'm aware of, but then, I don't regularly work with DOM.
I've seen estimates that the DOM can take 5-10 times the size of the XML file.

XSLT processors like Xalan or Saxon use their own lightweight DOM 
implementations that are tuned to the application. The main difference is 
that their DOM's don't support the tree modification operations. If you are 
brave, you could do the same.

Perhaps you don't really need the whole thing in memory at once.
Dom4j, an alternative to W3C DOM under Java (www.dom4j.org), has a great 
feature of ElementHandler. As you parse your XML, you can build only portions 
of the tree in memory, work with XPath over these portions, and throw the 
portions when you're done with them. E.g., a data batch can have a header 
(which may be a portion you want to keep for the whole time of your 
processing) and zillions of data records (which you will process one by one 
anyway), so you throw away the record when you've processed it.

Jan

Rob Outar wrote:
| Is there any way to lower the amount of memory Xerces uses to build the DOM
| tree?  A setting, feature, property?  If so, what impact will it have on
| the DOM?
|
| Thanks,
|
| Rob
|
| -----Original Message-----
| From: Jan Dvorak [mailto:[EMAIL PROTECTED]
| Sent: Friday, June 21, 2002 12:19 PM
| To: [EMAIL PROTECTED]; Rob Outar
| Subject: Re: OutOfMemoryError using Xerces 1.4.3
|
|
| Hello Rob,
|
| A DOM tree for a 25 meg XML file may take hundreds of megs in memory.
| You can increase the JVM memory limit with the -Xmx option.
|
| Jan
|
| Rob Outar wrote:
| > Hello all,
| >
| >     I am parsing a 25 meg XML file using Xerces 1.4.3 DOMParser and I keep
| > getting an OutOfMemory Exception.  I know this process will take some
|
| time,
|
| > but I did not expect to be out of memory.  Is this normal for this size
| > file?  Can Xerces 2 or some other parser better handle memory?
| >
| > Let me know,
| >
| > Rob
| >
| >
| > ---------------------------------------------------------------------
| > To unsubscribe, e-mail: [EMAIL PROTECTED]
| > For additional commands, e-mail: [EMAIL PROTECTED]
|
| ---------------------------------------------------------------------
| To unsubscribe, e-mail: [EMAIL PROTECTED]
| For additional commands, e-mail: [EMAIL PROTECTED]
|
|
| ---------------------------------------------------------------------
| To unsubscribe, e-mail: [EMAIL PROTECTED]
| For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to