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; +}