diff options
-rw-r--r-- | common/eurephia_xml.c | 16 | ||||
-rw-r--r-- | common/eurephia_xml.h | 1 |
2 files changed, 17 insertions, 0 deletions
diff --git a/common/eurephia_xml.c b/common/eurephia_xml.c index 91eacf4..0dc42ae 100644 --- a/common/eurephia_xml.c +++ b/common/eurephia_xml.c @@ -236,6 +236,22 @@ xmlNode *eurephiaXML_getRoot(eurephiaCTX *ctx, xmlDoc *doc, const char *nodeset, /** + * Checks if the given XML document is an eurephia ResultMsg XML document + * + * @param ctx eurephiaCTX + * @param resxml XML document to validate + * + * @return Returns 1 if the input XML document is a ResultMsg document. Otherwise 0 + */ +unsigned int eurephiaXML_IsResultMsg(eurephiaCTX *ctx, xmlDoc *resxml) { + xmlNode *node = NULL; + + assert( (ctx != NULL) && (resxml != NULL) ); + node = eurephiaXML_getRoot(ctx, resxml, "Result", 1); + return (node != NULL ? 1 : 0); +} + +/** * Parses an eurephia Result XML document * * @param ctx eurephiaCTX diff --git a/common/eurephia_xml.h b/common/eurephia_xml.h index 614394a..2ee1175 100644 --- a/common/eurephia_xml.h +++ b/common/eurephia_xml.h @@ -69,6 +69,7 @@ int eurephiaXML_CreateDoc(eurephiaCTX *ctx, int format, const char *rootname, xm xmlNode *eurephiaXML_getRoot(eurephiaCTX *ctx, xmlDoc *doc, const char *nodeset, int min_format); xmlDoc *eurephiaXML_ResultMsg(eurephiaCTX *ctx, exmlResultType type, xmlNode *info_n, const char *fmt, ... ); +unsigned int eurephiaXML_IsResultMsg(eurephiaCTX *ctx, xmlDoc *resxml); eurephiaRESULT *eurephiaXML_ParseResultMsg(eurephiaCTX *ctx, xmlDoc *resxml); inline char *xmlExtractContent(xmlNode *n); |