Coker, Jonathan M wrote:
Hello,
If I get a XalanNode from an XPath evaluation, is there some way I can
access a sibling node by name? So if I have
<entry>
<name>fred</name>
<number>1</number>
//could be other elements
</entry>
<entry>
<name>barney</name>
<number>2</number>
//could be other elements
</entry>
and using XPath I get to the 'name' XalanNode for "barney". Are there
XalanNode functions that will let me get the 'number' node sibilng of
'barney' using something like 'getElementByName'? I was hoping to
avoid iterating over the list of siblings and comparing names. Any help
or discussion would be appreciated.
No, there is no specific functionality to do that. You can always execute
another XPath expression to do that:
"following-sibling::number"
with the "barney" node as the context node. Of course, under the covers,
the XPath engine is just doing that exact same code for you.
Dave