code: public int getLength()
    {
  
      // It is assumed that the getChildNodes call synchronized
      // the children. Therefore, we can access the first child
      // reference directly.
      int count = 0;
  
      for (ElemTemplateElement node = m_firstChild; node != null;
              node = node.m_nextSibling)
      {
        count++;
      }
  
      return count;
    }
docs: NodeList method: Count the immediate children of this node
  
  @return The count of children of this node