From 27b5ba800c17f923f66c0939f94f364bccbda0dd Mon Sep 17 00:00:00 2001 From: "Zane U. Ji" Date: Mon, 23 Dec 2013 22:09:54 +0800 Subject: [PATCH] Fixed the output format when changing encoding --- src/wraplibxml.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/wraplibxml.cpp b/src/wraplibxml.cpp index 10b2dc5..36f7de0 100644 --- a/src/wraplibxml.cpp +++ b/src/wraplibxml.cpp @@ -573,7 +573,9 @@ int WrapLibxml::saveEncoding ( } xmlDocPtr docPtr; - int flags = XML_PARSE_DTDLOAD | XML_PARSE_PEDANTIC /*| XML_PARSE_DTDVALID*/;//XML_PARSE_NONET//XML_PARSE_DTDLOAD//0//(netAccess) ? XML_PARSE_DTDLOAD | XML_PARSE_NOENT : XML_PARSE_DTDLOAD | XML_PARSE_NONET | XML_PARSE_NOENT//0 + // Don't load DTD because additional namespace declarations will be added + // to every element when processing a docbook XML + int flags = XML_PARSE_PEDANTIC /*| XML_PARSE_DTDLOAD | XML_PARSE_DTDVALID*/; if ( !netAccess ) flags |= XML_PARSE_NONET; if ( utf8Buffer != NULL ) @@ -598,8 +600,8 @@ int WrapLibxml::saveEncoding ( else { xmlChar *buffer; - xmlDocDumpMemoryEnc ( docPtr, &buffer, &result, - encoding.utf8_str() ); + xmlDocDumpFormatMemoryEnc ( docPtr, &buffer, &result, + encoding.utf8_str(), 1 ); outputBuffer->AppendData ( buffer, result ); xmlFree ( buffer ); }