File:  [ELWIX - Embedded LightWeight unIX -] / gpl / axl / test / test_02a.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Wed Jun 8 07:09:12 2011 UTC (13 years, 1 month ago) by misho
Branches: axl, MAIN
CVS tags: HEAD, AXL0_6_7, AXL0_6_1
3th party - XML

    1: #include <axl.h>
    2: #include <stdio.h>
    3: 
    4: int main (int argc, char ** argv)
    5: {
    6: 	axlError * error = NULL;
    7: 	axlDtd   * dtd   = NULL;
    8: 
    9: 	/* top level definitions */
   10: 	axlDoc * doc = NULL;
   11: 
   12: 	/* initialize axl library */
   13: 	if (! axl_init ()) {
   14: 		printf ("Unable to initialize Axl library\n");
   15: 		return -1;
   16: 	}
   17: 
   18: 	/* get current doc reference */
   19: 	doc = axl_doc_parse_from_file ("gmovil2.xml", &error);
   20: 	if (doc == NULL) {
   21: 		printf ("Unable to parse file, error was: %s\n", axl_error_get (error));
   22: 		axl_error_free (error);
   23: 		return AXL_FALSE;
   24: 	}
   25: 
   26: 	/* parse dtd file */
   27: 	dtd = axl_dtd_parse_from_file ("fact.dtd", &error);
   28: 	if (dtd == NULL) {
   29: 		printf ("Unable to parse DTD file, error was: %s\n", axl_error_get (error));
   30: 		return axl_false;
   31: 	}
   32: 
   33: 	/* perform DTD validation */
   34: 	if (! axl_dtd_validate (doc, dtd, &error)) {
   35: 		printf ("Unable to validate file, error was: %s\n", axl_error_get (error));
   36: 		return axl_false;
   37: 	}
   38: 
   39: 	/* release the document */
   40: 	axl_doc_free (doc);
   41: 
   42: 	axl_dtd_free (dtd);
   43: 
   44: 	/* cleanup axl library */
   45: 	axl_end ();
   46: 
   47: 	return axl_true;
   48: }

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>