#167 Transforming with DOMSource(Document)

v7.7
closed
5
2015-02-18
2003-11-12
No

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:
<?xml version="1.0" encoding="UTF-8"?>
<foo/>

Discussion

  • Michael Kay

    Michael Kay - 2003-11-12

    Logged In: YES
    user_id=251681

    Is a bright-yellow highlighted message telling you not to
    enter suspected bugs in this area not visible enough? Can
    you suggest a better way I should tell people how to submit
    problems?

    Please use the saxon-help list or forum in future.

    This is a known problem and will be fixed in the next version.

    Michael Kay

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks