Main Page | Alphabetical List | Compound List | File List | Compound Members | File Members

lxml.h

Go to the documentation of this file.
00001 /*
00002  * XetPan: a libEtPan! based Mail User Agent
00003  * Copyright (C) 2002-2003 Melvin Hadasht
00004  *
00005  * This program is free software; you can redistribute it and/or modify
00006  * it under the terms of the GNU General Public License as published by
00007  * the Free Software Foundation; either version 2 of the License, or
00008  * (at your option) any later version.
00009  *
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU General Public License
00016  * along with this program; if not, write to the Free Software
00017  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00018  */
00019 
00020 #ifndef LXML_H
00021 #define LXML_H
00022 
00023 /* #ifdef USE_MMAP */
00024 #include <sys/stat.h>
00025 /* #endif */
00026 
00027 #include "cntree.h"
00028 #include "clist.h"
00029 
00030 typedef struct LXMLhandle_s LXMLhandle;
00031 
00032 typedef struct LXMLelement_s LXMLelement;
00033 
00034 typedef struct LXMLstore_s LXMLstore;
00035 
00036 typedef struct LXMLelement_callbacks_s LXMLelement_callbacks;
00037 
00058 struct LXMLstore_s
00059 {
00060   char *attr;      
00061   int value_type;  
00063   void **dest;     
00065   int dest_kind;   
00067 };
00068 
00089 struct LXMLelement_callbacks_s
00090 {
00091   char *element_name; 
00092   int (*callback)(cntree *atree, void **data, void **data_iter, int op); 
00093   void **data; 
00094 };
00095 
00096 enum
00097   {
00098     LXML_String = 1, 
00099     LXML_Int,        
00100     LXML_Boolean     
00101   };
00102 
00103 enum
00104   {
00105     LXML_Unique = 1, 
00106     LXML_List        
00109   };
00110 
00111 enum
00112   {
00113     LXML_None, 
00114     LXML_Read, 
00116     LXML_Write 
00118   };
00119 
00120 /* XML file <-> tree conversion */
00121 
00125 LXMLhandle *
00126 lxml_new(void);
00127 
00132 void
00133 lxml_free(LXMLhandle *handle);
00134 
00140 int
00141 lxml_set_filename(LXMLhandle *handle, const char *filename);
00142 
00151 int
00152 lxml_set_encoding(LXMLhandle *handle, const char *encoding);
00153 
00162 const char *
00163 lxml_get_encoding(LXMLhandle *handle);
00164 
00172 int
00173 lxml_set_dtd(LXMLhandle *handle, const char *dtd);
00174 
00183 const char *
00184 lxml_get_dtd(LXMLhandle *handle);
00185 
00193 int
00194 lxml_file_open(LXMLhandle *handle, int mode);
00195   
00201 int
00202 lxml_file_close(LXMLhandle *handle);
00203 
00218 cntree *
00219 lxml_file_read(LXMLhandle *handle);
00220 
00233 int
00234 lxml_file_write(LXMLhandle *handle, cntree *ntree);
00235 
00236 /* tree handling functions */
00237 
00242 cntree *
00243 lxml_tree_new(void);
00244 
00250 void
00251 lxml_tree_free(cntree *ntree);
00252 
00258 void
00259 lxml_tree_free_structural_data(cntree *ntree);
00260 
00266 LXMLelement *
00267 lxml_tree_get_element(cntree *ntree);
00268 
00269 /* tree <-> application data conversion */
00270 
00285 int 
00286 lxml_tree_for_each_element_in_path(cntree *ntree, char **path,
00287                                int (*callback)(cntree *atree, 
00288                                                void *adata, 
00289                                                int aop), 
00290                                void *data,
00291                                int op);
00292 
00335 int
00336 lxml_tree_convert(cntree *ntree, LXMLelement_callbacks *element_cb, int op);
00337 
00338 /* Element handling functions */
00339 
00349 int
00350 lxml_element_name(LXMLelement *element, char *name, int op);
00351 
00387 int
00388 lxml_element_store_attr(LXMLelement *element, LXMLstore *store, int op);
00389 
00394 int
00395 lxml_element_attr_count(LXMLelement *element);
00396 
00397 #endif
00398 
00399 /* vim: set cindent shiftwidth=2 tabstop=2 expandtab :*/  
00400 

Generated on Wed Oct 22 15:50:40 2003 for XetPan by doxygen 1.3.2