The xml tool project provides developers
functions that uses the libxml2 library.
It provides an easy way to input and
output configurations from/to xml files
and handlers to deal with small or big xml databases.
00001 /* Xmltools project. 00002 * The xml tool project provides developers functions that uses the libxml2 library. 00003 * It provides an easy way to input and output configurations from/to xml files 00004 * and handlers to deal with small or big xml databases. 00005 * Copyright (C) 2004 Nicholas Niro 00006 * 00007 * This library is free software; you can redistribute it and/or 00008 * modify it under the terms of the GNU Lesser General Public 00009 * License as published by the Free Software Foundation; either 00010 * version 2.1 of the License, or (at your option) any later version. 00011 * 00012 * This library is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 * Lesser General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU Lesser General Public 00018 * License along with this library; if not, write to the Free Software 00019 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00020 */ 00021 00022 00028 #ifndef __XMLTOOL_H 00029 #define __XMLTOOL_H 00030 00034 enum returns 00035 { 00036 N_MAP_UNEXIST= -4, 00037 PARENT_UNEXIST= -3, 00038 CHILD_UNEXIST= -2, 00039 INCORRECT_INPUT= -1, 00040 NO_ERROR= 0, 00041 CHILD_EXISTS= 1, 00042 PARENT_EXISTS= 2, 00043 FILE_UNEXIST= 3, 00044 NODE_SAME_CONTENT= 4 00045 }; 00046 00047 /* Basic function prototypes below 00048 * 00049 * Made by Nik_89 00050 */ 00051 00052 00058 extern void Xmltool_Perror( 00062 char *message ); 00063 00065 void Xmltool_SetError( 00067 int source); 00068 00070 void Xmltool_GetError( 00072 int *destination); 00073 00074 /* set of functions to Input, 00075 * Output, Edit and Delete to the xml file. 00076 * They are used to add, edit, read 00077 * and remove only 1 item at a time. 00078 */ 00079 00081 extern int Xmltool_WriteToXml( 00083 char *filename, 00085 char *parent_name, 00087 char *node_name, 00089 char *node_info); 00090 00092 extern char *Xmltool_ReadFromXml( 00094 char *filename, 00096 char *parent_name, 00098 char *child_name); 00099 00101 extern int Xmltool_EditToXml( 00103 char *filename, 00105 char *parent_name, 00107 char *node_name, 00109 char *node_info); 00110 00112 extern int Xmltool_RemoveFromXml( 00114 char *filename, 00116 char *parent_name, 00118 char *child_name); 00119 00120 00121 /* 00122 * set of functions to Input, 00123 * Output, Edit and Delete to the xml file. 00124 * They are used to add, edit, read and remove 00125 * as many nodes as there is in the n_map struct. 00126 * 00127 * FIXME : the Edit and Delete functions aren't done yet 00128 */ 00129 00131 extern int Xmltool_GetXmlDesc( 00133 char *filename ); 00134 00136 extern int Xmltool_MAddXml( 00138 char *filename ); 00139 00141 extern struct node_map *Xmltool_MReadXml( 00143 char *filename, 00145 char *parent_node, 00147 char *node_name, 00151 char *content); 00152 00154 extern void Xmltool_Clean(); 00155 00156 #endif