Function CloseElement

Synopsis

#include <tinyxml2.h>

void CloseElement(bool compactMode=false)

Description

If streaming, close the Element.

Mentioned in

Source

Lines 2752-2777 in tinyxml2.cpp. Line 2264 in tinyxml2.h.

void XMLPrinter::CloseElement( bool compactMode )
{
    --_depth;
    const char* name = _stack.Pop();

    if ( _elementJustOpened ) {
        Write( "/>" );
    }
    else {
        if ( _textDepth < 0 && !compactMode) {
            Putc( '\n' );
            PrintSpace( _depth );
        }
        Write ( "</" );
        Write ( name );
        Write ( ">" );
    }

    if ( _textDepth == _depth ) {
        _textDepth = -1;
    }
    if ( _depth == 0 && !compactMode) {
        Putc( '\n' );
    }
    _elementJustOpened = false;
}





Add Discussion as Guest

Log in