xmlnode.h
Go to the documentation of this file.
1 
6 /* purple
7  *
8  * Purple is the legal property of its developers, whose names are too numerous
9  * to list here. Please refer to the COPYRIGHT file distributed with this
10  * source distribution.
11  *
12  * This program is free software; you can redistribute it and/or modify
13  * it under the terms of the GNU General Public License as published by
14  * the Free Software Foundation; either version 2 of the License, or
15  * (at your option) any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public License
23  * along with this program; if not, write to the Free Software
24  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
25  */
26 #ifndef _PURPLE_XMLNODE_H_
27 #define _PURPLE_XMLNODE_H_
28 
29 #include <glib.h>
30 
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34 
38 typedef enum _XMLNodeType
39 {
43 } XMLNodeType;
44 
48 typedef struct _xmlnode xmlnode;
49 struct _xmlnode
50 {
51  char *name;
52  char *xmlns;
54  char *data;
55  size_t data_sz;
60  char *prefix;
61  GHashTable *namespace_map;
62 };
63 
71 xmlnode *xmlnode_new(const char *name);
72 
81 xmlnode *xmlnode_new_child(xmlnode *parent, const char *name);
82 
89 void xmlnode_insert_child(xmlnode *parent, xmlnode *child);
90 
99 xmlnode *xmlnode_get_child(const xmlnode *parent, const char *name);
100 
110 xmlnode *xmlnode_get_child_with_namespace(const xmlnode *parent, const char *name, const char *xmlns);
111 
120 
129 void xmlnode_insert_data(xmlnode *node, const char *data, gssize size);
130 
139 char *xmlnode_get_data(const xmlnode *node);
140 
149 char *xmlnode_get_data_unescaped(const xmlnode *node);
150 
158 void xmlnode_set_attrib(xmlnode *node, const char *attr, const char *value);
159 
160 #if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_XMLNODE_C_)
161 
171 void xmlnode_set_attrib_with_prefix(xmlnode *node, const char *attr, const char *prefix, const char *value);
172 
183 void xmlnode_set_attrib_with_namespace(xmlnode *node, const char *attr, const char *xmlns, const char *value);
184 #endif /* PURPLE_DISABLE_DEPRECATED */
185 
197 void xmlnode_set_attrib_full(xmlnode *node, const char *attr, const char *xmlns,
198  const char *prefix, const char *value);
199 
208 const char *xmlnode_get_attrib(const xmlnode *node, const char *attr);
209 
219 const char *xmlnode_get_attrib_with_namespace(const xmlnode *node, const char *attr, const char *xmlns);
220 
227 void xmlnode_remove_attrib(xmlnode *node, const char *attr);
228 
236 void xmlnode_remove_attrib_with_namespace(xmlnode *node, const char *attr, const char *xmlns);
237 
244 void xmlnode_set_namespace(xmlnode *node, const char *xmlns);
245 
252 const char *xmlnode_get_namespace(xmlnode *node);
253 
260 void xmlnode_set_prefix(xmlnode *node, const char *prefix);
261 
268 const char *xmlnode_get_prefix(const xmlnode *node);
269 
279 xmlnode *xmlnode_get_parent(const xmlnode *child);
280 
290 char *xmlnode_to_str(const xmlnode *node, int *len);
291 
302 char *xmlnode_to_formatted_str(const xmlnode *node, int *len);
303 
315 xmlnode *xmlnode_from_str(const char *str, gssize size);
316 
324 xmlnode *xmlnode_copy(const xmlnode *src);
325 
331 void xmlnode_free(xmlnode *node);
332 
349 xmlnode *xmlnode_from_file(const char *dir, const char *filename,
350  const char *description, const char *process);
351 
352 #ifdef __cplusplus
353 }
354 #endif
355 
356 #endif /* _PURPLE_XMLNODE_H_ */