When a query is run using a (wrapped) DOM or JDOM tree
as input, and a SAXResult as output, an incorrect event
stream is sent to the SAX ContentHandler, typically
resulting in a stack exception because an endElement is
recieved for which there was no matching startElement.
Fix: in net.sf.saxon.om.Navigator, at line 457, add:
// notify the start of content out.startContent();
I have also noticed that in this scenario the
ContentHandler is notified of the XML namespace. To
prevent this, the QueryResult.serialize() method will
in future add a NamespaceReducer to the output pipeline.