[
https://issues.apache.org/jira/browse/ODE-663?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12866239#action_12866239
]
David Carver commented on ODE-663:
----------------------------------
There is a problem in general with the exist code and Saxon. From the Saxon
website:
"This DOM interface is read-only, so all attempts to call updating methods
throw an appropriate DOM exception....It is not possible to construct the tree
using DOM methods such as createElement() and createAttribute()"
Which means the the Document that is passed into cloneNode(Document, Node) and
returned has to be one that can be manipulated.
So code like the following will not work and will retun an
UnsupportedOperationException:
System.setProperty(DOCUMENT_BUILDER_FACTORY,
SAXON_DOM_DOCUMENT_BUILDER_FACTORY);
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setNamespaceAware(true);
DocumentBuilder saxonBuilder = factory.newDocumentBuilder();
Document doc = saxonBuilder.parse(new
ByteArrayInputStream(testString.getBytes()));
Node node = doc.getFirstChild();
Node clonedNode = DOMUtils.cloneNode(doc, node);
This is due to the use of createElementNS and createAttributeNS methods
in the existing code.
> DOMUtils.cloneNode results in invalid namespace declaration
> -----------------------------------------------------------
>
> Key: ODE-663
> URL: https://issues.apache.org/jira/browse/ODE-663
> Project: ODE
> Issue Type: Bug
> Components: BPEL Runtime
> Affects Versions: 1.3.3, 1.3.4
> Reporter: Mark Ford
> Assignee: Rafal Rusin
> Priority: Critical
> Fix For: 1.3.4
>
> Attachments: ode1.x-663-v1.txt, ode1.x-663-v2.txt
>
>
> The DOMUtils.cloneNode code doesn't handle default namespace declarations
> correctly when processing an XQuery result from Saxon.
> For example:
> <ns1:parent xmlns:ns1="abc">
> <ns1:child xmlns="def">
> <ns2:nestedChild xmlns:ns2="def"/>
> </ns1:child>
> </ns1:parent>
> results in:
> <ns1:parent xmlns:ns1="abc">
> <ns1:child xmlns:xmlns="def">
> <ns2:nestedChild xmlns:ns2="def"/>
> </ns1:child>
> </ns1:parent>
> Notice that the default namespace has been rewritten as xmlns:xmlns which is
> invalid.
> Granted the above example is a bit odd, but strange things can happen when
> passing nodes in and out of XSLT and XQuery with respect to namespace
> declarations.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.