1: /* include support from the base library */
2: #include <axl.h>
3:
4: /* include support for ns */
5: #include <axl_ns.h>
6:
7: /* declare our namespace */
8: #define HTML_NS "http://www.w3.org/1999/xhtml"
9:
10: int main (int argc, char ** argv)
11: {
12: axlDoc * doc;
13: axlNode * node;
14: axlError * error;
15:
16: /* init axl library */
17: if (! axl_init ())
18: return -1;
19:
20: /* parse xml document with namespace declarations */
21: doc = axl_doc_parse_from_file ("test_28.xml", &error);
22: if (doc == NULL) {
23: printf ("Unable to read document: %s\n", axl_error_get (error));
24: axl_error_free (error);
25: return -1;
26: } /* end if */
27:
28: /* call to validate namespace */
29: if (! axl_ns_doc_validate (doc, &error)) {
30: printf ("Namespace validation error: %s\n", axl_error_get (error));
31: axl_error_free (error);
32: return -1;
33: } /* end if */
34:
35: /* get root document */
36: node = axl_doc_get_root (doc);
37:
38: /* check default namespace */
39: if (! axl_ns_node_cmp (node, HTML_NS, "table")) {
40: printf ("expected to find a valid ns-node-cmp, but it wasn't found");
41: return -1;
42: }
43:
44: /* free document */
45: axl_doc_free (doc);
46:
47: /* terminate axl execution */
48: axl_end ();
49:
50: return 0;
51: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>