//we have to use CloseShieldInputStream otherwise the parser closes the stream and we cant later reread
final InputStream shieldedInputStream = new CloseShieldInputStream(cfis);
responseNode = (NodeImpl)ModuleUtils.htmlToXHtml(context, method.getURI().toString(), new InputSource(shieldedInputStream), parserFeatures, parserProperties).getDocumentElement();
builder.addAttribute(new QName("type", null, null), "xhtml" );
responseNode.copyTo(null, new DocumentBuilderReceiver(builder));
} catch(final URIException ue) {
throw new XPathException(this, ue.getMessage(), ue);
} catch(final SAXException se) {
//could not parse to xml(html)
logger.debug("Could not parse http response content from HTML to XML: " + se.getMessage(), se);