Mercurial > pidgin
comparison libpurple/xmlnode.h @ 32038:8d3b5853b017
xmlnode: Add xmlnode_strip_prefixes
This is largely based on a patch from Thijs (sphynx/xnyhps) Alkemade, with
some modifications by me to try to maintain namespaces of elements
as best as we can.
I also rewrote xmlnode_get_default_namespace not to use recursion.
References #14529
author | Paul Aurich <paul@darkrain42.org> |
---|---|
date | Sun, 04 Sep 2011 21:06:26 +0000 |
parents | 114a98da1a5f |
children | 5aa171c8776b |
comparison
equal
deleted
inserted
replaced
32037:114a98da1a5f | 32038:8d3b5853b017 |
---|---|
241 * @return The default namespace of this node | 241 * @return The default namespace of this node |
242 */ | 242 */ |
243 const char *xmlnode_get_default_namespace(const xmlnode *node); | 243 const char *xmlnode_get_default_namespace(const xmlnode *node); |
244 | 244 |
245 /** | 245 /** |
246 * Returns the defined namespace for a prefix. | |
247 * | |
248 * @param node The node from which to start the search. | |
249 * @param prefix The prefix for which to return the associated namespace. | |
250 * @return The namespace for this prefix. | |
251 */ | |
252 const char *xmlnode_get_prefix_namespace(const xmlnode *node, const char *prefix); | |
253 | |
254 /** | |
246 * Sets the prefix of a node | 255 * Sets the prefix of a node |
247 * | 256 * |
248 * @param node The node to qualify | 257 * @param node The node to qualify |
249 * @param prefix The prefix of the node | 258 * @param prefix The prefix of the node |
250 */ | 259 */ |
255 * | 264 * |
256 * @param node The node to get the prefix from | 265 * @param node The node to get the prefix from |
257 * @return The prefix of this node | 266 * @return The prefix of this node |
258 */ | 267 */ |
259 const char *xmlnode_get_prefix(const xmlnode *node); | 268 const char *xmlnode_get_prefix(const xmlnode *node); |
269 | |
270 /** | |
271 * Remove all element prefixes from an xmlnode tree. The prefix's | |
272 * namespace is transformed into the default namespace for an element. | |
273 * | |
274 * Note that this will not necessarily remove all prefixes in use | |
275 * (prefixed attributes may still exist), and that this usage may | |
276 * break some applications (SOAP / XPath apparently often rely on | |
277 * the prefixes having the same name. | |
278 * | |
279 * @param node The node from which to strip prefixes | |
280 */ | |
281 void xmlnode_strip_prefixes(xmlnode *node); | |
260 | 282 |
261 /** | 283 /** |
262 * Gets the parent node. | 284 * Gets the parent node. |
263 * | 285 * |
264 * @param child The child node. | 286 * @param child The child node. |