Mercurial > pidgin.yaz
comparison libpurple/xmlnode.h @ 32779:d72f2f13b60f
merge of 'c8c73eea7431e6f940916315ace40a41c8da3faa'
and 'fec428131bde0ae8247941bd6a3d996c984c9189'
| author | Ethan Blanton <elb@pidgin.im> |
|---|---|
| date | Fri, 21 Oct 2011 14:36:18 +0000 |
| parents | 5aa171c8776b |
| children |
comparison
equal
deleted
inserted
replaced
| 32778:14787acaf9d7 | 32779:d72f2f13b60f |
|---|---|
| 33 #endif | 33 #endif |
| 34 | 34 |
| 35 /** | 35 /** |
| 36 * The valid types for an xmlnode | 36 * The valid types for an xmlnode |
| 37 */ | 37 */ |
| 38 typedef enum _XMLNodeType | 38 typedef enum |
| 39 { | 39 { |
| 40 XMLNODE_TYPE_TAG, /**< Just a tag */ | 40 XMLNODE_TYPE_TAG, /**< Just a tag */ |
| 41 XMLNODE_TYPE_ATTRIB, /**< Has attributes */ | 41 XMLNODE_TYPE_ATTRIB, /**< Has attributes */ |
| 42 XMLNODE_TYPE_DATA /**< Has data */ | 42 XMLNODE_TYPE_DATA /**< Has data */ |
| 43 } XMLNodeType; | 43 } XMLNodeType; |
| 155 * @param attr The name of the attribute. | 155 * @param attr The name of the attribute. |
| 156 * @param value The value of the attribute. | 156 * @param value The value of the attribute. |
| 157 */ | 157 */ |
| 158 void xmlnode_set_attrib(xmlnode *node, const char *attr, const char *value); | 158 void xmlnode_set_attrib(xmlnode *node, const char *attr, const char *value); |
| 159 | 159 |
| 160 #if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_XMLNODE_C_) | 160 /** |
| 161 /** | 161 * Sets a namespaced attribute for a node |
| 162 * Sets a prefixed attribute for a node | |
| 163 * | 162 * |
| 164 * @param node The node to set an attribute for. | 163 * @param node The node to set an attribute for. |
| 165 * @param attr The name of the attribute to set | 164 * @param attr The name of the attribute to set |
| 166 * @param prefix The prefix of the attribute to ste | 165 * @param xmlns The namespace of the attribute to set |
| 166 * @param prefix The prefix of the attribute to set | |
| 167 * @param value The value of the attribute | 167 * @param value The value of the attribute |
| 168 * | |
| 169 * @deprecated Use xmlnode_set_attrib_full instead. | |
| 170 */ | |
| 171 void xmlnode_set_attrib_with_prefix(xmlnode *node, const char *attr, const char *prefix, const char *value); | |
| 172 | |
| 173 /** | |
| 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 | |
| 180 * | |
| 181 * @deprecated Use xmlnode_set_attrib_full instead. | |
| 182 */ | |
| 183 void xmlnode_set_attrib_with_namespace(xmlnode *node, const char *attr, const char *xmlns, const char *value); | |
| 184 #endif /* PURPLE_DISABLE_DEPRECATED */ | |
| 185 | |
| 186 /** | |
| 187 * Sets a namespaced attribute for a node | |
| 188 * | |
| 189 * @param node The node to set an attribute for. | |
| 190 * @param attr The name of the attribute to set | |
| 191 * @param xmlns The namespace of the attribute to ste | |
| 192 * @param prefix The prefix of the attribute to ste | |
| 193 * @param value The value of the attribute | |
| 194 * | |
| 195 * @since 2.6.0 | |
| 196 */ | 168 */ |
| 197 void xmlnode_set_attrib_full(xmlnode *node, const char *attr, const char *xmlns, | 169 void xmlnode_set_attrib_full(xmlnode *node, const char *attr, const char *xmlns, |
| 198 const char *prefix, const char *value); | 170 const char *prefix, const char *value); |
| 199 | 171 |
| 200 /** | 172 /** |
| 247 * Returns the namespace of a node | 219 * Returns the namespace of a node |
| 248 * | 220 * |
| 249 * @param node The node to get the namepsace from | 221 * @param node The node to get the namepsace from |
| 250 * @return The namespace of this node | 222 * @return The namespace of this node |
| 251 */ | 223 */ |
| 252 const char *xmlnode_get_namespace(xmlnode *node); | 224 const char *xmlnode_get_namespace(const xmlnode *node); |
| 225 | |
| 226 /** | |
| 227 * Returns the current default namespace. The default | |
| 228 * namespace is the current namespace which applies to child | |
| 229 * elements which are unprefixed and which do not contain their | |
| 230 * own namespace. | |
| 231 * | |
| 232 * For example, given: | |
| 233 * \verbatim | |
| 234 * <iq type='get' xmlns='jabber:client' xmlns:ns1='http://example.org/ns1'> | |
| 235 * <ns1:element><child1/></ns1:element> | |
| 236 * </iq> | |
| 237 * \endverbatim | |
| 238 * | |
| 239 * The default namespace of all nodes (including 'child1') is "jabber:client", | |
| 240 * though the namespace for 'element' is "http://example.org/ns1". | |
| 241 * | |
| 242 * @param node The node for which to return the default namespace | |
| 243 * @return The default namespace of this node | |
| 244 */ | |
| 245 const char *xmlnode_get_default_namespace(const xmlnode *node); | |
| 246 | |
| 247 /** | |
| 248 * Returns the defined namespace for a prefix. | |
| 249 * | |
| 250 * @param node The node from which to start the search. | |
| 251 * @param prefix The prefix for which to return the associated namespace. | |
| 252 * @return The namespace for this prefix. | |
| 253 */ | |
| 254 const char *xmlnode_get_prefix_namespace(const xmlnode *node, const char *prefix); | |
| 253 | 255 |
| 254 /** | 256 /** |
| 255 * Sets the prefix of a node | 257 * Sets the prefix of a node |
| 256 * | 258 * |
| 257 * @param node The node to qualify | 259 * @param node The node to qualify |
| 266 * @return The prefix of this node | 268 * @return The prefix of this node |
| 267 */ | 269 */ |
| 268 const char *xmlnode_get_prefix(const xmlnode *node); | 270 const char *xmlnode_get_prefix(const xmlnode *node); |
| 269 | 271 |
| 270 /** | 272 /** |
| 273 * Remove all element prefixes from an xmlnode tree. The prefix's | |
| 274 * namespace is transformed into the default namespace for an element. | |
| 275 * | |
| 276 * Note that this will not necessarily remove all prefixes in use | |
| 277 * (prefixed attributes may still exist), and that this usage may | |
| 278 * break some applications (SOAP / XPath apparently often rely on | |
| 279 * the prefixes having the same name. | |
| 280 * | |
| 281 * @param node The node from which to strip prefixes | |
| 282 */ | |
| 283 void xmlnode_strip_prefixes(xmlnode *node); | |
| 284 | |
| 285 /** | |
| 271 * Gets the parent node. | 286 * Gets the parent node. |
| 272 * | 287 * |
| 273 * @param child The child node. | 288 * @param child The child node. |
| 274 * | 289 * |
| 275 * @return The parent or NULL. | 290 * @return The parent or NULL. |
| 276 * | |
| 277 * @since 2.6.0 | |
| 278 */ | 291 */ |
| 279 xmlnode *xmlnode_get_parent(const xmlnode *child); | 292 xmlnode *xmlnode_get_parent(const xmlnode *child); |
| 280 | 293 |
| 281 /** | 294 /** |
| 282 * Returns the node in a string of xml. | 295 * Returns the node in a string of xml. |
| 341 * the user if the file cannot be read. | 354 * the user if the file cannot be read. |
| 342 * @param process The subsystem that is calling xmlnode_from_file. Used as | 355 * @param process The subsystem that is calling xmlnode_from_file. Used as |
| 343 * the category for debugging. | 356 * the category for debugging. |
| 344 * | 357 * |
| 345 * @return The new node or NULL if an error occurred. | 358 * @return The new node or NULL if an error occurred. |
| 346 * | |
| 347 * @since 2.6.0 | |
| 348 */ | 359 */ |
| 349 xmlnode *xmlnode_from_file(const char *dir, const char *filename, | 360 xmlnode *xmlnode_from_file(const char *dir, const char *filename, |
| 350 const char *description, const char *process); | 361 const char *description, const char *process); |
| 351 | 362 |
| 352 #ifdef __cplusplus | 363 #ifdef __cplusplus |
| 353 } | 364 } |
| 354 #endif | 365 #endif |
| 355 | 366 |
| 356 #endif /* _PURPLE_XMLNODE_H_ */ | 367 #endif /* _PURPLE_XMLNODE_H_ */ |
| 368 |
