From 6fef5e077a3a5687b335be1260bc030661326c07 Mon Sep 17 00:00:00 2001 From: Silvan Jegen Date: Mon, 5 Sep 2016 19:07:39 +0200 Subject: Print titles --- ezxml.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) 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; } -- cgit v1.2.3