[
https://issues.apache.org/jira/browse/ODE-663?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12853980#action_12853980
]
David Carver commented on ODE-663:
----------------------------------
Yes, the DOM will loose that namespace because at that point in time it doesn't
necessarily know that it is in scope for the node as it doesn't look at the
parent or ancestors when cloning, and this is done according to spec. There
is one potential problem with the example though from a true XML Namespace
compliance standpoint. Namespace prefixes aren't significant the namespace it
self is significant. Namespaces can be redefined at different levels so a
prefix could change.
<root>
<ns:child1 xmlns:ns="http://www.example.org/ns2">
<ns:child2 xmlns:ns="http://www.example.org/ns1"/>
</ns:child1>
</root>
The above is valid XML and valid according to XML Namespaces 1.1 specification.
Should the DOMUtils.clone copy in the parent definition, or ignore it?
http://www.example.org/ns2 becomes no longer in scope at this point because
ns:child2 has the default namespace redefined to http://wwww.example.org/ns1.
My gut says that if you ns:child2, you should loose the namespace for ns:child1
as it's not in scope. The other thing to consider is the following fragment:
<root>
<ns:child1 xmlns:ns="http://www.example.org/ns2">
<ns:child2 xmlns:ns="http://www.example.org/ns1"/ encoded="ns:child1">
</ns:child1>
</root>
What does child1 refer to, and which namespace is it going to get?
Just tossing some what ifs out there for discussion.
> 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: Karthick Sankarachary
> Priority: Critical
> Fix For: 1.3.5
>
> Attachments: ode1.x-663-v1.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.