summaryrefslogtreecommitdiff
path: root/src/xml/xml.c
diff options
context:
space:
mode:
authorsanine <sanine.not@pm.me>2023-02-04 12:41:32 -0600
committersanine <sanine.not@pm.me>2023-02-04 12:41:32 -0600
commitdb4aaea68f40f43e10ce73852630c94227001235 (patch)
treed8693709372cc8b9930c68f9fdd4abffc3f6c8d1 /src/xml/xml.c
parent059a70686c49d591fd7a193493745a7bc172cbca (diff)
add kai_tag_num_children()
Diffstat (limited to 'src/xml/xml.c')
-rw-r--r--src/xml/xml.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/xml/xml.c b/src/xml/xml.c
index ee3c879..7f101ee 100644
--- a/src/xml/xml.c
+++ b/src/xml/xml.c
@@ -58,3 +58,15 @@ char *kai_tag_attr_to_dup(struct kai_tag_t *t, const char *attr)
return strdup(val);
}
}
+
+
+int kai_tag_num_children(struct kai_tag_t *t)
+{
+ int count = 0;
+ struct kai_tag_t *child = t->children;
+ while (child != NULL) {
+ count += 1;
+ child = child->next;
+ }
+ return count;
+}