diff options
author | sanine <sanine.not@pm.me> | 2023-02-03 23:16:18 -0600 |
---|---|---|
committer | sanine <sanine.not@pm.me> | 2023-02-03 23:16:18 -0600 |
commit | 414bc3c6db05ec6d5127967eae39dbaa7f48ad2c (patch) | |
tree | 714c87d7d7963e20f9311a34968bab252159ea34 /src/xml/xml.c | |
parent | 1b4564c02380d10f7f8630d73441e7f9aa83c812 (diff) |
implement kai_tag_get_attr
Diffstat (limited to 'src/xml/xml.c')
-rw-r--r-- | src/xml/xml.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/xml/xml.c b/src/xml/xml.c index e2aa008..33782c4 100644 --- a/src/xml/xml.c +++ b/src/xml/xml.c @@ -18,3 +18,16 @@ struct kai_tag_t * kai_parse_string(const char *str) return document; } + + +char * kai_tag_get_attr(struct kai_tag_t *t, const char *attr) +{ + struct kai_attr_t *a = t->attrs; + while (a != NULL) { + if (strcmp(a->key, attr) == 0) { + return a->value; + } + a = a->next; + } + return NULL; +} |