5 #include <libxml/xmlmemory.h>
6 #include <libxml/parser.h>
9 getReference (xmlDocPtr doc
, xmlNodePtr cur
) {
12 cur
= cur
->xmlChildrenNode
;
14 if ((!xmlStrcmp(cur
->name
, (const xmlChar
*)"reference"))) {
15 uri
= xmlGetProp(cur
, "uri");
16 printf("uri: %s\n", uri
);
26 parseDoc(char *docname
) {
31 doc
= xmlParseFile(docname
);
34 fprintf(stderr
,"Document not parsed successfully. \n");
38 cur
= xmlDocGetRootElement(doc
);
41 fprintf(stderr
,"empty document\n");
46 if (xmlStrcmp(cur
->name
, (const xmlChar
*) "story")) {
47 fprintf(stderr
,"document of the wrong type, root node != story");
52 getReference (doc
, cur
);
58 main(int argc
, char **argv
) {
63 printf("Usage: %s docname\n", argv
[0]);