I have a org.w3c.dom.Node object.
I would like to see if it has any other siblings.
Here s what I have tried:
Node sibling = node.getNextSibling();
if(sibling == null)
return true;
else
return false;
HOWEVER, for some reason (possibly due to identation or line spaces in the source XML) I am not getting the expected result.
[Also
node.getParentNode().getChildNodes().getLength()
is giving a value higher higher than I would expect.]
I welcome your suggestions to improve this code.
EDIT
As suggested below it seems that blank nodes are thwarting my attempts to count the siblings.
The xml looks something like this:
<a>
<b>
<c>I have this node:</c>
<c>I want to know how many of these there are.</c>
<c>This is another sibling.</c>
</b>
<b>
</b>
</a>
Starting from my node (the first <c></c> above), how do I find out the number of other siblings?