errorWriter.close();
if(getLogger().isWarnEnabled()) {
getLogger().warn(stringWriter.toString());
}
DOMStreamer domStreamer = new DOMStreamer(this.contentHandler,
this.lexicalHandler);
this.contentHandler.startDocument();
if(xpath != null) {
NodeList nl = processor.selectNodeList(doc, xpath);
int length = nl.getLength();
for(int i=0; i < length; i++) {
domStreamer.stream(nl.item(i));
}
} else {
// If the HTML document contained a <?xml ... declaration, tidy would have recognized
// this as a processing instruction (with a 'null' target), giving problems further
// on in the pipeline. Therefore we only serialize the document element.
domStreamer.stream(doc.getDocumentElement());
}
this.contentHandler.endDocument();
} catch (IOException e){
throw new ResourceNotFoundException("Could not get resource "
+ this.inputSource.getURI(), e);