DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=7976>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=7976

XPathAPI.selectSingleNode() can't select a node relative to a node that is not the 
document's root

           Summary: XPathAPI.selectSingleNode() can't select a node relative
                    to a node that is not the document's root
           Product: XalanJ2
           Version: 2.0.0
          Platform: All
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: org.apache.xpath
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]
                CC: [EMAIL PROTECTED]


I'm having trouble with XPathAPI.selectSingleNode().

My document:

<?xml version="1.0"?>
<encryption-service>
    <encryption-scheme name="sample"
        algorithm="DES"
        provider="SunJCE"
        provider-class="com.sun.crypto.provider.SunJCE"
        key-size="56"
        key-store-type="JCEKS"/>
</encryption-service>


When getNode() returns the node that represents 'encryption-scheme', the
following two calls return null:

            Node node = XPathAPI.selectSingleNode( getNode(),
"attribute::algorithm" );
            Node node = XPathAPI.selectSingleNode( getNode(),
"/attribute::algorithm" );

But this call works:

            Node node = XPathAPI.selectSingleNode( getNode(),
"/encryption-service/encryption-scheme/attribute::algorithm" );

It seems that the xpath expression is being evaluated relative to the root
of the document, even though I'm passing in a node that is not the root.
I've seen there is another signature for selectSingleNode() that takes a
namespace node, but I have no idea how to use it.  If using this call is my
answer, can someone describe how to do this?

Reply via email to