I am using StAX to process a XML file. The document has a DOCTYPE reference to a dtd file
<!DOCTYPE onlineDoc SYSTEM "onlineDoc.dtd">
I get the XML from the internet (am streaming it), and the DTD file lies just next to the XML (but – like the xml – on the remote machine).
Now the DTD contains some entity declarations, that are used in the XML i.e.
<!ENTITY Ntilde "Ñ" ><!-- capital N, tilde -->
I dont provide the DTD yet, so the StAX parser throws an exception saying that the entity Ntilde cannot be resolved.
Q: how do I provide the DTD file to the parser (it would be best, if it could be a stream from teh internet).
With Woodstox everything’s fine. Here’s my snippet (using
ClasspathResourceclass from Spring):it works and for:
prints:
in Maven use: