summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libs/pbd/pbd/xml++.h2
-rw-r--r--libs/pbd/xml++.cc15
2 files changed, 17 insertions, 0 deletions
diff --git a/libs/pbd/pbd/xml++.h b/libs/pbd/pbd/xml++.h
index 65ab0f2c03..18bb3e013e 100644
--- a/libs/pbd/pbd/xml++.h
+++ b/libs/pbd/pbd/xml++.h
@@ -110,6 +110,8 @@ public:
/** Remove and delete all nodes with property prop matching val */
void remove_nodes_and_delete(const std::string& propname, const std::string& val);
+ void debug (std::ostream &, std::string p = "");
+
private:
std::string _name;
bool _is_content;
diff --git a/libs/pbd/xml++.cc b/libs/pbd/xml++.cc
index 91d169d8bf..d691b0bd82 100644
--- a/libs/pbd/xml++.cc
+++ b/libs/pbd/xml++.cc
@@ -5,6 +5,7 @@
* Modified for Ardour and released under the same terms.
*/
+#include <iostream>
#include "pbd/xml++.h"
#include <libxml/debugXML.h>
#include <libxml/xpath.h>
@@ -589,3 +590,17 @@ static XMLSharedNodeList* find_impl(xmlXPathContext* ctxt, const string& xpath)
return nodes;
}
+/** Dump a node, its properties and children to a stream */
+void
+XMLNode::debug (ostream& s, string p)
+{
+ s << p << _name << " ";
+ for (XMLPropertyList::iterator i = _proplist.begin(); i != _proplist.end(); ++i) {
+ s << (*i)->name() << "=" << (*i)->value() << " ";
+ }
+ s << "\n";
+
+ for (XMLNodeList::iterator i = _children.begin(); i != _children.end(); ++i) {
+ (*i)->debug (s, p + " ");
+ }
+}