[ 
https://issues.apache.org/jira/browse/ODE-663?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12867343#action_12867343
 ] 

Rafal Rusin commented on ODE-663:
---------------------------------

I don't know actually. 
I think we can replace interface for cloneNode, because in most cases we use it 
for ElementNode and DocumentNode only (and I think it's enough to have those 2 
utils methods). Below are all places, where cloneNode is used:

bpel-runtime/src/main/java/org/apache/ode/bpel/elang/xpath20/runtime/JaxpFunctionResolver.java:
            Element clonedElmt = (Element) parentElmt.cloneNode(true);
bpel-runtime/src/main/java/org/apache/ode/bpel/elang/xpath20/runtime/JaxpFunctionResolver.java:
            Element clonedElmt = (Element) parentElmt.cloneNode(true);
bpel-runtime/src/main/java/org/apache/ode/bpel/elang/xpath20/runtime/JaxpFunctionResolver.java:
            Element clonedElmt = (Element) parentElmt.cloneNode(true);
bpel-runtime/src/main/java/org/apache/ode/bpel/elang/xpath20/runtime/JaxpFunctionResolver.java:
            Element clonedElmt = (Element) targetElmt.cloneNode(true);
bpel-runtime/src/main/java/org/apache/ode/bpel/elang/xpath20/runtime/JaxpFunctionResolver.java:
            Element clonedElmt = (Element) targetElmt.cloneNode(true);
bpel-runtime/src/main/java/org/apache/ode/bpel/elang/xpath20/runtime/JaxpFunctionResolver.java:
            final Element clonedElmt = (Element) parentElmt.cloneNode(true);
bpel-runtime/src/main/java/org/apache/ode/bpel/elang/xpath20/runtime/JaxpFunctionResolver.java:
            Element clonedElmt = (Element) parentElmt.cloneNode(true);
bpel-runtime/src/main/java/org/apache/ode/bpel/elang/xquery10/runtime/XQuery10ExpressionRuntime.java:
                   itemValue = DOMUtils.cloneNode(document, ((Document) 
itemValue).getDocumentElement());
bpel-runtime/src/main/java/org/apache/ode/bpel/elang/xquery10/runtime/XQuery10ExpressionRuntime.java:
                   itemValue = DOMUtils.cloneNode(document, (Node) itemValue);
bpel-runtime/src/main/java/org/apache/ode/bpel/elang/xquery10/runtime/XQuery10ExpressionRuntime.java:
                   resultValue = DOMUtils.cloneNode(document, (Node) 
resultValue); 
bpel-runtime/src/main/java/org/apache/ode/bpel/engine/MyRoleMessageExchangeImpl.java:
        clone.setMessage((Element) message.getMessage().cloneNode(true));
bpel-runtime/src/main/java/org/apache/ode/bpel/engine/MyRoleMessageExchangeImpl.java:
            clone.setHeaderPart(partName, (Element) 
headerParts.get(partName).cloneNode(true)); 
bpel-runtime/src/main/java/org/apache/ode/bpel/engine/MyRoleMessageExchangeImpl.java:
            clone.setHeaderPart(partName, (Element) 
parts.get(partName).cloneNode(true)); 

So we can make less generic interface for cloneNode and we can also implement 
it using DOMUtils.domToString and stringToDom. This way implementation will be 
simple too. 
I think it's a good way, because this cloneNode method implementation has so 
much corner cases that it's not worth digging.
What do you think?


> 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, ode1.x-663-v3.txt, 
> ode1.x-663-v4.txt, ode1.x-663-v5.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.

Reply via email to