Document pageSetup.
[pspp] / parse-xml.c
index 9304e8b0dcc5f0e4dac0de070ade6ae058318e7c..7fc3da2ed1ba84acd2c6867d957129cc2c3f156b 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 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)
 {
@@ -161,6 +176,10 @@ main (int argc, char **argv)
     }
 
   xmlNode *root = xmlDocGetRootElement(doc);
+  root = find_page_setup(root);
+  if (!root)
+    return 0;
+  root->next = NULL;
 
   if (!strcmp(argv[2], "containment"))
     print_containment (root);