Merge branch 'pernodecompactwhitespace'
* pernodecompactwhitespace: SetForceCompactMode() now also handles case of a single tag inside another correctly. Give tests a few more chances to fail, e.g. on tag sequences or attributes. Added SetForceCompactMode() for overriding the compact setting on a per-node level. All sub-nodes will be printed compact as well. Conflicts: xmltest.cpp
This commit is contained in:
10
tinyxml2.cpp
10
tinyxml2.cpp
@@ -2044,7 +2044,7 @@ void XMLPrinter::PushAttribute( const char* name, double v )
|
||||
}
|
||||
|
||||
|
||||
void XMLPrinter::CloseElement()
|
||||
void XMLPrinter::CloseElement( bool compactMode )
|
||||
{
|
||||
--_depth;
|
||||
const char* name = _stack.Pop();
|
||||
@@ -2053,7 +2053,7 @@ void XMLPrinter::CloseElement()
|
||||
Print( "/>" );
|
||||
}
|
||||
else {
|
||||
if ( _textDepth < 0 && !_compactMode) {
|
||||
if ( _textDepth < 0 && !compactMode) {
|
||||
Print( "\n" );
|
||||
PrintSpace( _depth );
|
||||
}
|
||||
@@ -2063,7 +2063,7 @@ void XMLPrinter::CloseElement()
|
||||
if ( _textDepth == _depth ) {
|
||||
_textDepth = -1;
|
||||
}
|
||||
if ( _depth == 0 && !_compactMode) {
|
||||
if ( _depth == 0 && !compactMode) {
|
||||
Print( "\n" );
|
||||
}
|
||||
_elementJustOpened = false;
|
||||
@@ -2197,9 +2197,9 @@ bool XMLPrinter::VisitEnter( const XMLElement& element, const XMLAttribute* attr
|
||||
}
|
||||
|
||||
|
||||
bool XMLPrinter::VisitExit( const XMLElement& )
|
||||
bool XMLPrinter::VisitExit( const XMLElement& element )
|
||||
{
|
||||
CloseElement();
|
||||
CloseElement( _compactMode ? true : element.GetForceCompactMode() );
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user