diff 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
line wrap: on
line diff
--- a/libpurple/xmlnode.h	Sun Sep 04 18:52:18 2011 +0000
+++ b/libpurple/xmlnode.h	Sun Sep 04 21:06:26 2011 +0000
@@ -243,6 +243,15 @@
 const char *xmlnode_get_default_namespace(const xmlnode *node);
 
 /**
+ * Returns the defined namespace for a prefix.
+ *
+ * @param node The node from which to start the search.
+ * @param prefix The prefix for which to return the associated namespace.
+ * @return The namespace for this prefix.
+ */
+const char *xmlnode_get_prefix_namespace(const xmlnode *node, const char *prefix);
+
+/**
  * Sets the prefix of a node
  *
  * @param node   The node to qualify
@@ -259,6 +268,19 @@
 const char *xmlnode_get_prefix(const xmlnode *node);
 
 /**
+ * Remove all element prefixes from an xmlnode tree.  The prefix's
+ * namespace is transformed into the default namespace for an element.
+ *
+ * Note that this will not necessarily remove all prefixes in use
+ * (prefixed attributes may still exist), and that this usage may
+ * break some applications (SOAP / XPath apparently often rely on
+ * the prefixes having the same name.
+ *
+ * @param node The node from which to strip prefixes
+ */
+void xmlnode_strip_prefixes(xmlnode *node);
+
+/**
  * Gets the parent node.
  *
  * @param child The child node.