#include "tinyxml2.h" #include #include using namespace tinyxml2; int main( int argc, const char* argv ) { #if 0 { static const char* test = ""; XMLDocument doc; doc.Parse( test ); doc.Print( stdout ); } { static const char* test = ""; XMLDocument doc; doc.Parse( test ); doc.Print( stdout ); } #endif { static const char* test[] = { //"", //"", //"", //"", // "", //"", //" \n \n ", //"", //"", //"Text inside element.", //"", //"Text inside and bolded in the element.", //"Text inside and bolded in the element.", "This & That.", "", 0 }; for( int i=0; test[i]; ++i ) { XMLDocument doc; doc.Parse( test[i] ); doc.Print(); printf( "----------------------------------------------\n" ); } } { static const char* test = "Text before."; XMLDocument doc; doc.Parse( test ); XMLElement* root = doc.FirstChildElement(); XMLElement* newElement = doc.NewElement( "Subelement" ); root->InsertEndChild( newElement ); doc.Print(); } return 0; }