diff options
author | Silvan Jegen <s.jegen@gmail.com> | 2016-09-08 21:33:45 +0200 |
---|---|---|
committer | Silvan Jegen <s.jegen@gmail.com> | 2016-09-08 21:33:45 +0200 |
commit | 7136cf7c9198f6ffb9e693e029143fea460cf760 (patch) | |
tree | 0f3ac56748b4a0c4e4c4a3184b185627cc5a7667 | |
parent | 041b3508e1f9bee3990c779ea42f917d4ecdc136 (diff) |
Print the article-title
For some reason the article-title tags get never closed. Instead of
checking the name of the closed element name, we just check if we are in
the element we are searching for or not.
As long as the element whose content we want to print does not have any
nested elements itself this approach works as well.
-rw-r--r-- | yxml.c | 11 |
1 files changed, 6 insertions, 5 deletions
@@ -93,6 +93,7 @@ int process(char *fn, yxml_t *state) { switch(r) { case YXML_ELEMSTART: if (!strcmp(state->elem, "article-title")) { + printf("start: %s\n", state->elem); inelement = 1; } break; @@ -104,12 +105,12 @@ int process(char *fn, yxml_t *state) { break; case YXML_ELEMEND: - if (strcmp(state->elem, "article-title")) { - break; + printf("elementend: %s\n", state->elem); + if (inelement) { + inelement = 0; + printf("%s\n", contentbuf->buffer); + buffer_reset(contentbuf); } - inelement = 0; - printf("%s\n", contentbuf->buffer); - buffer_reset(contentbuf); break; } } |