X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=parse-xml.c;h=7fc3da2ed1ba84acd2c6867d957129cc2c3f156b;hb=e1ef9687ac5b24e223f33050bd4ccde69c7cf227;hp=9304e8b0dcc5f0e4dac0de070ade6ae058318e7c;hpb=86b334a2694bd7e55392531ddb6dc0f2eda6a063;p=pspp diff --git a/parse-xml.c b/parse-xml.c index 9304e8b0dc..7fc3da2ed1 100644 --- a/parse-xml.c +++ b/parse-xml.c @@ -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);