I am trying to parse an web response with DOM parser like this:
public static Document parseDocument(InputStream sr) throws Exception {
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setNamespaceAware(true);
dbf.setIgnoringComments(true);
dbf.setIgnoringElementContentWhitespace(true);
dbf.setCoalescing(true);
//dbf.setValidating(false);
Document xdoc = dbf.newDocumentBuilder().parse(new InputSource(sr));
xdoc.normalize();
return xdoc;
}
The problem is that
Document xdoc = dbf.newDocumentBuilder().parse(new InputSource(sr));
takes 3 min to be executed. My xml file has 3800 lines. Is than normaé and how to improve this?
Thank you.