This commit is contained in:
Nishi 2025-12-22 18:22:46 +09:00
commit 32ef62bd20
Signed by: nishi
GPG key ID: 27EF69B208EB9343
11 changed files with 2354 additions and 0 deletions

31
example.c Normal file
View 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);
}
}
}