diff options
author | David Sommerseth <dazo@users.sourceforge.net> | 2009-09-25 13:36:33 +0200 |
---|---|---|
committer | David Sommerseth <dazo@users.sourceforge.net> | 2009-09-25 13:36:33 +0200 |
commit | 5fa2fe46f25c793765e5cc107f1d48a51086fcab (patch) | |
tree | 60ca75fda217a26e422bce297da5f0449f97f50a /common | |
parent | e02152930f53d69c9ef1a4bb3dc5e8dacc961062 (diff) | |
download | eurephia-5fa2fe46f25c793765e5cc107f1d48a51086fcab.tar.gz eurephia-5fa2fe46f25c793765e5cc107f1d48a51086fcab.tar.xz eurephia-5fa2fe46f25c793765e5cc107f1d48a51086fcab.zip |
Added eurephiaXML_IsResultMsg() to check if an XML doc is a ResultMsg document
Diffstat (limited to 'common')
-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); |