fix gcc4.4 compile warning
[ardour.git] / libs / pbd / xml++.cc
index 90d7c3cf4879720fd523fcdea47e3037b3162af1..d691b0bd8224687eb1d62bf30ae52490aaf6d8cd 100644 (file)
@@ -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>
@@ -95,7 +96,6 @@ XMLTree::read_internal(bool validate)
                if (validate && ctxt->valid == 0) {
                        xmlFreeParserCtxt(ctxt);
                        xmlFreeDoc(doc);
-                       xmlCleanupParser();
                        throw XMLException("Failed to validate document " + _filename);
                }
        }
@@ -107,7 +107,6 @@ XMLTree::read_internal(bool validate)
                xmlFreeParserCtxt(ctxt);
        }
        xmlFreeDoc(doc);
-       xmlCleanupParser();
 
        return true;
 }
@@ -591,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 + "  ");
+       }
+}