Sat, 22 Aug 2009 23:36:31 +0000
Wrap this file more consistently.
| 7131 | 1 | /** |
| 2 | * @file xmlnode.h XML DOM functions | |
| 10327 | 3 | * @ingroup core |
|
20147
66f05a854eee
applied changes from 8a731bbd0197fbcc91a705c2d8f528154216defa
Richard Laager <rlaager@pidgin.im>
parents:
19897
diff
changeset
|
4 | */ |
|
66f05a854eee
applied changes from 8a731bbd0197fbcc91a705c2d8f528154216defa
Richard Laager <rlaager@pidgin.im>
parents:
19897
diff
changeset
|
5 | |
|
66f05a854eee
applied changes from 8a731bbd0197fbcc91a705c2d8f528154216defa
Richard Laager <rlaager@pidgin.im>
parents:
19897
diff
changeset
|
6 | /* purple |
| 7131 | 7 | * |
| 15884 | 8 | * Purple is the legal property of its developers, whose names are too numerous |
| 8046 | 9 | * to list here. Please refer to the COPYRIGHT file distributed with this |
| 10 | * source distribution. | |
| 7131 | 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 | |
|
19859
71d37b57eff2
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
18131
diff
changeset
|
24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
| 7131 | 25 | */ |
| 15884 | 26 | #ifndef _PURPLE_XMLNODE_H_ |
| 27 | #define _PURPLE_XMLNODE_H_ | |
| 7131 | 28 | |
|
23659
8251d0f67df5
restructured much of the loader and themes for the buddy list, along with a basic trial of group background
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23643
diff
changeset
|
29 | #include <glib.h> |
|
8251d0f67df5
restructured much of the loader and themes for the buddy list, along with a basic trial of group background
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23643
diff
changeset
|
30 | |
|
14988
66b34458d49e
[gaim-migrate @ 17698]
Richard Laager <rlaager@pidgin.im>
parents:
14498
diff
changeset
|
31 | #ifdef __cplusplus |
|
66b34458d49e
[gaim-migrate @ 17698]
Richard Laager <rlaager@pidgin.im>
parents:
14498
diff
changeset
|
32 | extern "C" { |
|
66b34458d49e
[gaim-migrate @ 17698]
Richard Laager <rlaager@pidgin.im>
parents:
14498
diff
changeset
|
33 | #endif |
|
66b34458d49e
[gaim-migrate @ 17698]
Richard Laager <rlaager@pidgin.im>
parents:
14498
diff
changeset
|
34 | |
| 10327 | 35 | /** |
| 36 | * The valid types for an xmlnode | |
| 37 | */ | |
| 8135 | 38 | typedef enum _XMLNodeType |
| 7131 | 39 | { |
| 10327 | 40 | XMLNODE_TYPE_TAG, /**< Just a tag */ |
|
14162
3546040af8e2
[gaim-migrate @ 16730]
Daniel Atallah <datallah@pidgin.im>
parents:
13808
diff
changeset
|
41 | XMLNODE_TYPE_ATTRIB, /**< Has attributes */ |
| 10327 | 42 | XMLNODE_TYPE_DATA /**< Has data */ |
| 8135 | 43 | } XMLNodeType; |
| 7131 | 44 | |
| 10327 | 45 | /** |
| 46 | * An xmlnode. | |
| 47 | */ | |
| 14386 | 48 | typedef struct _xmlnode xmlnode; |
| 49 | struct _xmlnode | |
| 7131 | 50 | { |
|
14162
3546040af8e2
[gaim-migrate @ 16730]
Daniel Atallah <datallah@pidgin.im>
parents:
13808
diff
changeset
|
51 | char *name; /**< The name of the node. */ |
|
15238
e52522b871ee
[gaim-migrate @ 17963]
Mark Doliner <markdoliner@pidgin.im>
parents:
14988
diff
changeset
|
52 | char *xmlns; /**< The namespace of the node */ |
|
14162
3546040af8e2
[gaim-migrate @ 16730]
Daniel Atallah <datallah@pidgin.im>
parents:
13808
diff
changeset
|
53 | XMLNodeType type; /**< The type of the node. */ |
|
3546040af8e2
[gaim-migrate @ 16730]
Daniel Atallah <datallah@pidgin.im>
parents:
13808
diff
changeset
|
54 | char *data; /**< The data for the node. */ |
|
3546040af8e2
[gaim-migrate @ 16730]
Daniel Atallah <datallah@pidgin.im>
parents:
13808
diff
changeset
|
55 | size_t data_sz; /**< The size of the data. */ |
|
28092
96050b11724c
We can use the typedef here, right?
Mark Doliner <markdoliner@pidgin.im>
parents:
27345
diff
changeset
|
56 | xmlnode *parent; /**< The parent node or @c NULL.*/ |
|
96050b11724c
We can use the typedef here, right?
Mark Doliner <markdoliner@pidgin.im>
parents:
27345
diff
changeset
|
57 | xmlnode *child; /**< The child node or @c NULL.*/ |
|
96050b11724c
We can use the typedef here, right?
Mark Doliner <markdoliner@pidgin.im>
parents:
27345
diff
changeset
|
58 | xmlnode *lastchild; /**< The last child node or @c NULL.*/ |
|
96050b11724c
We can use the typedef here, right?
Mark Doliner <markdoliner@pidgin.im>
parents:
27345
diff
changeset
|
59 | xmlnode *next; /**< The next node or @c NULL. */ |
|
21454
2ca06ee152ac
make our xmlnode preserve prefixes
Ka-Hing Cheung <khc@pidgin.im>
parents:
20603
diff
changeset
|
60 | char *prefix; /**< The namespace prefix if any. */ |
|
2ca06ee152ac
make our xmlnode preserve prefixes
Ka-Hing Cheung <khc@pidgin.im>
parents:
20603
diff
changeset
|
61 | GHashTable *namespace_map; /**< The namespace map. */ |
| 14386 | 62 | }; |
| 7131 | 63 | |
| 10327 | 64 | /** |
| 65 | * Creates a new xmlnode. | |
| 66 | * | |
| 67 | * @param name The name of the node. | |
| 68 | * | |
| 69 | * @return The new node. | |
| 70 | */ | |
| 7131 | 71 | xmlnode *xmlnode_new(const char *name); |
| 10327 | 72 | |
| 73 | /** | |
| 74 | * Creates a new xmlnode child. | |
| 75 | * | |
| 76 | * @param parent The parent node. | |
| 77 | * @param name The name of the child node. | |
| 78 | * | |
| 79 | * @return The new child node. | |
| 80 | */ | |
| 7131 | 81 | xmlnode *xmlnode_new_child(xmlnode *parent, const char *name); |
| 10327 | 82 | |
| 83 | /** | |
| 84 | * Inserts a node into a node as a child. | |
| 85 | * | |
| 86 | * @param parent The parent node to insert child into. | |
| 87 | * @param child The child node to insert into parent. | |
| 88 | */ | |
| 7131 | 89 | void xmlnode_insert_child(xmlnode *parent, xmlnode *child); |
| 10327 | 90 | |
| 91 | /** | |
| 92 | * Gets a child node named name. | |
| 93 | * | |
| 94 | * @param parent The parent node. | |
| 95 | * @param name The child's name. | |
| 96 | * | |
| 97 | * @return The child or NULL. | |
| 98 | */ | |
|
10736
fb529f29c25c
[gaim-migrate @ 12338]
Mark Doliner <markdoliner@pidgin.im>
parents:
10425
diff
changeset
|
99 | xmlnode *xmlnode_get_child(const xmlnode *parent, const char *name); |
| 10327 | 100 | |
| 101 | /** | |
| 102 | * Gets a child node named name in a namespace. | |
| 103 | * | |
| 104 | * @param parent The parent node. | |
| 105 | * @param name The child's name. | |
| 106 | * @param xmlns The namespace. | |
| 107 | * | |
| 108 | * @return The child or NULL. | |
| 109 | */ | |
|
10736
fb529f29c25c
[gaim-migrate @ 12338]
Mark Doliner <markdoliner@pidgin.im>
parents:
10425
diff
changeset
|
110 | xmlnode *xmlnode_get_child_with_namespace(const xmlnode *parent, const char *name, const char *xmlns); |
| 10327 | 111 | |
| 112 | /** | |
| 113 | * Gets the next node with the same name as node. | |
| 114 | * | |
| 115 | * @param node The node of a twin to find. | |
| 116 | * | |
| 117 | * @return The twin of node or NULL. | |
| 118 | */ | |
| 8135 | 119 | xmlnode *xmlnode_get_next_twin(xmlnode *node); |
| 10327 | 120 | |
| 121 | /** | |
| 122 | * Inserts data into a node. | |
| 123 | * | |
|
10415
faceb835eb87
[gaim-migrate @ 11665]
Mark Doliner <markdoliner@pidgin.im>
parents:
10337
diff
changeset
|
124 | * @param node The node to insert data into. |
| 10327 | 125 | * @param data The data to insert. |
|
10415
faceb835eb87
[gaim-migrate @ 11665]
Mark Doliner <markdoliner@pidgin.im>
parents:
10337
diff
changeset
|
126 | * @param size The size of the data to insert. If data is |
|
faceb835eb87
[gaim-migrate @ 11665]
Mark Doliner <markdoliner@pidgin.im>
parents:
10337
diff
changeset
|
127 | * null-terminated you can pass in -1. |
| 10327 | 128 | */ |
| 10848 | 129 | void xmlnode_insert_data(xmlnode *node, const char *data, gssize size); |
| 10327 | 130 | |
| 131 | /** | |
|
18131
7127441da3ba
add xmlnode_get_data_unescaped(), and got rid of an unecessary realloc
Nathan Walp <nwalp@pidgin.im>
parents:
15884
diff
changeset
|
132 | * Gets (escaped) data from a node. |
| 10327 | 133 | * |
| 134 | * @param node The node to get data from. | |
| 135 | * | |
|
20546
35d778ab0450
Correctly process an additional <Service> with type Profile and name 'Messenger Roaming Identity' sent with the contact list using a recently registered WLM account, that was causing the initial ADL command to be sent malformed, and our presence status not being forwarded to our buddies
Carlos Silva <typ0@pidgin.im>
parents:
18131
diff
changeset
|
136 | * @return The data from the node or NULL. This data is in raw escaped format. |
|
18131
7127441da3ba
add xmlnode_get_data_unescaped(), and got rid of an unecessary realloc
Nathan Walp <nwalp@pidgin.im>
parents:
15884
diff
changeset
|
137 | * You must g_free this string when finished using it. |
|
7127441da3ba
add xmlnode_get_data_unescaped(), and got rid of an unecessary realloc
Nathan Walp <nwalp@pidgin.im>
parents:
15884
diff
changeset
|
138 | */ |
|
27345
37d67bee50c2
These parameters aren't modified
Mark Doliner <markdoliner@pidgin.im>
parents:
26831
diff
changeset
|
139 | char *xmlnode_get_data(const xmlnode *node); |
|
18131
7127441da3ba
add xmlnode_get_data_unescaped(), and got rid of an unecessary realloc
Nathan Walp <nwalp@pidgin.im>
parents:
15884
diff
changeset
|
140 | |
|
7127441da3ba
add xmlnode_get_data_unescaped(), and got rid of an unecessary realloc
Nathan Walp <nwalp@pidgin.im>
parents:
15884
diff
changeset
|
141 | /** |
|
7127441da3ba
add xmlnode_get_data_unescaped(), and got rid of an unecessary realloc
Nathan Walp <nwalp@pidgin.im>
parents:
15884
diff
changeset
|
142 | * Gets unescaped data from a node. |
|
7127441da3ba
add xmlnode_get_data_unescaped(), and got rid of an unecessary realloc
Nathan Walp <nwalp@pidgin.im>
parents:
15884
diff
changeset
|
143 | * |
|
7127441da3ba
add xmlnode_get_data_unescaped(), and got rid of an unecessary realloc
Nathan Walp <nwalp@pidgin.im>
parents:
15884
diff
changeset
|
144 | * @param node The node to get data from. |
|
7127441da3ba
add xmlnode_get_data_unescaped(), and got rid of an unecessary realloc
Nathan Walp <nwalp@pidgin.im>
parents:
15884
diff
changeset
|
145 | * |
|
7127441da3ba
add xmlnode_get_data_unescaped(), and got rid of an unecessary realloc
Nathan Walp <nwalp@pidgin.im>
parents:
15884
diff
changeset
|
146 | * @return The data from the node, in unescaped form. You must g_free |
|
14162
3546040af8e2
[gaim-migrate @ 16730]
Daniel Atallah <datallah@pidgin.im>
parents:
13808
diff
changeset
|
147 | * this string when finished using it. |
| 10327 | 148 | */ |
|
27345
37d67bee50c2
These parameters aren't modified
Mark Doliner <markdoliner@pidgin.im>
parents:
26831
diff
changeset
|
149 | char *xmlnode_get_data_unescaped(const xmlnode *node); |
| 10327 | 150 | |
| 151 | /** | |
| 152 | * Sets an attribute for a node. | |
| 153 | * | |
| 154 | * @param node The node to set an attribute for. | |
| 155 | * @param attr The name of the attribute. | |
| 156 | * @param value The value of the attribute. | |
| 157 | */ | |
| 7131 | 158 | void xmlnode_set_attrib(xmlnode *node, const char *attr, const char *value); |
| 10327 | 159 | |
|
26393
7420fd99903a
Add xmlnode_set_attrib_full that enables you to set an attribute with both
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25911
diff
changeset
|
160 | #if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_XMLNODE_C_) |
| 10327 | 161 | /** |
|
21454
2ca06ee152ac
make our xmlnode preserve prefixes
Ka-Hing Cheung <khc@pidgin.im>
parents:
20603
diff
changeset
|
162 | * Sets a prefixed attribute for a node |
|
2ca06ee152ac
make our xmlnode preserve prefixes
Ka-Hing Cheung <khc@pidgin.im>
parents:
20603
diff
changeset
|
163 | * |
|
21552
6920e51d8f27
Get rid of a few silly doxygen warnings
Mark Doliner <markdoliner@pidgin.im>
parents:
21454
diff
changeset
|
164 | * @param node The node to set an attribute for. |
|
6920e51d8f27
Get rid of a few silly doxygen warnings
Mark Doliner <markdoliner@pidgin.im>
parents:
21454
diff
changeset
|
165 | * @param attr The name of the attribute to set |
|
6920e51d8f27
Get rid of a few silly doxygen warnings
Mark Doliner <markdoliner@pidgin.im>
parents:
21454
diff
changeset
|
166 | * @param prefix The prefix of the attribute to ste |
|
6920e51d8f27
Get rid of a few silly doxygen warnings
Mark Doliner <markdoliner@pidgin.im>
parents:
21454
diff
changeset
|
167 | * @param value The value of the attribute |
|
26393
7420fd99903a
Add xmlnode_set_attrib_full that enables you to set an attribute with both
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25911
diff
changeset
|
168 | * |
|
7420fd99903a
Add xmlnode_set_attrib_full that enables you to set an attribute with both
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25911
diff
changeset
|
169 | * @deprecated Use xmlnode_set_attrib_full instead. |
|
21454
2ca06ee152ac
make our xmlnode preserve prefixes
Ka-Hing Cheung <khc@pidgin.im>
parents:
20603
diff
changeset
|
170 | */ |
|
2ca06ee152ac
make our xmlnode preserve prefixes
Ka-Hing Cheung <khc@pidgin.im>
parents:
20603
diff
changeset
|
171 | void xmlnode_set_attrib_with_prefix(xmlnode *node, const char *attr, const char *prefix, const char *value); |
|
2ca06ee152ac
make our xmlnode preserve prefixes
Ka-Hing Cheung <khc@pidgin.im>
parents:
20603
diff
changeset
|
172 | |
|
2ca06ee152ac
make our xmlnode preserve prefixes
Ka-Hing Cheung <khc@pidgin.im>
parents:
20603
diff
changeset
|
173 | /** |
| 15265 | 174 | * Sets a namespaced attribute for a node |
| 175 | * | |
| 176 | * @param node The node to set an attribute for. | |
| 177 | * @param attr The name of the attribute to set | |
| 178 | * @param xmlns The namespace of the attribute to ste | |
| 179 | * @param value The value of the attribute | |
|
26393
7420fd99903a
Add xmlnode_set_attrib_full that enables you to set an attribute with both
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25911
diff
changeset
|
180 | * |
|
7420fd99903a
Add xmlnode_set_attrib_full that enables you to set an attribute with both
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25911
diff
changeset
|
181 | * @deprecated Use xmlnode_set_attrib_full instead. |
| 15265 | 182 | */ |
| 183 | void xmlnode_set_attrib_with_namespace(xmlnode *node, const char *attr, const char *xmlns, const char *value); | |
|
26393
7420fd99903a
Add xmlnode_set_attrib_full that enables you to set an attribute with both
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25911
diff
changeset
|
184 | #endif /* PURPLE_DISABLE_DEPRECATED */ |
|
7420fd99903a
Add xmlnode_set_attrib_full that enables you to set an attribute with both
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25911
diff
changeset
|
185 | |
|
7420fd99903a
Add xmlnode_set_attrib_full that enables you to set an attribute with both
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25911
diff
changeset
|
186 | /** |
|
7420fd99903a
Add xmlnode_set_attrib_full that enables you to set an attribute with both
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25911
diff
changeset
|
187 | * Sets a namespaced attribute for a node |
|
7420fd99903a
Add xmlnode_set_attrib_full that enables you to set an attribute with both
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25911
diff
changeset
|
188 | * |
|
7420fd99903a
Add xmlnode_set_attrib_full that enables you to set an attribute with both
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25911
diff
changeset
|
189 | * @param node The node to set an attribute for. |
|
7420fd99903a
Add xmlnode_set_attrib_full that enables you to set an attribute with both
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25911
diff
changeset
|
190 | * @param attr The name of the attribute to set |
|
7420fd99903a
Add xmlnode_set_attrib_full that enables you to set an attribute with both
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25911
diff
changeset
|
191 | * @param xmlns The namespace of the attribute to ste |
|
7420fd99903a
Add xmlnode_set_attrib_full that enables you to set an attribute with both
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25911
diff
changeset
|
192 | * @param prefix The prefix of the attribute to ste |
|
7420fd99903a
Add xmlnode_set_attrib_full that enables you to set an attribute with both
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25911
diff
changeset
|
193 | * @param value The value of the attribute |
|
7420fd99903a
Add xmlnode_set_attrib_full that enables you to set an attribute with both
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25911
diff
changeset
|
194 | * |
|
7420fd99903a
Add xmlnode_set_attrib_full that enables you to set an attribute with both
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25911
diff
changeset
|
195 | * @since 2.6.0 |
|
7420fd99903a
Add xmlnode_set_attrib_full that enables you to set an attribute with both
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25911
diff
changeset
|
196 | */ |
|
7420fd99903a
Add xmlnode_set_attrib_full that enables you to set an attribute with both
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25911
diff
changeset
|
197 | void xmlnode_set_attrib_full(xmlnode *node, const char *attr, const char *xmlns, |
|
7420fd99903a
Add xmlnode_set_attrib_full that enables you to set an attribute with both
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25911
diff
changeset
|
198 | const char *prefix, const char *value); |
| 15265 | 199 | |
| 200 | /** | |
| 10327 | 201 | * Gets an attribute from a node. |
| 202 | * | |
| 203 | * @param node The node to get an attribute from. | |
| 204 | * @param attr The attribute to get. | |
| 205 | * | |
| 206 | * @return The value of the attribute. | |
| 207 | */ | |
| 7131 | 208 | const char *xmlnode_get_attrib(xmlnode *node, const char *attr); |
| 10327 | 209 | |
| 210 | /** | |
| 15265 | 211 | * Gets a namespaced attribute from a node |
| 212 | * | |
| 213 | * @param node The node to get an attribute from. | |
| 214 | * @param attr The attribute to get | |
| 215 | * @param xmlns The namespace of the attribute to get | |
| 216 | * | |
| 217 | * @return The value of the attribute/ | |
| 218 | */ | |
| 219 | const char *xmlnode_get_attrib_with_namespace(xmlnode *node, const char *attr, const char *xmlns); | |
| 220 | ||
| 221 | /** | |
| 10327 | 222 | * Removes an attribute from a node. |
| 223 | * | |
| 224 | * @param node The node to remove an attribute from. | |
| 225 | * @param attr The attribute to remove. | |
| 226 | */ | |
| 7131 | 227 | void xmlnode_remove_attrib(xmlnode *node, const char *attr); |
| 10327 | 228 | |
| 229 | /** | |
| 15265 | 230 | * Removes a namespaced attribute from a node |
| 231 | * | |
| 232 | * @param node The node to remove an attribute from | |
| 233 | * @param attr The attribute to remove | |
| 234 | * @param xmlns The namespace of the attribute to remove | |
| 235 | */ | |
| 236 | void xmlnode_remove_attrib_with_namespace(xmlnode *node, const char *attr, const char *xmlns); | |
| 237 | ||
| 238 | /** | |
| 13808 | 239 | * Sets the namespace of a node |
| 240 | * | |
| 241 | * @param node The node to qualify | |
| 242 | * @param xmlns The namespace of the node | |
| 243 | */ | |
| 244 | void xmlnode_set_namespace(xmlnode *node, const char *xmlns); | |
| 245 | ||
| 246 | /** | |
| 247 | * Returns the namespace of a node | |
| 248 | * | |
| 249 | * @param node The node to get the namepsace from | |
| 250 | * @return The namespace of this node | |
| 251 | */ | |
| 252 | const char *xmlnode_get_namespace(xmlnode *node); | |
| 253 | ||
| 254 | /** | |
|
21454
2ca06ee152ac
make our xmlnode preserve prefixes
Ka-Hing Cheung <khc@pidgin.im>
parents:
20603
diff
changeset
|
255 | * Sets the prefix of a node |
|
2ca06ee152ac
make our xmlnode preserve prefixes
Ka-Hing Cheung <khc@pidgin.im>
parents:
20603
diff
changeset
|
256 | * |
|
21552
6920e51d8f27
Get rid of a few silly doxygen warnings
Mark Doliner <markdoliner@pidgin.im>
parents:
21454
diff
changeset
|
257 | * @param node The node to qualify |
|
6920e51d8f27
Get rid of a few silly doxygen warnings
Mark Doliner <markdoliner@pidgin.im>
parents:
21454
diff
changeset
|
258 | * @param prefix The prefix of the node |
|
21454
2ca06ee152ac
make our xmlnode preserve prefixes
Ka-Hing Cheung <khc@pidgin.im>
parents:
20603
diff
changeset
|
259 | */ |
|
2ca06ee152ac
make our xmlnode preserve prefixes
Ka-Hing Cheung <khc@pidgin.im>
parents:
20603
diff
changeset
|
260 | void xmlnode_set_prefix(xmlnode *node, const char *prefix); |
|
2ca06ee152ac
make our xmlnode preserve prefixes
Ka-Hing Cheung <khc@pidgin.im>
parents:
20603
diff
changeset
|
261 | |
|
2ca06ee152ac
make our xmlnode preserve prefixes
Ka-Hing Cheung <khc@pidgin.im>
parents:
20603
diff
changeset
|
262 | /** |
|
2ca06ee152ac
make our xmlnode preserve prefixes
Ka-Hing Cheung <khc@pidgin.im>
parents:
20603
diff
changeset
|
263 | * Returns the prefix of a node |
|
2ca06ee152ac
make our xmlnode preserve prefixes
Ka-Hing Cheung <khc@pidgin.im>
parents:
20603
diff
changeset
|
264 | * |
|
2ca06ee152ac
make our xmlnode preserve prefixes
Ka-Hing Cheung <khc@pidgin.im>
parents:
20603
diff
changeset
|
265 | * @param node The node to get the prefix from |
|
2ca06ee152ac
make our xmlnode preserve prefixes
Ka-Hing Cheung <khc@pidgin.im>
parents:
20603
diff
changeset
|
266 | * @return The prefix of this node |
|
2ca06ee152ac
make our xmlnode preserve prefixes
Ka-Hing Cheung <khc@pidgin.im>
parents:
20603
diff
changeset
|
267 | */ |
|
25559
b8df546bf422
There's no reason for these to not be const is there? This doesn't
Mark Doliner <markdoliner@pidgin.im>
parents:
21552
diff
changeset
|
268 | const char *xmlnode_get_prefix(const xmlnode *node); |
|
21454
2ca06ee152ac
make our xmlnode preserve prefixes
Ka-Hing Cheung <khc@pidgin.im>
parents:
20603
diff
changeset
|
269 | |
|
2ca06ee152ac
make our xmlnode preserve prefixes
Ka-Hing Cheung <khc@pidgin.im>
parents:
20603
diff
changeset
|
270 | /** |
|
23750
57baab09bf45
Added xmlnode_get_parent.
Michael Ruprecht <maiku@pidgin.im>
parents:
21552
diff
changeset
|
271 | * Gets the parent node. |
|
57baab09bf45
Added xmlnode_get_parent.
Michael Ruprecht <maiku@pidgin.im>
parents:
21552
diff
changeset
|
272 | * |
|
57baab09bf45
Added xmlnode_get_parent.
Michael Ruprecht <maiku@pidgin.im>
parents:
21552
diff
changeset
|
273 | * @param child The child node. |
|
57baab09bf45
Added xmlnode_get_parent.
Michael Ruprecht <maiku@pidgin.im>
parents:
21552
diff
changeset
|
274 | * |
|
57baab09bf45
Added xmlnode_get_parent.
Michael Ruprecht <maiku@pidgin.im>
parents:
21552
diff
changeset
|
275 | * @return The parent or NULL. |
|
26646
ec5cf90362ec
Add some more @since tags.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26399
diff
changeset
|
276 | * |
|
ec5cf90362ec
Add some more @since tags.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26399
diff
changeset
|
277 | * @since 2.6.0 |
|
23750
57baab09bf45
Added xmlnode_get_parent.
Michael Ruprecht <maiku@pidgin.im>
parents:
21552
diff
changeset
|
278 | */ |
|
57baab09bf45
Added xmlnode_get_parent.
Michael Ruprecht <maiku@pidgin.im>
parents:
21552
diff
changeset
|
279 | xmlnode *xmlnode_get_parent(const xmlnode *child); |
|
57baab09bf45
Added xmlnode_get_parent.
Michael Ruprecht <maiku@pidgin.im>
parents:
21552
diff
changeset
|
280 | |
|
57baab09bf45
Added xmlnode_get_parent.
Michael Ruprecht <maiku@pidgin.im>
parents:
21552
diff
changeset
|
281 | /** |
| 10327 | 282 | * Returns the node in a string of xml. |
| 283 | * | |
| 284 | * @param node The starting node to output. | |
| 285 | * @param len Address for the size of the string. | |
| 286 | * | |
|
12887
4235bbee17b1
[gaim-migrate @ 15240]
Daniel Atallah <datallah@pidgin.im>
parents:
12233
diff
changeset
|
287 | * @return The node represented as a string. You must |
|
10415
faceb835eb87
[gaim-migrate @ 11665]
Mark Doliner <markdoliner@pidgin.im>
parents:
10337
diff
changeset
|
288 | * g_free this string when finished using it. |
| 10327 | 289 | */ |
|
25559
b8df546bf422
There's no reason for these to not be const is there? This doesn't
Mark Doliner <markdoliner@pidgin.im>
parents:
21552
diff
changeset
|
290 | char *xmlnode_to_str(const xmlnode *node, int *len); |
| 10327 | 291 | |
| 292 | /** | |
| 293 | * Returns the node in a string of human readable xml. | |
| 294 | * | |
| 295 | * @param node The starting node to output. | |
| 296 | * @param len Address for the size of the string. | |
| 297 | * | |
| 298 | * @return The node as human readable string including | |
|
10415
faceb835eb87
[gaim-migrate @ 11665]
Mark Doliner <markdoliner@pidgin.im>
parents:
10337
diff
changeset
|
299 | * tab and new line characters. You must |
|
faceb835eb87
[gaim-migrate @ 11665]
Mark Doliner <markdoliner@pidgin.im>
parents:
10337
diff
changeset
|
300 | * g_free this string when finished using it. |
| 10327 | 301 | */ |
|
25559
b8df546bf422
There's no reason for these to not be const is there? This doesn't
Mark Doliner <markdoliner@pidgin.im>
parents:
21552
diff
changeset
|
302 | char *xmlnode_to_formatted_str(const xmlnode *node, int *len); |
| 10327 | 303 | |
| 304 | /** | |
|
10337
778231f38df6
[gaim-migrate @ 11545]
Mark Doliner <markdoliner@pidgin.im>
parents:
10327
diff
changeset
|
305 | * Creates a node from a string of XML. Calling this on the |
|
778231f38df6
[gaim-migrate @ 11545]
Mark Doliner <markdoliner@pidgin.im>
parents:
10327
diff
changeset
|
306 | * root node of an XML document will parse the entire document |
|
778231f38df6
[gaim-migrate @ 11545]
Mark Doliner <markdoliner@pidgin.im>
parents:
10327
diff
changeset
|
307 | * into a tree of nodes, and return the xmlnode of the root. |
| 10327 | 308 | * |
| 309 | * @param str The string of xml. | |
|
11707
a2c8dd795e3b
[gaim-migrate @ 13998]
Richard Laager <rlaager@pidgin.im>
parents:
10848
diff
changeset
|
310 | * @param size The size of the string, or -1 if @a str is |
|
a2c8dd795e3b
[gaim-migrate @ 13998]
Richard Laager <rlaager@pidgin.im>
parents:
10848
diff
changeset
|
311 | * NUL-terminated. |
| 10327 | 312 | * |
| 313 | * @return The new node. | |
| 314 | */ | |
| 10848 | 315 | xmlnode *xmlnode_from_str(const char *str, gssize size); |
| 10327 | 316 | |
| 317 | /** | |
| 318 | * Creates a new node from the source node. | |
| 319 | * | |
| 320 | * @param src The node to copy. | |
| 321 | * | |
| 322 | * @return A new copy of the src node. | |
| 323 | */ | |
|
15609
e432251bd57e
sf patch #1647731, from Markus Elfring
Mark Doliner <markdoliner@pidgin.im>
parents:
15435
diff
changeset
|
324 | xmlnode *xmlnode_copy(const xmlnode *src); |
| 7131 | 325 | |
| 10327 | 326 | /** |
|
17775
1df27cab581c
implemented user mood, still missing the front end interface
Andreas Monitzer <am@adiumx.com>
parents:
15884
diff
changeset
|
327 | * Frees a node and all of its children. |
| 10327 | 328 | * |
| 329 | * @param node The node to free. | |
| 330 | */ | |
| 7131 | 331 | void xmlnode_free(xmlnode *node); |
| 332 | ||
|
23643
4a68ddefa857
added a more generic function to read xml files (and made the util version into a wrapper) so it can be used by the
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
21552
diff
changeset
|
333 | /** |
|
4a68ddefa857
added a more generic function to read xml files (and made the util version into a wrapper) so it can be used by the
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
21552
diff
changeset
|
334 | * Creates a node from a XML File. Calling this on the |
|
4a68ddefa857
added a more generic function to read xml files (and made the util version into a wrapper) so it can be used by the
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
21552
diff
changeset
|
335 | * root node of an XML document will parse the entire document |
|
4a68ddefa857
added a more generic function to read xml files (and made the util version into a wrapper) so it can be used by the
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
21552
diff
changeset
|
336 | * into a tree of nodes, and return the xmlnode of the root. |
|
4a68ddefa857
added a more generic function to read xml files (and made the util version into a wrapper) so it can be used by the
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
21552
diff
changeset
|
337 | * |
|
26384
1b9c946aaafa
Fixing warnings from `make docs` and stuff
Paul Aurich <darkrain42@pidgin.im>
parents:
25911
diff
changeset
|
338 | * @param dir The directory where the file is located |
|
1b9c946aaafa
Fixing warnings from `make docs` and stuff
Paul Aurich <darkrain42@pidgin.im>
parents:
25911
diff
changeset
|
339 | * @param filename The filename |
|
1b9c946aaafa
Fixing warnings from `make docs` and stuff
Paul Aurich <darkrain42@pidgin.im>
parents:
25911
diff
changeset
|
340 | * @param description A description of the file being parsed. Displayed to |
|
1b9c946aaafa
Fixing warnings from `make docs` and stuff
Paul Aurich <darkrain42@pidgin.im>
parents:
25911
diff
changeset
|
341 | * the user if the file cannot be read. |
|
1b9c946aaafa
Fixing warnings from `make docs` and stuff
Paul Aurich <darkrain42@pidgin.im>
parents:
25911
diff
changeset
|
342 | * @param process The subsystem that is calling xmlnode_from_file. Used as |
|
1b9c946aaafa
Fixing warnings from `make docs` and stuff
Paul Aurich <darkrain42@pidgin.im>
parents:
25911
diff
changeset
|
343 | * the category for debugging. |
|
23643
4a68ddefa857
added a more generic function to read xml files (and made the util version into a wrapper) so it can be used by the
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
21552
diff
changeset
|
344 | * |
|
26384
1b9c946aaafa
Fixing warnings from `make docs` and stuff
Paul Aurich <darkrain42@pidgin.im>
parents:
25911
diff
changeset
|
345 | * @return The new node or NULL if an error occurred. |
|
25885
5b5e2ca316b2
Add @since 2.6.0 doxygen comments to some of our new functions, and
Mark Doliner <markdoliner@pidgin.im>
parents:
23659
diff
changeset
|
346 | * |
|
5b5e2ca316b2
Add @since 2.6.0 doxygen comments to some of our new functions, and
Mark Doliner <markdoliner@pidgin.im>
parents:
23659
diff
changeset
|
347 | * @since 2.6.0 |
|
23643
4a68ddefa857
added a more generic function to read xml files (and made the util version into a wrapper) so it can be used by the
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
21552
diff
changeset
|
348 | */ |
|
25888
d0fdd378a635
Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents:
25885
diff
changeset
|
349 | xmlnode *xmlnode_from_file(const char *dir, const char *filename, |
|
23643
4a68ddefa857
added a more generic function to read xml files (and made the util version into a wrapper) so it can be used by the
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
21552
diff
changeset
|
350 | const char *description, const char *process); |
|
4a68ddefa857
added a more generic function to read xml files (and made the util version into a wrapper) so it can be used by the
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
21552
diff
changeset
|
351 | |
|
14988
66b34458d49e
[gaim-migrate @ 17698]
Richard Laager <rlaager@pidgin.im>
parents:
14498
diff
changeset
|
352 | #ifdef __cplusplus |
|
66b34458d49e
[gaim-migrate @ 17698]
Richard Laager <rlaager@pidgin.im>
parents:
14498
diff
changeset
|
353 | } |
|
66b34458d49e
[gaim-migrate @ 17698]
Richard Laager <rlaager@pidgin.im>
parents:
14498
diff
changeset
|
354 | #endif |
|
66b34458d49e
[gaim-migrate @ 17698]
Richard Laager <rlaager@pidgin.im>
parents:
14498
diff
changeset
|
355 | |
| 15884 | 356 | #endif /* _PURPLE_XMLNODE_H_ */ |