1 /* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*-
3 obt/xml.h for the Openbox window manager
4 Copyright (c) 2003-2007 Dana Jansens
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 See the COPYING file for a copy of the GNU General Public License.
22 #include <libxml/parser.h>
27 typedef struct _ObtXmlInst ObtXmlInst
;
29 typedef void (*ObtXmlCallback
)(xmlNodePtr node
, gpointer data
);
31 ObtXmlInst
* obt_xml_instance_new(void);
32 void obt_xml_instance_ref(ObtXmlInst
*inst
);
33 void obt_xml_instance_unref(ObtXmlInst
*inst
);
35 gboolean
obt_xml_load_file(ObtXmlInst
*inst
,
37 const gchar
*root_node
);
38 gboolean
obt_xml_load_config_file(ObtXmlInst
*inst
,
40 const gchar
*filename
,
41 const gchar
*root_node
);
42 gboolean
obt_xml_load_data_file(ObtXmlInst
*inst
,
44 const gchar
*filename
,
45 const gchar
*root_node
);
46 gboolean
obt_xml_load_theme_file(ObtXmlInst
*inst
,
49 const gchar
*filename
,
50 const gchar
*root_node
);
51 gboolean
obt_xml_load_mem(ObtXmlInst
*inst
,
52 gpointer data
, guint len
, const gchar
*root_node
);
54 /* Returns true if an error is present. */
55 gboolean
obt_xml_last_error(ObtXmlInst
*inst
);
56 gchar
* obt_xml_last_error_file(ObtXmlInst
*inst
);
57 gint
obt_xml_last_error_line(ObtXmlInst
*inst
);
58 gchar
* obt_xml_last_error_message(ObtXmlInst
*inst
);
60 gboolean
obt_xml_save_file(ObtXmlInst
*inst
,
64 xmlDocPtr
obt_xml_doc(ObtXmlInst
*inst
);
65 xmlNodePtr
obt_xml_root(ObtXmlInst
*inst
);
67 void obt_xml_close(ObtXmlInst
*inst
);
69 void obt_xml_register(ObtXmlInst
*inst
, const gchar
*tag
,
70 ObtXmlCallback func
, gpointer data
);
71 void obt_xml_unregister(ObtXmlInst
*inst
, const gchar
*tag
);
72 void obt_xml_tree(ObtXmlInst
*i
, xmlNodePtr node
);
73 void obt_xml_tree_from_root(ObtXmlInst
*i
);
78 xmlNodePtr
obt_xml_find_node (xmlNodePtr node
, const gchar
*name
);
80 gboolean
obt_xml_node_contains (xmlNodePtr node
, const gchar
*val
);
81 gchar
*obt_xml_node_string_unstripped(xmlNodePtr node
);
82 gchar
*obt_xml_node_string (xmlNodePtr node
);
83 gint
obt_xml_node_int (xmlNodePtr node
);
84 gboolean
obt_xml_node_bool (xmlNodePtr node
);
86 gboolean
obt_xml_attr_contains (xmlNodePtr node
, const gchar
*name
,
88 gboolean
obt_xml_attr_string_unstripped(xmlNodePtr node
, const gchar
*name
,
90 gboolean
obt_xml_attr_string (xmlNodePtr node
, const gchar
*name
,
92 gboolean
obt_xml_attr_int (xmlNodePtr node
, const gchar
*name
,
94 gboolean
obt_xml_attr_bool (xmlNodePtr node
, const gchar
*name
,