mirror of https://github.com/AxioDL/tinyxml2.git
Issue299 - Allow Accept() to work with element trees that are not
linked in to the owning document.
This commit is contained in:
parent
32cca51ac5
commit
7e744771ad
|
@ -2297,7 +2297,11 @@ bool XMLPrinter::VisitEnter( const XMLDocument& doc )
|
||||||
|
|
||||||
bool XMLPrinter::VisitEnter( const XMLElement& element, const XMLAttribute* attribute )
|
bool XMLPrinter::VisitEnter( const XMLElement& element, const XMLAttribute* attribute )
|
||||||
{
|
{
|
||||||
const XMLElement* parentElem = element.Parent()->ToElement();
|
const XMLElement* parentElem = NULL;
|
||||||
|
if ( element.Parent() )
|
||||||
|
{
|
||||||
|
parentElem = element.Parent()->ToElement();
|
||||||
|
}
|
||||||
bool compactMode = parentElem ? CompactMode(*parentElem) : _compactMode;
|
bool compactMode = parentElem ? CompactMode(*parentElem) : _compactMode;
|
||||||
OpenElement( element.Name(), compactMode );
|
OpenElement( element.Name(), compactMode );
|
||||||
while ( attribute ) {
|
while ( attribute ) {
|
||||||
|
|
Loading…
Reference in New Issue