commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 32360] - [jxpath] Default Namespace not handled correctly
Date Sat, 22 Oct 2005 11:42:54 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=32360>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=32360





------- Additional Comments From runger@cim.mcgill.ca  2005-10-22 13:42 -------
I still do not see things this way. While I agree with Dmitri on what the specs
say, I think this is a case where we can go beyond the specs. This would buy us
compatibility with the way XSLT processors handle this issue, while at the same
time not losing compatibility with the spec, since not setting any namespaces
will yield the default behaviour.

The way I see things the document:

<parent>
  <test xmlns="http://test">
    <child-element />
  </test>
<parent>

has the following namespaces for its elements:

<parent>                          <-- no namespace
  <test xmlns="http://test">      <-- namespace "http://test"
    <child-element />             <-- namespace "http://test"
  </test>
<parent>

To correctly access it in JXPath the following is needed:

context.registerNamespace("foo","http://test")
context.getValue("/parent/foo:test/foo:child-element")

I don't see a problem here really. Basically I was referring more to the problem
that JXPath does not offer the same flexibility that XSLT does. The way I see
things, the following should all be legal uses of JXPath:

Case 1:
context.registerNamespace("foo",null)
context.registerNamespace(null,"http://test")
context.getValue("/foo:parent/test/child-element")

Case 2:
context.registerNamespace("foo",null)
context.registerNamespace("bar","http://test")
context.getValue("/foo:parent/bar:test/bar:child-element")

Case 3:
context.registerNamespace(null,null)
context.registerNamespace("foo","http://test")
context.getValue("/parent/foo:test/foo:child-element")

These 3 cases should ALL give the SAME node as their result -> child-element
In XSLT this would work, but currently not in JXPath

THAT was the bug I was talking about.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message