diff options
author | Silvan Jegen <s.jegen@gmail.com> | 2016-09-01 20:56:52 +0200 |
---|---|---|
committer | Silvan Jegen <s.jegen@gmail.com> | 2016-09-01 20:56:52 +0200 |
commit | c5ac33dcd1ec134b860049cfad235d01bde0bf3e (patch) | |
tree | ede12ca9e858d949dd1ae2ffddf7a3b1c3d88786 | |
parent | 581b24aaf0e15313b7dc4160471f907c59a8f34c (diff) |
Get Text node
-rw-r--r-- | mxml.c | 18 |
1 files changed, 14 insertions, 4 deletions
@@ -24,7 +24,7 @@ int process(FILE *f) { mxml_node_t *root, *node, *next; const char* elename; - root = mxmlLoadFile(NULL, f, MXML_NO_CALLBACK); + root = mxmlLoadFile(NULL, f, MXML_TEXT_CALLBACK); elename = mxmlGetElement(root); if (elename) printf("%s\n", elename); @@ -38,10 +38,20 @@ int process(FILE *f) { while ((next = mxmlWalkNext(node, root, MXML_DESCEND))) { elename = mxmlGetElement(next); - if (elename) + if (elename) { printf("%s\n", elename); - // if (!strcmp(elename, "article-title")) - // printf("OMG: %s\n", elename); + if (!strcmp(elename, "article-title")) { + next = mxmlWalkNext(next, root, MXML_DESCEND); + mxml_type_t t = mxmlGetType(next); + printf("T %d\n", t); + if (t == MXML_TEXT) { + printf("IS TEXT %d\n", t); + } + const char* txt = mxmlGetText(next, NULL); + if (txt) + printf("article-title txt: %s\n", txt); + } + } node = next; } |