Is there a way to disable XML validation based on external DTD/XSD without modifications to the source code (of the libraries that construct DocumentBuilder)? Something like setting JVM-wide defaults for DocumentBuilderFactory features, and the same for SAX?
Validation is great when editing files in IDE, but I don't need my webapp failing to start just because somelib.net went down.
I know I can specify local DTD/XSD locations, but that's an inconvenient workaround.
What are the options? I can think of two:
- Implement my own DocumentBuilderFactory.
- Intercept construction of Xerces's DocumentBuilderImpl and modify the
features
Hashtable (addhttp://apache.org/xml/features/nonvalidating/load-external-dtd
).
DocumentBuilderFactory.isValidating()
defaulted to false. Do you mean entity resolving? – Accessible