diff options
Diffstat (limited to 'common')
-rw-r--r-- | common/eurephia_xml.c | 21 | ||||
-rw-r--r-- | common/eurephia_xml.h | 2 |
2 files changed, 23 insertions, 0 deletions
diff --git a/common/eurephia_xml.c b/common/eurephia_xml.c index d47ef85..dec397f 100644 --- a/common/eurephia_xml.c +++ b/common/eurephia_xml.c @@ -43,6 +43,27 @@ /** + * String replace in a xmlChar based string + * + * @param str xmlChar input string + * @param s search for this character + * @param r replace the character with this one + */ +void xmlReplaceChars(xmlChar *str, char s, char r) { + if( str != NULL ) { + xmlChar *ptr = str; + + while( *ptr != '\0' ) { + if( *ptr == s ) { + *ptr = r; + } + ptr++; + } + } +} + + +/** * Retrieves a given XML node attribute/property * * @param attr xmlAttr pointer from an xmlNode pointer. diff --git a/common/eurephia_xml.h b/common/eurephia_xml.h index 2ee1175..083a881 100644 --- a/common/eurephia_xml.h +++ b/common/eurephia_xml.h @@ -62,6 +62,8 @@ typedef struct _eurephiaRESULT { */ #define foreach_xmlnode(start, itn) for( itn = start; itn != NULL; itn = itn->next ) +void xmlReplaceChars(xmlChar *str, char s, char r); + char *xmlGetAttrValue(xmlAttr *properties, const char *key); xmlNode *xmlFindNode(xmlNode *node, const char *key); |