Fix error creation and warning
[claws.git] / src / common / xml.h
blob1ecca42399a7c2d712b638fda130bf97db992b44
1 /*
2 * Claws Mail -- a GTK based, lightweight, and fast e-mail client
3 * Copyright (C) 1999-2012 Hiroyuki Yamamoto and the Claws Mail team
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 3 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 #ifndef __XML_H__
21 #define __XML_H__
23 #include <glib.h>
24 #include <stdio.h>
26 #define XMLBUFSIZE 8192
28 typedef struct _XMLAttr XMLAttr;
29 typedef struct _XMLTag XMLTag;
30 typedef struct _XMLNode XMLNode;
31 typedef struct _XMLFile XMLFile;
33 struct _XMLAttr
35 gchar *name;
36 gchar *value;
39 struct _XMLTag
41 gchar *tag;
42 GList *attr;
45 struct _XMLNode
47 XMLTag *tag;
48 gchar *element;
51 struct _XMLFile
53 FILE *fp;
54 gchar *path;
56 GString *buf;
57 gchar *bufp;
59 gchar *dtd;
60 gchar *encoding;
61 gboolean need_codeconv;
63 GList *tag_stack;
64 guint level;
66 gboolean is_empty_element;
69 XMLFile *xml_open_file (const gchar *path);
70 void xml_close_file (XMLFile *file);
71 GNode *xml_parse_file (const gchar *path);
73 gint xml_get_dtd (XMLFile *file);
74 gint xml_parse_next_tag (XMLFile *file);
76 XMLTag *xml_get_current_tag (XMLFile *file);
77 GList *xml_get_current_tag_attr(XMLFile *file);
78 gchar *xml_get_element (XMLFile *file);
80 gboolean xml_compare_tag (XMLFile *file,
81 const gchar *name);
83 XMLNode *xml_node_new (XMLTag *tag,
84 const gchar *text);
86 XMLTag *xml_tag_new (const gchar *tag);
87 XMLAttr *xml_attr_new (const gchar *name,
88 const gchar *value);
89 XMLAttr *xml_attr_new_int (const gchar *name,
90 const gint value);
91 void xml_tag_add_attr (XMLTag *tag,
92 XMLAttr* attr);
95 gint xml_file_put_escape_str (FILE *fp,
96 const gchar *str);
98 gint xml_file_put_xml_decl (FILE *fp);
100 void xml_free_tree (GNode *node);
102 int xml_write_tree (GNode *node,
103 FILE *fp);
104 GNode *xml_copy_tree (GNode *node);
106 #endif /* __XML_H__ */