3 * synopsis: Parse an XML file to a tree and free it
4 * purpose: Demonstrate the use of xmlReadFile() to read an XML file
5 * into a tree and and xmlFreeDoc() to free the resulting tree
6 * usage: parse1 test1.xml
7 * test: parse1 test1.xml
8 * author: Daniel Veillard
9 * copy: see Copyright for the status of this software.
13 #include <libxml/parser.h>
14 #include <libxml/tree.h>
18 * @filename: a filename or an URL
20 * Parse the resource and free the resulting tree
23 example1Func(const char *filename) {
24 xmlDocPtr doc; /* the resulting document tree */
26 doc = xmlReadFile(filename, NULL, 0);
28 fprintf(stderr, "Failed to parse %s\n", filename);
34 int main(int argc, char **argv) {
39 * this initialize the library and check potential ABI mismatches
40 * between the version it was compiled for and the actual shared
45 example1Func(argv[1]);
48 * Cleanup function for the XML library.
52 * this is to debug memory for regression tests