Hi,
I can get the "SQLTransformer" sample as supplied in Cocoon 2.1 (eg
cocoon/samples/databases/transform/sql-page) to run and return results from the
database when using xalan.
However if I use saxon (version 6.5.3 or 7.6.5), the "SQLTransformer" sample throws
the following error "org.apache.cocoon.ProcessingException: Failed to execute
pipeline.: java.lang.UnsuportedOperationException: The Saxon DOM cannot be updated"
A part of the stack trace was:
Original Exception: java.lang.UnsupportedOperationException: The Saxon DOM cannot be
updated
at com.icl.saxon.om.AbstractNode.disallowUpdate(AbstractNode.java:609)
at com.icl.saxon.om.AbstractNode.removeChild(AbstractNode.java:496)
at
org.apache.cocoon.transformation.AbstractSAXTransformer.endRecording(AbstractSAXTransformer.java:486)
I then modified AbstractSAXTransformer.endRecording() so that no attempt was made to
update the DOM (code changes listed at bottom of this note).
The modified code was then tested with the "SQLTransformer" sample and xalan, and
found to return valid results.
The modified code was then test with the "SQLTransformer" sample and saxon ,and NO
results from the database were displayed.
Further investigation revealed that the line
final DocumentFragment recordedDocFrag = doc.createDocumentFragment();
was the problem, as doc.createDocumentFragment() is returning a null when saxon is
used.
Any advise/suggestions/help on how to get a DocumentFragment Object to be returned
from doc.createDocumentFragment() when using saxon would be greatly appreciated.
Software levels:
cocoon 2.1
jsdk1.4.2_01
jakarta-tomcat-4.1.27
saxon 6.5.3, saxon 7.6.5
Code changes to AbstractSAXTransformer:
add import org.w3c.dom.NodeList;
In method endRecording() replace the following:
// Node child;
// boolean appendedNode = false;
// while (root.hasChildNodes() == true) {
// child = root.getFirstChild();
// root.removeChild(child);
// // Leave out empty text nodes before any other node
// if (appendedNode == true
// || child.getNodeType() != Node.TEXT_NODE
// || child.getNodeValue().trim().length() > 0) {
// recordedDocFrag.appendChild(child);
// appendedNode = true;
// }
// }
with
if (recordedDocFrag != null) {
if (root.hasChildNodes() == true) {
NodeList children = root.getChildNodes();
Node child;
boolean appendedNode = false;
for (int index=0; index<children.getLength(); index++) {
child = children.item(index);
if (child != null) {
// Leave out empty text nodes before any other node
if (appendedNode == true
|| child.getNodeType() != Node.TEXT_NODE
|| child.getNodeValue().trim().length() > 0) {
recordedDocFrag.appendChild(child);
appendedNode = true;
}
}
}
}
}
Regards,
Mark.
__________________________________________________________________
McAfee VirusScan Online from the Netscape Network.
Comprehensive protection for your entire computer. Get your free trial today!
http://channels.netscape.com/ns/computing/mcafee/index.jsp?promo=393397
Get AOL Instant Messenger 5.1 free of charge. Download Now!
http://aim.aol.com/aimnew/Aim/register.adp?promo=380455
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]