samedi 25 avril 2015

How to parse XML without validation using JDOM2


I am trying to parse XML using JDOM2. I want to skip both XSD and DTD validation. I tried code bellow:

SAXBuilder jdomBuilder = new SAXBuilder(XMLReaders.NOVALIDATING);
jdomBuilder.build(stream);

I tested by trying to parse XML that has DTD reference, and by disconnecting from network. It still tries to fetch DTD. I'm getting

java.net.UnknownHostException: dtd.nlm.nih.gov

Does anyone know how can I force JDOM2 to skip validation completely?

Thanks in advance!


Aucun commentaire:

Enregistrer un commentaire