From e5b592e29a3be4b021836dd364f94c8e4137ef4e Mon Sep 17 00:00:00 2001 From: NishiOwO Date: Sun, 1 Mar 2026 02:55:27 +0900 Subject: [PATCH] xl_get_attribute --- include/xemil.h | 2 ++ src/core.c | 12 ++++++++++++ 2 files changed, 14 insertions(+) diff --git a/include/xemil.h b/include/xemil.h index f3d409d..80755ba 100644 --- a/include/xemil.h +++ b/include/xemil.h @@ -71,6 +71,8 @@ XLDECL int xl_parse(xemil_t* handle); XLDECL void xl_close(xemil_t* handle); +XLDECL char* xl_get_attribute(xl_node_t* node, const char* key); + /* file.c */ XLDECL xl_driver_t* xl_driver_file; diff --git a/src/core.c b/src/core.c index c3700d3..04a3c69 100644 --- a/src/core.c +++ b/src/core.c @@ -569,3 +569,15 @@ void xl_close(xemil_t* handle) { handle->driver->close(handle); free(handle); } + +char* xl_get_attribute(xl_node_t* node, const char* key){ + xl_attribute_t* attr = node->first_attribute; + + while(attr != NULL){ + if(strcmp(attr->key, key) == 0) return attr->value; + + attr = attr->next; + } + + return NULL; +}