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 ago) by misho
Branches: axl, MAIN
CVS tags: HEAD, AXL0_6_7, AXL0_6_1
3th party - XML

#include <axl.h>
#include <stdio.h>

int main (int argc, char ** argv)
{
	axlError * error = NULL;
	axlDtd   * dtd   = NULL;

	/* top level definitions */
	axlDoc * doc = NULL;

	/* initialize axl library */
	if (! axl_init ()) {
		printf ("Unable to initialize Axl library\n");
		return -1;
	}

	/* get current doc reference */
	doc = axl_doc_parse_from_file ("gmovil2.xml", &error);
	if (doc == NULL) {
		printf ("Unable to parse file, error was: %s\n", axl_error_get (error));
		axl_error_free (error);
		return AXL_FALSE;
	}

	/* parse dtd file */
	dtd = axl_dtd_parse_from_file ("fact.dtd", &error);
	if (dtd == NULL) {
		printf ("Unable to parse DTD file, error was: %s\n", axl_error_get (error));
		return axl_false;
	}

	/* perform DTD validation */
	if (! axl_dtd_validate (doc, dtd, &error)) {
		printf ("Unable to validate file, error was: %s\n", axl_error_get (error));
		return axl_false;
	}

	/* release the document */
	axl_doc_free (doc);

	axl_dtd_free (dtd);

	/* cleanup axl library */
	axl_end ();

	return axl_true;
}

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