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