Project

Profile

Help

Bug #200

closed

Transforming with DOMSource(Document)

Added by Anonymous about 21 years ago. Updated over 12 years ago.

Status:
Rejected
Priority:
Normal
Assignee:
-
Category:
JAXP Java API
Sprint/Milestone:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Legacy ID:
sf-840634
Applies to branch:
Fix Committed on Branch:
Fixed in Maintenance Release:
Platforms:

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

TransformerTest.java (9.56 KB) TransformerTest.java Anonymous, 2003-11-12 10:57

Please register to edit this issue

Also available in: Atom PDF