[JAXP] Trying to avoid downloading DTD file once for each new file parsed
Hello all,
I'm currently learning JAXP & DOM parsing. And I must admit that it's pretty nice. But I've got only two little problems left.
OK, for the first one : I'm used to parse several XHTML files one after the other and in the process, as soon as I open a new file and parse it (code following), it downloads the corresponding DTD :
*********************
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setNamespaceAware(true);
factory.setValidating(false);
DocumentBuilder builder= factory.newDocumentBuilder();
Document doc = builder.parse(myFile);
*********************
But I find it a little bit annoying because a) all my files use the same DTD and b) downloading it and all its inline linked resources is a rather long process.
So my question is : is there any way not to download the DTD each time I parse a new file ? I mean : downloading it only once would be great. Caching, maybe or anything else ? I've tried not to create a factory and a builder each time, but unfortunately, it seems that the retrieving of the DTD is a part of the parse() call itself...
Cheers !

