diff options
-rw-r--r-- | mxml.c | 24 |
1 files changed, 21 insertions, 3 deletions
@@ -21,20 +21,38 @@ mxml_type_t type_cb(mxml_node_t *node) { } int process(FILE *f) { - mxml_node_t *root; + mxml_node_t *root, *node, *next; const char* elename; - root = mxmlLoadFile(NULL, f, type_cb); + root = mxmlLoadFile(NULL, f, MXML_NO_CALLBACK); elename = mxmlGetElement(root); if (elename) printf("%s\n", elename); + + node = mxmlFindElement(root, root, "title-group", + NULL, NULL, MXML_DESCEND); + + elename = mxmlGetElement(node); + if (elename) + printf("%s\n", elename); + + while ((next = mxmlWalkNext(node, root, MXML_DESCEND))) { + elename = mxmlGetElement(next); + if (elename) + printf("%s\n", elename); + // if (!strcmp(elename, "article-title")) + // printf("OMG: %s\n", elename); + + node = next; + } + + return 0; } int main(int argc, char *argv[]) { FILE *f; for (int i = 0; i < argc; i++) { - printf("%s\n", argv[i]); f = fopen(argv[i], "r"); process(f); fclose(f); |