summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvan Jegen <s.jegen@gmail.com>2016-09-08 21:33:45 +0200
committerSilvan Jegen <s.jegen@gmail.com>2016-09-08 21:33:45 +0200
commit7136cf7c9198f6ffb9e693e029143fea460cf760 (patch)
tree0f3ac56748b4a0c4e4c4a3184b185627cc5a7667
parent041b3508e1f9bee3990c779ea42f917d4ecdc136 (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.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/yxml.c b/yxml.c
index b55999a..1fd0f51 100644
--- a/yxml.c
+++ b/yxml.c
@@ -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;
}
}