eurephia_xml.h

Go to the documentation of this file.
00001 /* eurephia_xml.h  --  Generic helper functions for XML parsing
00002  *
00003  *  GPLv2 only - Copyright (C) 2008 - 2010
00004  *               David Sommerseth <dazo@users.sourceforge.net>
00005  *
00006  *  This program is free software; you can redistribute it and/or
00007  *  modify it under the terms of the GNU General Public License
00008  *  as published by the Free Software Foundation; version 2
00009  *  of the License.
00010  *
00011  *  This program is distributed in the hope that it will be useful,
00012  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  *  GNU General Public License for more details.
00015  *
00016  *  You should have received a copy of the GNU General Public License
00017  *  along with this program; if not, write to the Free Software
00018  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
00019  *
00020  */
00021 
00032 #ifndef         EUREPHIA_XML_H_
00033 # define        EUREPHIA_XML_H_
00034 
00038 typedef enum _exmlResultType { exmlRESULT = 1, 
00039                                exmlERROR       
00040 } exmlResultType;
00041 
00042 #include <stdarg.h>
00043 
00044 #ifdef HAVE_LIBXML2
00045 #include <libxml/tree.h>
00046 
00050 typedef struct _eurephiaRESULT {
00051         exmlResultType resultType; 
00052         const char *message;       
00053         xmlNode *details;          
00055 } eurephiaRESULT;
00056 
00063 #define foreach_xmlnode(start, itn)  for( itn = start; itn != NULL; itn = itn->next )
00064 
00065 void xmlReplaceChars(xmlChar *str, char s, char r);
00066 
00067 char *xmlGetAttrValue(xmlAttr *properties, const char *key);
00068 xmlNode *xmlFindNode(xmlNode *node, const char *key);
00069 
00070 int eurephiaXML_CreateDoc(eurephiaCTX *ctx, int format, const char *rootname, xmlDoc **doc, xmlNode **root_n);
00071 xmlNode *eurephiaXML_getRoot(eurephiaCTX *ctx, xmlDoc *doc, const char *nodeset, int min_format);
00072 
00073 xmlDoc *eurephiaXML_ResultMsg(eurephiaCTX *ctx, exmlResultType type, xmlNode *info_n, const char *fmt, ... );
00074 unsigned int eurephiaXML_IsResultMsg(eurephiaCTX *ctx, xmlDoc *resxml);
00075 eurephiaRESULT *eurephiaXML_ParseResultMsg(eurephiaCTX *ctx, xmlDoc *resxml);
00076 
00077 inline char *xmlExtractContent(xmlNode *n);
00078 inline char *xmlGetNodeContent(xmlNode *node, const char *key);
00079 
00080 #endif /* HAVE_LIBXML2 */
00081 
00082 #endif      /* !EUREPHIA_XML_H_ */
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines