diff options
Diffstat (limited to 'src/xml/xml.c')
-rw-r--r-- | src/xml/xml.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/xml/xml.c b/src/xml/xml.c index 7f101ee..1b369c1 100644 --- a/src/xml/xml.c +++ b/src/xml/xml.c @@ -70,3 +70,22 @@ int kai_tag_num_children(struct kai_tag_t *t) } return count; } + + +struct kai_tag_t * kai_tag_get_first_child_with_type(struct kai_tag_t *t, char *type) +{ + struct kai_tag_t *child = t->children; + for (; child != NULL; child = child->next) { + if (strcmp(child->type, type) == 0) { return child; } + } + return NULL; +} + + +struct kai_tag_t * kai_tag_get_next_sibling_with_type(struct kai_tag_t *t, char *type) +{ + for (t = t->next; t != NULL; t = t->next) { + if (strcmp(t->type, type) == 0) { return t; } + } + return NULL; +} |