--- /dev/null
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <libxml/xmlreader.h>
+#include <libxml/xmlmemory.h>
+
+void
+error_exit (char *fmt, char *arg)
+{
+ fprintf (stderr, fmt, arg);
+ exit (1);
+}
+
+int
+main (int argc, char **argv)
+{
+#if 0
+ XPathContextPtr context;
+ xmlXPathObjectPtr result;
+ xmlChar *xpath = (xmlChar *) "//input-method";
+ xmlChar *key;
+ xmlNodeSetPtr nodeset;
+#endif
+ int i;
+ xmlTextReaderPtr reader;
+
+ reader = xmlReaderForFile (argv[1], "utf-8", 0);
+ xmlTextReaderRelaxNGValidate (reader, argv[2]);
+ while ((i = xmlTextReaderRead (reader)) == 1);
+ printf ("%d\n\n", i);
+
+#if 0
+ doc = xmlParseFile (argv[1]);
+ if (! doc)
+ error_exit ("Invalid XML file: %s", argv[1]);
+ context = xmlXPathNewContext (doc);
+ result = xmlXPathEvalExpression (xpath, context);
+ if (! result)
+ error_exit ("Error in xmlXPathEvalExpression for: %s", (char *) xpath);
+ xmlXPathFreeContext (context);
+ if (xmlXPathNodeSetIsEmpty (result->nodesetval))
+ error_exit ("Can't find the node: %s", (char *) xpath);
+ nodeset = result->nodesetval;
+ for (i = 0; i < nodeset->nodeNr; i++)
+ {
+ key = xmlGetProp (nodeset->nodeTab[i], "input-method-name");
+ printf ("input-method-name: %s\n", key);
+ xmlFree (key);
+ key = xmlGetProp (nodeset->nodeTab[i], "language");
+ printf ("langauge: %s\n", key);
+ xmlFree (key);
+ key = xmlGetProp (nodeset->nodeTab[i], "extra-id");
+ if (key)
+ {
+ printf ("extra-id: %s\n", key);
+ xmlFree (key);
+ }
+ }
+ xmlXPathFreeObject (result);
+#endif
+ exit (0);
+}