I am trying to write some Java code to parse very large XML documents and would like to use a DOM parser. However the size of the XML document precludes this so I thought I'd use StAX and the transform sub-trees of the source XML into a DOMResult instance. I have written the basic code but get the following error:
XML-22004: (Fatal Error) Error while parsing input XML document (null).
The error occurs when I try to do the transformation and the relevant parts of the code are is as follows:
StAXSource source = new StAXSource(xsr) // xsr is my XMLStreamReader instance.
DOMResult dom = new DOMResult();
I developed the code within JDeveloper as the code is intended to form part of an ADF application. However, I've run EXACTLY the same code using Eclipse as my IDE and it works perfectly. I've also tried to run it using the XML JDK and get the same error as with JDeveloper. The question is is this type of transformation not supported with the Oracle StaX/Transformer implementations and if it is, what do I need to add to my code to get the transformation to work?
Alternatively, does anyone know what implementation Oracle uses for the TransformerFactory class?
Edited by: George Nelson on May 24, 2012 7:44 PM
XSLT may be used in JDeveloper. Refer
Thanks for the link and a book I've added to my favourites on Safari. I need to find out more about SAXSources (I was using a StAXSource as the source object for the transform). However, using the JXSAXTransformerFactory implementation, I still get the same error: XML-22004: (Fatal Error) Error while parsing input XML document (null).
I can find very little literature of any kind on doing a StaX->DOM transformation although I would have thought this would have been common for anybody parsing very large XML documents - DOM would be the preferred parsing method but the document size precludes it. The StAX->DOM transformation resolves the problem by converting sub-trees of the source document to DOM.