tinyxml2/xmltest.cpp

48 lines
1.2 KiB
C++
Raw Normal View History

2011-12-28 22:36:55 +00:00
#include "tinyxml2.h"
#include <stdio.h>
#include <stdlib.h>
using namespace tinyxml2;
int main( int argc, const char* argv )
{
2012-01-15 02:08:12 +00:00
#if 0
2011-12-31 22:58:18 +00:00
{
static const char* test = "<!--hello world-->";
2011-12-28 22:36:55 +00:00
2011-12-31 22:58:18 +00:00
XMLDocument doc;
doc.Parse( test );
doc.Print( stdout );
}
{
2012-01-15 02:08:12 +00:00
static const char* test = "<!--hello world\n"
2012-01-19 01:43:40 +00:00
" line 2\r"
" line 3\r\n"
" line 4\n\r"
" line 5\r-->";
XMLDocument doc;
doc.Parse( test );
doc.Print( stdout );
}
#endif
{
2012-01-23 19:42:06 +00:00
static const char* test[] = { "<!--single element-->",
"<element />",
"<element></element>",
"<!--single sub-element-->",
2012-01-22 02:45:16 +00:00
"<element><subelement/></element>",
2012-01-23 19:42:06 +00:00
"<element><subelement></subelement></element>",
"<!--comment beside elements--><element><subelement></subelement></element>",
2012-01-19 01:55:48 +00:00
0
};
2012-01-22 02:45:16 +00:00
for( int i=0; test[i]; ++i ) {
2012-01-19 01:55:48 +00:00
XMLDocument doc;
2012-01-22 02:45:16 +00:00
doc.Parse( test[i] );
2012-01-19 01:55:48 +00:00
doc.Print( stdout );
2012-01-23 19:42:06 +00:00
printf( "----------------------------------------------\n" );
2012-01-19 01:55:48 +00:00
}
2011-12-31 22:58:18 +00:00
}
2011-12-28 22:36:55 +00:00
return 0;
}