static const char *nodename(xmlNode *node, char *buf, int len)
{
- /* Don't print out the node name if it is "text" */
- if (!strcmp(node->name, "text")) {
- node = node->parent;
- if (!node || !node->name)
- return "root";
- }
+
+ if (!node || !node->name)
+ return "root";
buf += len;
*--buf = 0;
if (!len)
return;
+ /* Don't print out the node name if it is "text" */
+ if (!strcmp(node->name, "text"))
+ node = node->parent;
+
name = nodename(node, buffer, sizeof(buffer));
entry(name, len, content);