Merge branch 'cairocanvas' of git.ardour.org:ardour/ardour into cairocanvas
[ardour.git] / libs / pbd / xml++.cc
index a1fa77db660b53c3ec40f1871406b863b4747a76..5fb777bdc77444b6c989dc0548c4c9fdc7097242 100644 (file)
@@ -155,6 +155,20 @@ XMLTree::write() const
        xmlSetDocCompressMode(doc, _compression);
        writenode(doc, _root, doc->children, 1);
        result = xmlSaveFormatFileEnc(_filename.c_str(), doc, "UTF-8", 1);
+#ifndef NDEBUG
+       if (result == -1) {
+               xmlErrorPtr xerr = xmlGetLastError ();
+               if (!xerr) {
+                       std::cerr << "unknown XML error during xmlSaveFormatFileEnc()." << std::endl;
+               } else {
+                       std::cerr << "xmlSaveFormatFileEnc: error"
+                               << " domain: " << xerr->domain
+                               << " code: " << xerr->code
+                               << " msg: " << xerr->message
+                               << std::endl;
+               }
+       }
+#endif
        xmlFreeDoc(doc);
 
        if (result == -1) {
@@ -167,6 +181,7 @@ XMLTree::write() const
 void
 XMLTree::debug(FILE* out) const
 {
+#ifdef LIBXML_DEBUG_ENABLED
        xmlDocPtr doc;
        XMLNodeList children;
 
@@ -176,6 +191,7 @@ XMLTree::debug(FILE* out) const
        writenode(doc, _root, doc->children, 1);
        xmlDebugDumpDocument (out, doc);
        xmlFreeDoc(doc);
+#endif
 }
 
 const string&