xml

i have a xml file to extact it i have written few code but these code only give me the root element the first childelement not ol the elements
code:
#include<stdio.h>
#include<libxml/parser.h>
#include<libxml/tree.h>
int main(int argc, char * argv[])
{
xmlDocPtr doc;
xmlNode *root,*cur,*node,*child;


doc = xmlReadFile((const char *)argv[1],NULL,0);
if (doc == NULL) {
printf("Failed to parse %s\n", (const char *)argv[1]);
return 1;
}
printf("XML Read Successful\n");
root = xmlDocGetRootElement(doc);
fprintf(stdout, "%s\n", root -> name);
node = root -> xmlChildrenNode;
/*node = root ;*/
/*fprintf(stdout,"%s\n", child -> name);*/
for ( cur = node; cur ; cur = node -> next){
if ( cur -> type == XML_ELEMENT_NODE){
printf("cur : %s\n", cur -> name);

xmlFreeDoc(doc);
xmlCleanupParser();
return 0 ;
}}
}
noone in this forum can help me ?????????????
Topic archived. No new replies allowed.