pidgin: xmlnode.h Source File

pidgin 2.14.4

Loading...
Searching...
No Matches
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
32extern "C" {
33#endif
34
38 typedef enum _XMLNodeType
39{
40 XMLNODE_TYPE_TAG,
41 XMLNODE_TYPE_ATTRIB,
42 XMLNODE_TYPE_DATA
43} XMLNodeType;
44
48 typedef struct _xmlnode xmlnode;
49 struct _xmlnode
50{
51 char *name;
52 char *xmlns;
53 XMLNodeType type;
54 char *data;
55 size_t data_sz;
56 xmlnode *parent;
57 xmlnode *child;
58 xmlnode *lastchild;
59 xmlnode *next;
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
119 xmlnode *xmlnode_get_next_twin(xmlnode *node);
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_)
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_ */
_xmlnode
Definition: xmlnode.h:50
_xmlnode::parent
xmlnode * parent
The parent node or NULL.
Definition: xmlnode.h:56
_xmlnode::child
xmlnode * child
The child node or NULL.
Definition: xmlnode.h:57
_xmlnode::lastchild
xmlnode * lastchild
The last child node or NULL.
Definition: xmlnode.h:58
_xmlnode::next
xmlnode * next
The next node or NULL.
Definition: xmlnode.h:59
_xmlnode::type
XMLNodeType type
The type of the node.
Definition: xmlnode.h:53
_xmlnode::data_sz
size_t data_sz
The size of the data.
Definition: xmlnode.h:55
_xmlnode::xmlns
char * xmlns
The namespace of the node.
Definition: xmlnode.h:52
_xmlnode::name
char * name
The name of the node.
Definition: xmlnode.h:51
_xmlnode::data
char * data
The data for the node.
Definition: xmlnode.h:54
_xmlnode::namespace_map
GHashTable * namespace_map
The namespace map.
Definition: xmlnode.h:61
_xmlnode::prefix
char * prefix
The namespace prefix if any.
Definition: xmlnode.h:60
xmlnode_get_attrib
const char * xmlnode_get_attrib(const xmlnode *node, const char *attr)
Gets an attribute from a node.
xmlnode_from_file
xmlnode * xmlnode_from_file(const char *dir, const char *filename, const char *description, const char *process)
Creates a node from a XML File.
xmlnode_get_child
xmlnode * xmlnode_get_child(const xmlnode *parent, const char *name)
Gets a child node named name.
xmlnode_get_data_unescaped
char * xmlnode_get_data_unescaped(const xmlnode *node)
Gets unescaped data from a node.
xmlnode_get_prefix
const char * xmlnode_get_prefix(const xmlnode *node)
Returns the prefix of a node.
xmlnode_insert_child
void xmlnode_insert_child(xmlnode *parent, xmlnode *child)
Inserts a node into a node as a child.
xmlnode_set_attrib_with_prefix
void xmlnode_set_attrib_with_prefix(xmlnode *node, const char *attr, const char *prefix, const char *value)
Sets a prefixed attribute for a node.
xmlnode_get_parent
xmlnode * xmlnode_get_parent(const xmlnode *child)
Gets the parent node.
xmlnode_set_attrib_with_namespace
void xmlnode_set_attrib_with_namespace(xmlnode *node, const char *attr, const char *xmlns, const char *value)
Sets a namespaced attribute for a node.
xmlnode_set_prefix
void xmlnode_set_prefix(xmlnode *node, const char *prefix)
Sets the prefix of a node.
xmlnode_get_data
char * xmlnode_get_data(const xmlnode *node)
Gets (escaped) data from a node.
xmlnode_from_str
xmlnode * xmlnode_from_str(const char *str, gssize size)
Creates a node from a string of XML.
xmlnode_new
xmlnode * xmlnode_new(const char *name)
Creates a new xmlnode.
xmlnode_get_next_twin
xmlnode * xmlnode_get_next_twin(xmlnode *node)
Gets the next node with the same name as node.
xmlnode_insert_data
void xmlnode_insert_data(xmlnode *node, const char *data, gssize size)
Inserts data into a node.
xmlnode_new_child
xmlnode * xmlnode_new_child(xmlnode *parent, const char *name)
Creates a new xmlnode child.
xmlnode_set_namespace
void xmlnode_set_namespace(xmlnode *node, const char *xmlns)
Sets the namespace of a node.
_XMLNodeType
_XMLNodeType
The valid types for an xmlnode.
Definition: xmlnode.h:39
XMLNODE_TYPE_ATTRIB
@ XMLNODE_TYPE_ATTRIB
Has attributes.
Definition: xmlnode.h:41
XMLNODE_TYPE_DATA
@ XMLNODE_TYPE_DATA
Has data.
Definition: xmlnode.h:42
XMLNODE_TYPE_TAG
@ XMLNODE_TYPE_TAG
Just a tag.
Definition: xmlnode.h:40
xmlnode_remove_attrib
void xmlnode_remove_attrib(xmlnode *node, const char *attr)
Removes an attribute from a node.
xmlnode_copy
xmlnode * xmlnode_copy(const xmlnode *src)
Creates a new node from the source node.
xmlnode_free
void xmlnode_free(xmlnode *node)
Frees a node and all of its children.
xmlnode_to_formatted_str
char * xmlnode_to_formatted_str(const xmlnode *node, int *len)
Returns the node in a string of human readable xml.
xmlnode_remove_attrib_with_namespace
void xmlnode_remove_attrib_with_namespace(xmlnode *node, const char *attr, const char *xmlns)
Removes a namespaced attribute from a node.
xmlnode_set_attrib_full
void xmlnode_set_attrib_full(xmlnode *node, const char *attr, const char *xmlns, const char *prefix, const char *value)
Sets a namespaced attribute for a node.
xmlnode_get_namespace
const char * xmlnode_get_namespace(xmlnode *node)
Returns the namespace of a node.
xmlnode_set_attrib
void xmlnode_set_attrib(xmlnode *node, const char *attr, const char *value)
Sets an attribute for a node.
xmlnode_get_child_with_namespace
xmlnode * xmlnode_get_child_with_namespace(const xmlnode *parent, const char *name, const char *xmlns)
Gets a child node named name in a namespace.
xmlnode_get_attrib_with_namespace
const char * xmlnode_get_attrib_with_namespace(const xmlnode *node, const char *attr, const char *xmlns)
Gets a namespaced attribute from a node.
xmlnode_to_str
char * xmlnode_to_str(const xmlnode *node, int *len)
Returns the node in a string of xml.
XMLNodeType
enum _XMLNodeType XMLNodeType
The valid types for an xmlnode.