How do I turn off validation when parsing well-formed XML using DocumentBuilder.parse?
I'm using Java 6. I want to parse XHTML that I know is well-formed. As such, I don't want to do any validation against DTD's or other schemas referenced in the doc. However, I'm having trouble figuring out how to turn that validation off. I have DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setValidating(false); final DocumentBuilder b = factory.newDocumentBuilder(); final InputSource s = new InputSource(new StringReader(str)); org.w3c.dom.Document result = b.parse(s); But I still get an exception on the last line ... java.net.SocketException: Unexpected end of