summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mxml.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/mxml.c b/mxml.c
index 7d73988..df49af4 100644
--- a/mxml.c
+++ b/mxml.c
@@ -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;
}