0cf759dbea
* src/action.c * src/addrbook.c * src/addrindex.c * src/compose.c * src/exporthtml.c * src/exportldif.c * src/folder.c * src/main.c * src/matcher.c * src/mbox.c * src/messageview.c * src/mh.c * src/news.c * src/partial_download.c * src/pop.c * src/procmime.c * src/procmsg.c * src/toolbar.c * src/common/log.c * src/common/mgutils.c * src/common/plugin.c * src/common/utils.c * src/common/xml.c * src/common/xml.h * src/common/xmlprops.c * src/common/xmlprops.h * src/plugins/bogofilter/bogofilter.c * src/plugins/clamav/clamav_plugin.c * src/plugins/dillo_viewer/dillo_prefs.c * src/plugins/pgpcore/prefs_gpg.c * src/plugins/pgpinline/pgpinline.c * src/plugins/pgpmime/pgpmime.c * src/plugins/spamassassin/spamassassin.c * src/plugins/trayicon/trayicon_prefs.c Verify success on writes. Will fix possible strange failure on disk full.
115 lines
2.6 KiB
C
115 lines
2.6 KiB
C
/*
|
|
* Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
|
|
* Copyright (C) 1999-2007 Hiroyuki Yamamoto and the Claws Mail team
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation; either version 3 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*
|
|
*/
|
|
|
|
#ifndef __XML_H__
|
|
#define __XML_H__
|
|
|
|
#include <glib.h>
|
|
#include <stdio.h>
|
|
|
|
#define XMLBUFSIZE 8192
|
|
|
|
typedef struct _XMLAttr XMLAttr;
|
|
typedef struct _XMLTag XMLTag;
|
|
typedef struct _XMLNode XMLNode;
|
|
typedef struct _XMLFile XMLFile;
|
|
|
|
struct _XMLAttr
|
|
{
|
|
gchar *name;
|
|
gchar *value;
|
|
};
|
|
|
|
struct _XMLTag
|
|
{
|
|
gchar *tag;
|
|
GList *attr;
|
|
};
|
|
|
|
struct _XMLNode
|
|
{
|
|
XMLTag *tag;
|
|
gchar *element;
|
|
};
|
|
|
|
struct _XMLFile
|
|
{
|
|
FILE *fp;
|
|
|
|
GString *buf;
|
|
gchar *bufp;
|
|
|
|
gchar *dtd;
|
|
gchar *encoding;
|
|
gboolean need_codeconv;
|
|
|
|
GList *tag_stack;
|
|
guint level;
|
|
|
|
gboolean is_empty_element;
|
|
};
|
|
|
|
XMLFile *xml_open_file (const gchar *path);
|
|
void xml_close_file (XMLFile *file);
|
|
GNode *xml_parse_file (const gchar *path);
|
|
|
|
gint xml_get_dtd (XMLFile *file);
|
|
gint xml_parse_next_tag (XMLFile *file);
|
|
void xml_push_tag (XMLFile *file,
|
|
XMLTag *tag);
|
|
void xml_pop_tag (XMLFile *file);
|
|
|
|
XMLTag *xml_get_current_tag (XMLFile *file);
|
|
GList *xml_get_current_tag_attr(XMLFile *file);
|
|
gchar *xml_get_element (XMLFile *file);
|
|
|
|
gint xml_read_line (XMLFile *file);
|
|
void xml_truncate_buf (XMLFile *file);
|
|
gboolean xml_compare_tag (XMLFile *file,
|
|
const gchar *name);
|
|
|
|
XMLNode *xml_node_new (XMLTag *tag,
|
|
const gchar *text);
|
|
|
|
XMLTag *xml_tag_new (const gchar *tag);
|
|
XMLAttr *xml_attr_new (const gchar *name,
|
|
const gchar *value);
|
|
XMLAttr *xml_attr_new_int (const gchar *name,
|
|
const gint value);
|
|
void xml_tag_add_attr (XMLTag *tag,
|
|
XMLAttr* attr);
|
|
|
|
XMLTag *xml_copy_tag (XMLTag *tag);
|
|
XMLAttr *xml_copy_attr (XMLAttr *attr);
|
|
|
|
gint xml_unescape_str (gchar *str);
|
|
gint xml_file_put_escape_str (FILE *fp,
|
|
const gchar *str);
|
|
|
|
gint xml_file_put_xml_decl (FILE *fp);
|
|
|
|
void xml_free_node (XMLNode *node);
|
|
void xml_free_tree (GNode *node);
|
|
|
|
void xml_free_tag (XMLTag *tag);
|
|
int xml_write_tree (GNode *node,
|
|
FILE *fp);
|
|
GNode *xml_copy_tree (GNode *node);
|
|
|
|
#endif /* __XML_H__ */
|