Details
-
Bug
-
Status: Resolved
-
Resolution: Fixed
-
2.0.0
-
None
-
None
-
Operating System: Other
Platform: All
-
7976
Description
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?