7131
|
1 /**
|
|
2 * @file xmlnode.h XML DOM functions
|
|
3 *
|
|
4 * gaim
|
|
5 *
|
8046
|
6 * Gaim is the legal property of its developers, whose names are too numerous
|
|
7 * to list here. Please refer to the COPYRIGHT file distributed with this
|
|
8 * source distribution.
|
7131
|
9 *
|
|
10 * This program is free software; you can redistribute it and/or modify
|
|
11 * it under the terms of the GNU General Public License as published by
|
|
12 * the Free Software Foundation; either version 2 of the License, or
|
|
13 * (at your option) any later version.
|
|
14 *
|
|
15 * This program is distributed in the hope that it will be useful,
|
|
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
18 * GNU General Public License for more details.
|
|
19 *
|
|
20 * You should have received a copy of the GNU General Public License
|
|
21 * along with this program; if not, write to the Free Software
|
|
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
23 */
|
|
24 #ifndef _GAIM_XMLNODE_H_
|
|
25 #define _GAIM_XMLNODE_H_
|
|
26
|
|
27 typedef enum _NodeType
|
|
28 {
|
|
29 NODE_TYPE_TAG,
|
|
30 NODE_TYPE_ATTRIB,
|
|
31 NODE_TYPE_DATA
|
|
32 } NodeType;
|
|
33
|
|
34 typedef struct _xmlnode
|
|
35 {
|
|
36 char *name;
|
|
37 NodeType type;
|
|
38 char *data;
|
|
39 size_t data_sz;
|
|
40 struct _xmlnode *parent;
|
|
41 struct _xmlnode *child;
|
|
42 struct _xmlnode *next;
|
|
43 } xmlnode;
|
|
44
|
|
45 xmlnode *xmlnode_new(const char *name);
|
|
46 xmlnode *xmlnode_new_child(xmlnode *parent, const char *name);
|
|
47 void xmlnode_insert_child(xmlnode *parent, xmlnode *child);
|
|
48 xmlnode *xmlnode_get_child(xmlnode *parent, const char *name);
|
|
49 void xmlnode_insert_data(xmlnode *parent, const char *data, size_t size);
|
|
50 char *xmlnode_get_data(xmlnode *node);
|
|
51 void xmlnode_set_attrib(xmlnode *node, const char *attr, const char *value);
|
|
52 const char *xmlnode_get_attrib(xmlnode *node, const char *attr);
|
|
53 void xmlnode_remove_attrib(xmlnode *node, const char *attr);
|
7642
|
54 char *xmlnode_to_str(xmlnode *node, int *len);
|
7131
|
55 xmlnode *xmlnode_from_str(const char *str, size_t size);
|
|
56
|
|
57 void xmlnode_free(xmlnode *node);
|
|
58
|
|
59 #endif /* _GAIM_XMLNODE_H_ */
|