1 /* Copyright (C) 2001-2004 Kenichi Suto 2 * 3 * This program is free software; you can redistribute it and/or modify 4 * it under the terms of the GNU General Public License as published by 5 * the Free Software Foundation; either version 2 of the License, or 6 * (at your option) any later version. 7 * 8 * This program is distributed in the hope that it will be useful, 9 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 * GNU General Public License for more details. 12 * 13 * You should have received a copy of the GNU General Public License 14 * along with this program; if not, write to the Free Software 15 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 16 */ 17 18 #ifndef __XML_H__ 19 #define __XML_H__ 20 21 #include <glib.h> 22 23 /* 24 $B9=B$BN$O(B xmlDoc $B$H(B xmlNode $B$N$U$?$D!#(B 25 xmlDoc $B$K$O(B root $B$,$"$j!"$3$l$,%k!<%H%N!<%I$H$J$k!#(Broot $B$OL>A0$r;}$?$:!"C1$K;R%N!<%I$r;}$D$?$a$N$b$N$G$"$k!#(B 26 */ 27 28 typedef GNode xmlNode; 29 30 typedef struct { 31 xmlNode *root; 32 gchar *version; 33 gchar *encoding; 34 } xmlDoc; 35 36 typedef enum { 37 XML_OK, 38 XML_NG, 39 } xmlResult; 40 41 typedef struct _NODE_DATA { 42 char *name; 43 char *content; 44 GList *attr; 45 gint depth; 46 xmlDoc *doc; 47 } NODE_DATA; 48 49 typedef struct _NODE_ATTR { 50 char *name; 51 char *value; 52 } NODE_ATTR; 53 54 55 xmlResult parse_buffer(GNode *parent, gchar *text, guint length); 56 gchar *encoded_to_special(gchar *text); 57 gchar *special_to_encoded(gchar *text); 58 59 xmlDoc *xml_parse_file(gchar *filename); 60 xmlDoc *xml_doc_new(); 61 xmlResult xml_save_file(gchar *filename, xmlDoc *doc); 62 xmlResult xml_print_tree(xmlDoc *doc); 63 xmlNode *xml_add_child(xmlNode *parent, gchar *name, gchar *cotent); 64 xmlNode *xml_get_child(xmlNode *node); 65 xmlNode *xml_get_next(xmlNode *node); 66 gchar *xml_get_name(xmlNode *node); 67 gchar *xml_get_content(xmlNode *node); 68 gchar *xml_get_attr(xmlNode *node, gchar *name); 69 xmlResult xml_set_attr(xmlNode *node, gchar *name, gchar *value); 70 xmlResult xml_destroy_document(xmlDoc *doc); 71 72 73 #endif /* __XML_H__ */ 74