# Parse child value from XML using ezxml

I'm parsing an XML file and searching for a child value.

As I'm familiar with this XML file structure, I know that the final value is a child of a child, and so I wrote the following code section:

/*Parse XML file and find device friendlyName*/
pxUpnp = ezxml_parse_file(XML_FILE_PATH);

pxUpnpChild = ezxml_child(pxUpnp, "device");

/*Looking for friendlyName sub-child*/
pxUpnpSubChild = ezxml_child(pxUpnpChild, "friendlyName");


This code works, but I wander if there is a better or more elegant method to parse a 'child of a child' value using ezxml library?

ezxml has a variadic function which allows you to traverse directly to a specific node, terminated by either -1 as the index, or an empty string for the node name:
pxUpnpSubChild  = ezxml_get(pxUpnp, "device", 0, "friendlyName", 0, "");

This would give you directly the first friendlyName node of the first device node. Internally, it does mostly the same as what you did manually.