X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=parse-xml.c;h=9faa946f45a7ac64574312b8505d139d4e07f2ee;hb=92a04dcbe26bed7d6c044f06414bc54e0dbb1ad1;hp=9304e8b0dcc5f0e4dac0de070ade6ae058318e7c;hpb=86b334a2694bd7e55392531ddb6dc0f2eda6a063;p=pspp diff --git a/parse-xml.c b/parse-xml.c index 9304e8b0dc..9faa946f45 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 __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"))