FYI, it turns out that the following does work:

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

-Brian


-----Original Message-----
From: ROBINSON,BRIAN (HP-NewJersey,ex2) [mailto:[EMAIL PROTECTED]
Sent: Thursday, April 11, 2002 12:20 PM
To: '[EMAIL PROTECTED]'
Subject: can't get node using XpathAPI


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?



Brian R. Robinson
Hewlett-Packard Company
Middleware Division
6000 Irwin Road
Mount Laurel, NJ 08054
(856) 638-6096

Reply via email to