Added SetForceCompactMode() for overriding the compact setting on a per-node level. All sub-nodes will be printed compact as well.
diff --git a/tinyxml2.cpp b/tinyxml2.cpp
index 58a0e4f..fad9f50 100755
--- a/tinyxml2.cpp
+++ b/tinyxml2.cpp
@@ -581,7 +581,8 @@
     _parent( 0 ),

     _firstChild( 0 ), _lastChild( 0 ),

     _prev( 0 ), _next( 0 ),

-    _memPool( 0 )

+    _memPool( 0 ),

+	_forceCompactMode( false )

 {

 }

 

@@ -1981,17 +1982,17 @@
 }

 

 

-void XMLPrinter::OpenElement( const char* name )

+void XMLPrinter::OpenElement( const char* name, bool compactMode )

 {

     if ( _elementJustOpened ) {

         SealElement();

     }

     _stack.Push( name );

 

-    if ( _textDepth < 0 && !_firstElement && !_compactMode ) {

+    if ( _textDepth < 0 && !_firstElement && !compactMode ) {

         Print( "\n" );

     }

-    if ( !_compactMode ) {

+    if ( !compactMode ) {

         PrintSpace( _depth );

     }

 

@@ -2187,7 +2188,7 @@
 

 bool XMLPrinter::VisitEnter( const XMLElement& element, const XMLAttribute* attribute )

 {

-    OpenElement( element.Name() );

+    OpenElement( element.Name(), _compactMode ? true : element.Parent()->GetForceCompactMode() );

     while ( attribute ) {

         PushAttribute( attribute->Name(), attribute->Value() );

         attribute = attribute->Next();