annotate src/xmlnode.h @ 12888:03f690fcb78e

[gaim-migrate @ 15241] Sadrul fixed bug #1406201 committer: Tailor Script <tailor@pidgin.im>
author Daniel Atallah <daniel.atallah@gmail.com>
date Sun, 15 Jan 2006 23:10:17 +0000
parents 4229503f1cd9
children 25e63008d3bb
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7131
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
1 /**
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
2 * @file xmlnode.h XML DOM functions
10327
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
3 * @ingroup core
7131
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
4 *
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
5 * gaim
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
6 *
8046
fa6395637e2c [gaim-migrate @ 8730]
Sean Egan <seanegan@gmail.com>
parents: 7642
diff changeset
7 * Gaim is the legal property of its developers, whose names are too numerous
fa6395637e2c [gaim-migrate @ 8730]
Sean Egan <seanegan@gmail.com>
parents: 7642
diff changeset
8 * to list here. Please refer to the COPYRIGHT file distributed with this
fa6395637e2c [gaim-migrate @ 8730]
Sean Egan <seanegan@gmail.com>
parents: 7642
diff changeset
9 * source distribution.
7131
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
10 *
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
11 * This program is free software; you can redistribute it and/or modify
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
12 * it under the terms of the GNU General Public License as published by
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
13 * the Free Software Foundation; either version 2 of the License, or
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
14 * (at your option) any later version.
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
15 *
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
16 * This program is distributed in the hope that it will be useful,
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
19 * GNU General Public License for more details.
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
20 *
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
21 * You should have received a copy of the GNU General Public License
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
22 * along with this program; if not, write to the Free Software
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
24 */
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
25 #ifndef _GAIM_XMLNODE_H_
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
26 #define _GAIM_XMLNODE_H_
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
27
10327
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
28 /**
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
29 * The valid types for an xmlnode
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
30 */
8135
8f4ce853e685 [gaim-migrate @ 8840]
Nathan Walp <nwalp@pidgin.im>
parents: 8046
diff changeset
31 typedef enum _XMLNodeType
7131
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
32 {
10327
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
33 XMLNODE_TYPE_TAG, /**< Just a tag */
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
34 XMLNODE_TYPE_ATTRIB, /**< Has attributes */
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
35 XMLNODE_TYPE_DATA /**< Has data */
8135
8f4ce853e685 [gaim-migrate @ 8840]
Nathan Walp <nwalp@pidgin.im>
parents: 8046
diff changeset
36 } XMLNodeType;
7131
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
37
10327
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
38 /**
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
39 * An xmlnode.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
40 */
7131
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
41 typedef struct _xmlnode
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
42 {
10327
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
43 char *name; /**< The name of the node. */
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
44 XMLNodeType type; /**< The type of the node. */
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
45 char *data; /**< The data for the node. */
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
46 size_t data_sz; /**< The size of the data. */
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
47 struct _xmlnode *parent; /**< The parent node or @c NULL.*/
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
48 struct _xmlnode *child; /**< The child node or @c NULL.*/
12233
02833a0ae716 [gaim-migrate @ 14535]
Richard Laager <rlaager@wiktel.com>
parents: 11707
diff changeset
49 struct _xmlnode *lastchild; /**< The last child node or @c NULL.*/
10327
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
50 struct _xmlnode *next; /**< The next node or @c NULL. */
7131
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
51 } xmlnode;
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
52
10327
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
53 /**
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
54 * Creates a new xmlnode.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
55 *
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
56 * @param name The name of the node.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
57 *
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
58 * @return The new node.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
59 */
7131
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
60 xmlnode *xmlnode_new(const char *name);
10327
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
61
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
62 /**
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
63 * Creates a new xmlnode child.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
64 *
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
65 * @param parent The parent node.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
66 * @param name The name of the child node.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
67 *
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
68 * @return The new child node.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
69 */
7131
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
70 xmlnode *xmlnode_new_child(xmlnode *parent, const char *name);
10327
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
71
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
72 /**
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
73 * Inserts a node into a node as a child.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
74 *
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
75 * @param parent The parent node to insert child into.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
76 * @param child The child node to insert into parent.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
77 */
7131
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
78 void xmlnode_insert_child(xmlnode *parent, xmlnode *child);
10327
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
79
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
80 /**
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
81 * Gets a child node named name.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
82 *
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
83 * @param parent The parent node.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
84 * @param name The child's name.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
85 *
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
86 * @return The child or NULL.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
87 */
10736
703f722d076f [gaim-migrate @ 12338]
Mark Doliner <mark@kingant.net>
parents: 10425
diff changeset
88 xmlnode *xmlnode_get_child(const xmlnode *parent, const char *name);
10327
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
89
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
90 /**
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
91 * Gets a child node named name in a namespace.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
92 *
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
93 * @param parent The parent node.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
94 * @param name The child's name.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
95 * @param xmlns The namespace.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
96 *
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
97 * @return The child or NULL.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
98 */
10736
703f722d076f [gaim-migrate @ 12338]
Mark Doliner <mark@kingant.net>
parents: 10425
diff changeset
99 xmlnode *xmlnode_get_child_with_namespace(const xmlnode *parent, const char *name, const char *xmlns);
10327
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
100
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
101 /**
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
102 * Gets the next node with the same name as node.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
103 *
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
104 * @param node The node of a twin to find.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
105 *
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
106 * @return The twin of node or NULL.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
107 */
8135
8f4ce853e685 [gaim-migrate @ 8840]
Nathan Walp <nwalp@pidgin.im>
parents: 8046
diff changeset
108 xmlnode *xmlnode_get_next_twin(xmlnode *node);
10327
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
109
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
110 /**
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
111 * Inserts data into a node.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
112 *
10415
5b7a74d397cc [gaim-migrate @ 11665]
Mark Doliner <mark@kingant.net>
parents: 10337
diff changeset
113 * @param node The node to insert data into.
10327
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
114 * @param data The data to insert.
10415
5b7a74d397cc [gaim-migrate @ 11665]
Mark Doliner <mark@kingant.net>
parents: 10337
diff changeset
115 * @param size The size of the data to insert. If data is
5b7a74d397cc [gaim-migrate @ 11665]
Mark Doliner <mark@kingant.net>
parents: 10337
diff changeset
116 * null-terminated you can pass in -1.
10327
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
117 */
10848
98de05966d6d [gaim-migrate @ 12520]
Nathan Walp <nwalp@pidgin.im>
parents: 10736
diff changeset
118 void xmlnode_insert_data(xmlnode *node, const char *data, gssize size);
10327
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
119
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
120 /**
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
121 * Gets data from a node.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
122 *
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
123 * @param node The node to get data from.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
124 *
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
125 * @return The data from the node.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
126 */
7131
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
127 char *xmlnode_get_data(xmlnode *node);
10327
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
128
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
129 /**
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
130 * Sets an attribute for a node.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
131 *
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
132 * @param node The node to set an attribute for.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
133 * @param attr The name of the attribute.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
134 * @param value The value of the attribute.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
135 */
7131
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
136 void xmlnode_set_attrib(xmlnode *node, const char *attr, const char *value);
10327
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
137
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
138 /**
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
139 * Gets an attribute from a node.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
140 *
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
141 * @param node The node to get an attribute from.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
142 * @param attr The attribute to get.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
143 *
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
144 * @return The value of the attribute.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
145 */
7131
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
146 const char *xmlnode_get_attrib(xmlnode *node, const char *attr);
10327
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
147
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
148 /**
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
149 * Removes an attribute from a node.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
150 *
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
151 * @param node The node to remove an attribute from.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
152 * @param attr The attribute to remove.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
153 */
7131
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
154 void xmlnode_remove_attrib(xmlnode *node, const char *attr);
10327
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
155
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
156 /**
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
157 * Returns the node in a string of xml.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
158 *
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
159 * @param node The starting node to output.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
160 * @param len Address for the size of the string.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
161 *
12887
4229503f1cd9 [gaim-migrate @ 15240]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12233
diff changeset
162 * @return The node represented as a string. You must
10415
5b7a74d397cc [gaim-migrate @ 11665]
Mark Doliner <mark@kingant.net>
parents: 10337
diff changeset
163 * g_free this string when finished using it.
10327
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
164 */
10425
9903182f2aac [gaim-migrate @ 11677]
Mark Doliner <mark@kingant.net>
parents: 10424
diff changeset
165 char *xmlnode_to_str(xmlnode *node, int *len);
10327
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
166
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
167 /**
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
168 * Returns the node in a string of human readable xml.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
169 *
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
170 * @param node The starting node to output.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
171 * @param len Address for the size of the string.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
172 *
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
173 * @return The node as human readable string including
10415
5b7a74d397cc [gaim-migrate @ 11665]
Mark Doliner <mark@kingant.net>
parents: 10337
diff changeset
174 * tab and new line characters. You must
5b7a74d397cc [gaim-migrate @ 11665]
Mark Doliner <mark@kingant.net>
parents: 10337
diff changeset
175 * g_free this string when finished using it.
10327
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
176 */
10425
9903182f2aac [gaim-migrate @ 11677]
Mark Doliner <mark@kingant.net>
parents: 10424
diff changeset
177 char *xmlnode_to_formatted_str(xmlnode *node, int *len);
10327
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
178
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
179 /**
10337
682201b69107 [gaim-migrate @ 11545]
Mark Doliner <mark@kingant.net>
parents: 10327
diff changeset
180 * Creates a node from a string of XML. Calling this on the
682201b69107 [gaim-migrate @ 11545]
Mark Doliner <mark@kingant.net>
parents: 10327
diff changeset
181 * root node of an XML document will parse the entire document
682201b69107 [gaim-migrate @ 11545]
Mark Doliner <mark@kingant.net>
parents: 10327
diff changeset
182 * into a tree of nodes, and return the xmlnode of the root.
10327
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
183 *
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
184 * @param str The string of xml.
11707
b7af9100af6c [gaim-migrate @ 13998]
Richard Laager <rlaager@wiktel.com>
parents: 10848
diff changeset
185 * @param size The size of the string, or -1 if @a str is
b7af9100af6c [gaim-migrate @ 13998]
Richard Laager <rlaager@wiktel.com>
parents: 10848
diff changeset
186 * NUL-terminated.
10327
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
187 *
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
188 * @return The new node.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
189 */
10848
98de05966d6d [gaim-migrate @ 12520]
Nathan Walp <nwalp@pidgin.im>
parents: 10736
diff changeset
190 xmlnode *xmlnode_from_str(const char *str, gssize size);
10327
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
191
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
192 /**
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
193 * Creates a new node from the source node.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
194 *
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
195 * @param src The node to copy.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
196 *
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
197 * @return A new copy of the src node.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
198 */
8167
b55b70aef314 [gaim-migrate @ 8880]
Nathan Walp <nwalp@pidgin.im>
parents: 8135
diff changeset
199 xmlnode *xmlnode_copy(xmlnode *src);
7131
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
200
10327
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
201 /**
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
202 * Frees a node and all of it's children.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
203 *
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
204 * @param node The node to free.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
205 */
7131
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
206 void xmlnode_free(xmlnode *node);
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
207
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
208 #endif /* _GAIM_XMLNODE_H_ */