In PrintString, move the optimization under the if ( _processEntities ) block and retain the strlen Write in the new else block. Added a test case.
diff --git a/xmltest.cpp b/xmltest.cpp
index 7160fe9..26443aa 100644
--- a/xmltest.cpp
+++ b/xmltest.cpp
@@ -1996,6 +1996,17 @@
}
{
+ const char* html("<!DOCTYPE html><html><body><p>test</p><p><br/></p></body></html>");
+ XMLDocument doc(false);
+ doc.Parse(html);
+
+ XMLPrinter printer(0, true);
+ doc.Print(&printer);
+
+ XMLTest(html, html, printer.CStr());
+ }
+
+ {
// Evil memory leaks.
// If an XMLElement (etc) is allocated via NewElement() (etc.)
// and NOT added to the XMLDocument, what happens?