anio
anio

Reputation: 9161

Load DTD into SAX Parser in java

I need to parse a bunch of incoming xml documents, they all have the same DTD. I don't want the Sax Parser to load the DTD every time it has to parse a new xml document. Is there anyway I can load a DTD into the parser and have it reused on subsequent parse calls?

Upvotes: 1

Views: 2112

Answers (1)

Brian Agnew
Brian Agnew

Reputation: 272297

I'm not sure if your concern is loading the DTD from a remote URL each time you load a document.

If it is, then you can define an EntityResolver and specify a local copy of the DTD. That will provide a reference to the local instance of the DTD each time the SAX parser parses a document.

I don't believe there's a way to pre-load/pre-parse a DTD, unfortunately.

Upvotes: 3

Related Questions