Bug #200
closedTransforming with DOMSource(Document)
0%
Description
SourceForge user: rzschech
Transforming with the input of a DOMSource wraped
around a Document causes a TransformerException with
message "DOMSender: no start node defined"
I've tracked the problem down to the class
net.sf.saxon.Controller around line 1370:
// Must copy the whole document, not just the subtree
org.w3c.dom.Document dom = ds.getNode().getOwnerDocument();
((DOMSource)source).setNode(dom);
If ds.getNode() is a Document than getOwnerDocument()
returns null. I fixed it by changin the code to:
// Must copy the whole document, not just the subtree
if (ds.getNode().getNodeType()!=Node.DOCUMENT_NODE) {
org.w3c.dom.Document dom =
ds.getNode().getOwnerDocument();
((DOMSource)source).setNode(dom);
}
Ive attached a test case.
No that it should matter, the implementation class of
my Document is org.apache.xerces.dom.DocumentImpl but
the definition of getOwnerDocument() is defined as
returning null for Document nodes.
Actual Result:
Error
DOMSender: no start node defined
Exception in thread "main"
javax.xml.transform.TransformerException: DOMSender: no
start node defined
at
net.sf.saxon.event.DOMSender.send(DOMSender.java:75)
at
net.sf.saxon.event.Sender.sendDOMSource(Sender.java:108)
at net.sf.saxon.event.Sender.send(Sender.java:61)
at
net.sf.saxon.Controller.transform(Controller.java:1377)
at
com.TransformerTest.main(TransformerTest.java:31)
Expected Result:
Files
Please register to edit this issue