+}
+
+static void
+print_attributes (xmlNode * a_node)
+{
+ for (xmlNode *node = a_node; node; node = node->next)
+ {
+ if (node->properties && node->parent->type != XML_DOCUMENT_NODE)
+ {
+ printf ("%s", node->name);
+ for (xmlAttr *attr = node->properties; attr; attr = attr->next)
+ printf (" %s", attr->name);
+ putchar ('\n');
+ }
+
+ print_attributes (node->children);
+ }
+}
+
+static void
+print_attribute (xmlNode *node, const char *attr)
+{
+ for (; node; node = node->next)
+ {
+ const char *s = (char *) xmlGetProp (node, (xmlChar *) attr);
+ if (s)
+ puts (s);
+
+ print_attribute (node->children, attr);
+ }
+}
+
+static void
+usage (void)
+{
+ fprintf (stderr, "usage: parse-xml FILE.xml containment|attributes\n");
+ exit (1);
+}
+
+int
+main (int argc, char **argv)
+{
+ if (argc != 3)
+ usage ();