summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvan Jegen <s.jegen@gmail.com>2016-09-05 19:07:39 +0200
committerSilvan Jegen <s.jegen@gmail.com>2016-09-05 19:07:39 +0200
commit6fef5e077a3a5687b335be1260bc030661326c07 (patch)
tree3bfa5f4b81110b4911709cc77a80e927b74d55f0
parent3fec4606d27a1d9e41a40bb89060494763f9978b (diff)
Print titles
-rw-r--r--ezxml.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/ezxml.c b/ezxml.c
index c981bb2..f4e9d18 100644
--- a/ezxml.c
+++ b/ezxml.c
@@ -11,9 +11,19 @@ int process(char *fn) {
ezxml_t title = ezxml_get(ezdoc, "front", 0, "article-meta", 0, "title-group", 0, "article-title", -1);
if (title) {
- printf("title: %s\n", title->txt);
+ printf("article-title: %s\n", title->txt);
}
+ ezxml_t body = ezxml_get(ezdoc, "body", -1);
+ if (!body) {
+ fprintf(stderr, "body not found\n");
+ }
+ for (ezxml_t c = ezxml_child(body, "sec"); c; c = c->next) {
+ ezxml_t t = ezxml_get(c, "title", -1);
+ printf("t: %s\n", t->txt);
+ }
+
+ printf("\n");
return 0;
}