databinding-saxon corrupts XML documents when transforming from XMLStreamReader
to NodeInfo
-------------------------------------------------------------------------------------------
Key: TUSCANY-3689
URL: https://issues.apache.org/jira/browse/TUSCANY-3689
Project: Tuscany
Issue Type: Bug
Components: SCA Java Runtime
Affects Versions: Java-SCA-1.6
Reporter: Simon Nash
Assignee: Simon Nash
Fix For: Java-SCA-1.6.1
The xml-bigbank demo fails on Tuscany SCA 1.5, 1.5.1, and 1.6 because of a
problem with the databinding-saxon transformation from XMLStreamReader to
NodeInfo. It works on Tuscany SCA 1.4.
This problem isn't related to the frequent unavailability of the live exchange
rate RSS feed and the live stock quote web service used by this demo. For test
purposes I have proved this by stubbing out these remote calls and using known
good data instead.
The problem is caused by the two-step transformation from XMLStreamReader to
NodeInfo. The first step transforms the XMLStreamReader to a DOM using
org.apache.tuscany.sca.databinding.xml.XMLStreamReader2Node, and the second
step transforms the DOM to a NodeInfo using
org.apache.tuscany.sca.databinding.saxon.Node2NodeInfoTransformer. The first
step is corrupting the name of the top-level node in the XML document by
changing it to "arg1". The second step works OK.
The following code in XMLStreamReader2Node is causing the name of the top-level
node to be corrupted:
if (node instanceof Document) {
Document doc = (Document)node;
return DOMHelper.adjustElementName(context,
doc.getDocumentElement());
} else {
return node;
}
The node name is corrupted by the call to DOMHelper.adjustElementName(). This
name adjustment is necessary when transforming an XML instance document for use
as a SOAP parameter, but it shouldn't happen when transforming an XML document
for passing to a Saxon XQuery script..
I've looked in the obvious places for differences in the code between 1.4 and
1.6 that would explain why this corruption didn't occur on 1.4, but I haven't
been able to find out exactly what changed and triggered the problem.
The simplest and safest way to fix this without risking disturbing other
transformation code paths is to write a new dedicated databinding transformer
for the specific case that isn't working.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.