diff --git a/samples/IDOMCount/IDOMCount.cpp b/samples/IDOMCount/IDOMCount.cpp
index 6239790445eeac7604546b0c2e81d92bd6425392..7503135e0ec4b481da9362d28ed05dda679cc57a 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;
 }