I need to process XML files with DTDs with XSLT in Java. DTD is really necessary because it contains the definitions of the objects that I use. (aside: yes, using entities for things that can use unicode is a bad idea ;-)
When I start the conversion, it loads the DTD from an external source every time. I want it to use the XML directory for DTD caching, so I gave TransformerFactory a CatalogResolver as URIResolver :
URIResolver cr = new CatalogResolver(); tf = TransformerFactory.newInstance(); tf.setURIResolver(cr); Transformer t = tf.newTransformer(xsltSrc); t.setURIResolver(cr); Result res = new SAXResult(myDefaultHandler()); t.transform(xmlSrc, res);
But when I start the conversion, it still loads the DTD over the network. (Using Xalan and Xerces is either part of Java5, or standalone, or using Saxon and Xerces.)
What is required to force the conversion to use only a local copy of the DTD?
java xml xslt
robcast
source share