title: Counting number of Childs for a node using libxml2
body: <p>I'm using libxml2 version 2.6.32 which doesn't have function xmlChildElementCount so I wrote my custom function which is given below</p>
  
  <pre><code>int child_node_count(const xmlNodePtr nodePtr){
      register int i = 0;
      for(xmlNodePtr node = nodePtr-&gt;children;node;node = node-&gt;next,i++);
      return i --;
  }
  </code></pre>
  
  <p>Now when I've a node in this fashion <code>&lt;node&gt;somevalue&lt;/node&gt;</code> I was expecting the function to return 0 count but I'm getting count as 1 is this a mistake in my code or somevalue is really a child of <code>&lt;node&gt;</code>. (I don't know how libxml2 represents XML as )</p>