In TinyXmlv1 i can create a temp Xml Element then Parse document by
TiXmlDocument doc;
TiXmlElement * element = new TiXmlElement( "Hello" );
TiXmlText * text = new TiXmlText( "World" );
element->LinkEndChild( text );
doc.Parse("<TAGS></TAGS>"); // It OK
Now i want switch to TinyXmlv2 by following:
#include "tinyxml2.h"
using namespace tinyxml2;
int main(int argc, char* argv[])
{
tinyxml2::XMLDocument doc;
tinyxml2::XMLElement* newElm = doc.NewElement("Hello");
newElm->SetText("World");
doc.Parse("<TAGS></TAGS>"); // This will crash
return 0;
}
I cant understand why it crash.