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