blob: 6090a79b9c19db99705b3b4671fe3a42c4d31faa [file] [log] [blame]
U-Lama\Leee13c3e62011-12-28 14:36:55 -08001#include "tinyxml2.h"
2
3#include <stdio.h>
4#include <stdlib.h>
5
6using namespace tinyxml2;
7
8int main( int argc, const char* argv )
9{
Lee Thomasonfde6a752012-01-14 18:08:12 -080010#if 0
U-Lama\Lee4cee6112011-12-31 14:58:18 -080011 {
12 static const char* test = "<!--hello world-->";
U-Lama\Leee13c3e62011-12-28 14:36:55 -080013
U-Lama\Lee4cee6112011-12-31 14:58:18 -080014 XMLDocument doc;
15 doc.Parse( test );
16 doc.Print( stdout );
17 }
U-Lama\Lee4cee6112011-12-31 14:58:18 -080018 {
Lee Thomasonfde6a752012-01-14 18:08:12 -080019 static const char* test = "<!--hello world\n"
Lee Thomason8a5dfee2012-01-18 17:43:40 -080020 " line 2\r"
21 " line 3\r\n"
22 " line 4\n\r"
23 " line 5\r-->";
24
25 XMLDocument doc;
26 doc.Parse( test );
27 doc.Print( stdout );
28 }
29#endif
30 {
Lee Thomason22aead12012-01-23 13:29:35 -080031 static const char* test[] = { //"<!--single element-->",
Lee Thomasonec975ce2012-01-23 11:42:06 -080032 "<element />",
33 "<element></element>",
Lee Thomason22aead12012-01-23 13:29:35 -080034 //"<!--single sub-element-->",
Lee Thomason6ee99fc2012-01-21 18:45:16 -080035 "<element><subelement/></element>",
Lee Thomasonec975ce2012-01-23 11:42:06 -080036 "<element><subelement></subelement></element>",
37 "<!--comment beside elements--><element><subelement></subelement></element>",
Lee Thomason22aead12012-01-23 13:29:35 -080038 "<!--comment beside elements, this time with spaces--> \n <element> <subelement> \n </subelement> </element>",
39 "<element attrib1='foo' attrib2=\"bar\" ></element>",
Lee Thomason5492a1c2012-01-23 15:32:10 -080040 "<element attrib1='foo' attrib2=\"bar\" ><subelement attrib3='yeehaa' /></element>",
41 "<element>Text inside element.</element>",
Lee Thomason67d61312012-01-24 16:01:51 -080042 "<element><b></b></element>",
43 "<element>Text inside and <b>bolded</b> in the element.</element>",
Lee Thomasondadcdfa2012-01-18 17:55:48 -080044 0
45 };
Lee Thomason6ee99fc2012-01-21 18:45:16 -080046 for( int i=0; test[i]; ++i ) {
Lee Thomasondadcdfa2012-01-18 17:55:48 -080047 XMLDocument doc;
Lee Thomason6ee99fc2012-01-21 18:45:16 -080048 doc.Parse( test[i] );
Lee Thomasondadcdfa2012-01-18 17:55:48 -080049 doc.Print( stdout );
Lee Thomasonec975ce2012-01-23 11:42:06 -080050 printf( "----------------------------------------------\n" );
Lee Thomasondadcdfa2012-01-18 17:55:48 -080051 }
U-Lama\Lee4cee6112011-12-31 14:58:18 -080052 }
U-Lama\Leee13c3e62011-12-28 14:36:55 -080053 return 0;
54}