how to... transform xmlstreamreader to dom
I have code which creates an XMLStreamReader for an xml file with a dtd.
I want to get a dom for this. Any tried and true methods?
What I ran into:
The DocumentBuilder routines that parse the xml into a dom do not accept
STaXSource or XMLStreamReaders.
So I was using the transform method, using the identity transform, using pipes,
where the source was StaXSource and the output was the pipe.
I was able to get an InputStream this way from the XmlStreamReader, but the transform itself did not like the dtd, because it appears it was calling SAX, so I got parse errors during the transform itself, before I got to the point of parsing the xml into a dom.
That is, the transform gave parse errors, when I used STaXSource.
These were due to the dtd. When I deleted the dtd, no errors. But the problem is,
I cannot do any configuration of the factory for the parsing that is done "under the hood" of the transform, because the parser is not a visible part of the process.