+static void
+print_parents(xmlNode *node)
+{
+ for (; node; node = node->next)
+ {
+ if (node->type == XML_ELEMENT_NODE)
+ {
+ for (xmlNode *child = node->children; child; child = child->next)
+ {
+ if (child->type == XML_ELEMENT_NODE)
+ printf ("%s %s\n", node->name, child->name);
+ else if (child->type == XML_TEXT_NODE)
+ printf ("%s <text>\n", node->name);
+ else if (child->type == XML_CDATA_SECTION_NODE)
+ printf ("%s <cdata>\n", node->name);
+ else if (child->type == XML_COMMENT_NODE)
+ printf ("%s <comment>\n", node->name);
+ else
+ printf ("%s <%d>\n", node->name, child->type);
+ }
+ }
+
+ print_parents (node->children);
+ }
+}
+