TiXmlNodeA* TiXmlDocumentA::Clone() const { TiXmlDocumentA* clone = new TiXmlDocumentA(); if ( !clone ) return 0; CopyToClone( clone ); clone->error = error; clone->errorDesc = errorDesc.c_str (); for ( TiXmlNodeA* node = firstChild; node; node = node->NextSibling() ) { clone->LinkEndChild( node->Clone() ); } return clone; }
TiXmlNodeA* TiXmlElementA::Clone() const { TiXmlElementA* clone = new TiXmlElementA( Value() ); if ( !clone ) return 0; CopyToClone( clone ); // Clone the attributes, then clone the children. for(TiXmlAttributeA* attribute = attributeSet.First(); attribute; attribute = attribute->Next() ) { clone->SetAttribute( attribute->Name(), attribute->Value() ); } for ( TiXmlNodeA* node = firstChild; node; node = node->NextSibling() ) { clone->LinkEndChild( node->Clone() ); } return clone; }