if (node.getNodeType() == Node.DOCUMENT_NODE) {
// Pass all SAX events
handler = contentHandler;
} else {
// Strip start/endDocument
handler = new EmbeddedXMLPipe(contentHandler);
}
SAXResult result = new SAXResult(handler);
result.setLexicalHandler(lexicalHandler);