how to disable dtd at runtime in java’s xpath?
You should be able to specify your own EntityResolver, or use specific features of your parser? See here for some approaches. A more complete example: <?xml version=”1.0″?> <!DOCTYPE foo PUBLIC “//FOO//” “foo.dtd”> <foo> <bar>Value</bar> </foo> And xpath usage: import java.io.File; import java.io.IOException; import java.io.StringReader; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.xpath.XPath; import javax.xml.xpath.XPathFactory; import org.w3c.dom.Document; import … Read more