diff options
author | Christian Neumair <cneumair@gnome.org> | 2006-04-05 12:30:17 +0000 |
---|---|---|
committer | Christian Neumair <cneumair@gnome.org> | 2006-04-05 12:30:17 +0000 |
commit | fa74079b19c1f0ef88d0ce529603d78c487f5e86 (patch) | |
tree | 2afd65d891c8204bf762dff772901bc54c807a3e /test-subclassing.c | |
parent | 6e34b3238cbac9098e6869958b1b3f7feefb7813 (diff) | |
download | shared-mime-info-fa74079b19c1f0ef88d0ce529603d78c487f5e86.tar.gz |
2006-04-05 Christian Neumair <chris@gnome-de.org>
* freedesktop.org.xml.in: Make "application/postscript",
a subclass of "text/plain". Thanks to Sebastian Heutling,
Tristan Wibberley and Sebastien Bacher.
Add missing sub-classing information to a few dozen other
MIME types, including "application/rtf", "application/pdf",
ODF and OOo MIME types.
* Makefile.am:
* test-subclassing.c:
Add simple XML parser that checks for presence of "sub-class-of"
nodes in freedesktop.org.xml and outputs MIME types that don't
provide the flag.
Diffstat (limited to 'test-subclassing.c')
-rw-r--r-- | test-subclassing.c | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/test-subclassing.c b/test-subclassing.c new file mode 100644 index 00000000..dd099e44 --- /dev/null +++ b/test-subclassing.c @@ -0,0 +1,47 @@ +#include <libxml/tree.h> +#include <stdio.h> +#include <string.h> + +int +main (int argc, + char **argv) +{ + xmlDocPtr doc; + xmlNodePtr node; + + doc = xmlReadFile ("freedesktop.org.xml", NULL, 0); + if (doc == NULL) { + fprintf (stderr, "Reading \"freedesktop.org.xml\" failed. Aborting.\n"); + return 1; + } + + if ((node = xmlDocGetRootElement (doc)) == NULL) { + fprintf (stderr, "\"freedesktop.org.xml\" has no root node. Aborting.\n"); + return 1; + } + + for (node = node->children; node != NULL; node = node->next) { + if (!strcmp ((char *) node->name, "mime-type")) { + xmlNodePtr p; + xmlChar *prop; + + for (p = node->children; p != NULL; p = p->next) { + if (!strcmp ((char *) p->name, "sub-class-of")) { + break; + } + } + + if (p != NULL) { + /* got sub-class-of node */ + continue; + } + + prop = xmlGetProp (node, (xmlChar *) "type"); + printf ("%s\n", prop); + xmlFree (prop); + } + } + + xmlFreeDoc (doc); + return 0; +} |