From b68c42a9c77f782ba4cd0f97888adf0129da095f Mon Sep 17 00:00:00 2001
From: Tinny Ng <tng@apache.org>
Date: Wed, 27 Mar 2002 18:03:43 +0000
Subject: [PATCH] Correct count element routine.

git-svn-id: https://svn.apache.org/repos/asf/xerces/c/trunk@173592 13f79535-47bb-0310-9956-ffa450edef68
---
 samples/IDOMCount/IDOMCount.cpp | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/samples/IDOMCount/IDOMCount.cpp b/samples/IDOMCount/IDOMCount.cpp
index 623979044..7503135e0 100644
--- a/samples/IDOMCount/IDOMCount.cpp
+++ b/samples/IDOMCount/IDOMCount.cpp
@@ -112,16 +112,9 @@ static int countChildElements(IDOM_Node *n)
     int count = 0;
     if (n) {
         if (n->getNodeType() == IDOM_Node::ELEMENT_NODE)
-        {
             count++;
-            for (child = n->getFirstChild(); child != 0; child=child->getNextSibling())
-            {
-                if (child->getNodeType() == IDOM_Node::ELEMENT_NODE)
-                {
-                    count += countChildElements(child);
-                }
-            }
-        }
+        for (child = n->getFirstChild(); child != 0; child=child->getNextSibling())
+            count += countChildElements(child);
     }
     return count;
 }
-- 
GitLab