'How to find specific child node in xml file using libxml2

I have an xml file like this

<file>
    <a>thisisa</a>
    <b>thisisb</b>
    <c>
         <c1 param1="team1" place="winner" game="cricket">
             www.team1.com
         </c1>
         <c2 param1="team2" place="runner" game="football">
             www.team2.com
         </c2>
    </c>       
</file>

I want to print all the games in this file using libxml2 in C. (like cricket and football in this example). I tried using xmlFirstElementChild. But this increasing the time complexity of the solution as it requires while loops. Is there any better solution to implement this?



Solution 1:[1]

You can use xmlfindchild(node parent,node child ,child prop id).

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 ouflak