init
This commit is contained in:
commit
32ef62bd20
11 changed files with 2354 additions and 0 deletions
31
example.c
Normal file
31
example.c
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
#include <xmllib.h>
|
||||
|
||||
void recursive(xmllib_node_t* node, int indent){
|
||||
int i;
|
||||
xmllib_node_t* n;
|
||||
for(i = 0; i < indent; i++) printf(" ");
|
||||
printf("%s\n", node->name);
|
||||
|
||||
n = node->first_child;
|
||||
while(n != NULL){
|
||||
recursive(n, indent + 2);
|
||||
n = n->next;
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char** argv){
|
||||
int i;
|
||||
|
||||
for(i = 1; i < argc; i++){
|
||||
xmllib_t* h = xmllib_open_file(argv[i]);
|
||||
if(h != NULL){
|
||||
printf("%s:\n", argv[i]);
|
||||
if(xmllib_parse(h)){
|
||||
if(h->root != NULL) recursive(h->root, 2);
|
||||
}else{
|
||||
printf(" Parse error\n");
|
||||
}
|
||||
xmllib_close(h);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue