Merge pull request #125 from PKEuS/master

Added depth as constructor argument to XMLPrinter
This commit is contained in:
Lee Thomason 2013-08-05 13:04:27 -07:00
commit 03238517b3
2 changed files with 6 additions and 6 deletions

View File

@ -1729,11 +1729,11 @@ void XMLDocument::PrintError() const
}
XMLPrinter::XMLPrinter( FILE* file, bool compact ) :
XMLPrinter::XMLPrinter( FILE* file, bool compact, int depth ) :
_elementJustOpened( false ),
_firstElement( true ),
_fp( file ),
_depth( 0 ),
_depth( depth ),
_textDepth( -1 ),
_processEntities( true ),
_compactMode( compact )
@ -1858,6 +1858,8 @@ void XMLPrinter::OpenElement( const char* name )
if ( _textDepth < 0 && !_firstElement && !_compactMode ) {
Print( "\n" );
}
if ( !_compactMode ) {
PrintSpace( _depth );
}

View File

@ -126,11 +126,9 @@ class XMLDocument;
class XMLElement;
class XMLAttribute;
class XMLComment;
class XMLNode;
class XMLText;
class XMLDeclaration;
class XMLUnknown;
class XMLPrinter;
/*
@ -1885,7 +1883,7 @@ public:
If 'compact' is set to true, then output is created
with only required whitespace and newlines.
*/
XMLPrinter( FILE* file=0, bool compact = false );
XMLPrinter( FILE* file=0, bool compact = false, int depth = 0 );
~XMLPrinter() {}
/** If streaming, write the BOM and declaration. */