posted 22 years ago
I'm hoping someone can help me out... we're working on a project to run a series of very simple stylesheets on some moderate sized XML files (couple megs up to about 10 megs) to extract a few lines of data. We'd hoped to parse the document once initially, then pass a DOM reference to each Transformer. But, we've run into some problems.
If we do Transformer.transform(StreamSource, StreamResult), and just provide the XML file as the first param, things go fairly smoothly. But, if we get a DOM reference to the file beforehand and just pass a DOMSource to the Transformer, the app uses about 200+ megs of memory (vs. less than 50 normally on a <10 meg file) and takes considerably longer to complete.
Can someone key me in to what we're doing wrong? Shouldn't using a DOMSource be faster, if anything, than using a StreamSource? Is the latter using SAX or something like that?
Thanks very much,
-tim