dump: Drop match1 parameter from dump_value().
[pspp] / parse-xml.c
index 9304e8b0dcc5f0e4dac0de070ade6ae058318e7c..9faa946f45a7ac64574312b8505d139d4e07f2ee 100644 (file)
@@ -111,12 +111,27 @@ print_attribute (xmlNode *node, const char *attr)
     {
       const char *s = (char *) xmlGetProp (node, (xmlChar *) attr);
       if (s)
-        printf ("%s %s\n", node->name, s);
+        printf ("%s %s=%s\n", node->name, attr, s);
 
       print_attribute (node->children, attr);
     }
 }
 
+static __attribute__((unused)) xmlNode *
+find_page_setup (xmlNode *node)
+{
+  for (; node; node = node->next)
+    {
+      if (node->name && !strcmp ((char *) node->name, "pageSetup"))
+        return node;
+
+      xmlNode *ps = find_page_setup (node->children);
+      if (ps)
+        return ps;
+    }
+  return NULL;
+}
+
 static void
 print_text (xmlNode *node)
 {
@@ -162,6 +177,14 @@ main (int argc, char **argv)
 
   xmlNode *root = xmlDocGetRootElement(doc);
 
+#if 0
+  /* Limit what we look at to pageSetup node and below. */
+  root = find_page_setup(root);
+  if (!root)
+    return 0;
+  root->next = NULL;
+#endif
+
   if (!strcmp(argv[2], "containment"))
     print_containment (root);
   else if (!strcmp(argv[2], "attributes"))