summaryrefslogtreecommitdiff
path: root/libsylph/xml.h
diff options
context:
space:
mode:
authorSimeon Simeonov2018-02-26 11:23:00 +0100
committerSimeon Simeonov2018-02-26 11:23:00 +0100
commit0b3cbf57875fd692e4ba0b336fefa4bee1ed00dc (patch)
treeaf916a30553c78ce9d4f2d8658656a175c5b6921 /libsylph/xml.h
Initial commit for sylpheed 3.7.0
Diffstat (limited to 'libsylph/xml.h')
-rw-r--r--libsylph/xml.h109
1 files changed, 109 insertions, 0 deletions
diff --git a/libsylph/xml.h b/libsylph/xml.h
new file mode 100644
index 0000000..766281b
--- /dev/null
+++ b/libsylph/xml.h
@@ -0,0 +1,109 @@
1/*
2 * LibSylph -- E-Mail client library
3 * Copyright (C) 1999-2005 Hiroyuki Yamamoto
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library 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 GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19
20#ifndef __XML_H__
21#define __XML_H__
22
23#include <glib.h>
24#include <stdio.h>
25
26#define XMLBUFSIZE 8192
27
28typedef struct _XMLAttr XMLAttr;
29typedef struct _XMLTag XMLTag;
30typedef struct _XMLNode XMLNode;
31typedef struct _XMLFile XMLFile;
32
33struct _XMLAttr
34{
35 gchar *name;
36 gchar *value;
37};
38
39struct _XMLTag
40{
41 gchar *tag;
42 GList *attr;
43};
44
45struct _XMLNode
46{
47 XMLTag *tag;
48 gchar *element;
49};
50
51struct _XMLFile
52{
53 FILE *fp;
54
55 GString *buf;
56 gchar *bufp;
57
58 gchar *dtd;
59 gchar *encoding;
60
61 GList *tag_stack;
62 guint level;
63
64 gboolean is_empty_element;
65};
66
67XMLFile *xml_open_file (const gchar *path);
68void xml_close_file (XMLFile *file);
69GNode *xml_parse_file (const gchar *path);
70
71gint xml_get_dtd (XMLFile *file);
72gint xml_parse_next_tag (XMLFile *file);
73void xml_push_tag (XMLFile *file,
74 XMLTag *tag);
75void xml_pop_tag (XMLFile *file);
76
77XMLTag *xml_get_current_tag (XMLFile *file);
78GList *xml_get_current_tag_attr(XMLFile *file);
79gchar *xml_get_element (XMLFile *file);
80
81gint xml_read_line (XMLFile *file);
82void xml_truncate_buf (XMLFile *file);
83gboolean xml_compare_tag (XMLFile *file,
84 const gchar *name);
85
86XMLNode *xml_node_new (XMLTag *tag,
87 const gchar *text);
88XMLTag *xml_tag_new (const gchar *tag);
89XMLAttr *xml_attr_new (const gchar *name,
90 const gchar *value);
91void xml_tag_add_attr (XMLTag *tag,
92 XMLAttr *attr);
93
94XMLTag *xml_copy_tag (XMLTag *tag);
95XMLAttr *xml_copy_attr (XMLAttr *attr);
96
97gint xml_unescape_str (gchar *str);
98gchar *xml_escape_str (const gchar *str);
99gint xml_file_put_escape_str (FILE *fp,
100 const gchar *str);
101
102gint xml_file_put_xml_decl (FILE *fp);
103gint xml_file_put_node (FILE *fp,
104 XMLNode *node);
105
106void xml_free_node (XMLNode *node);
107void xml_free_tree (GNode *node);
108
109#endif /* __XML_H__ */