U-Lama\Lee | e13c3e6 | 2011-12-28 14:36:55 -0800 | [diff] [blame] | 1 | #include "tinyxml2.h"
|
| 2 |
|
| 3 | #include <stdio.h>
|
| 4 | #include <stdlib.h>
|
| 5 |
|
| 6 | using namespace tinyxml2;
|
| 7 |
|
| 8 | int main( int argc, const char* argv )
|
| 9 | {
|
Lee Thomason | fde6a75 | 2012-01-14 18:08:12 -0800 | [diff] [blame] | 10 | #if 0
|
U-Lama\Lee | 4cee611 | 2011-12-31 14:58:18 -0800 | [diff] [blame] | 11 | {
|
| 12 | static const char* test = "<!--hello world-->";
|
U-Lama\Lee | e13c3e6 | 2011-12-28 14:36:55 -0800 | [diff] [blame] | 13 |
|
U-Lama\Lee | 4cee611 | 2011-12-31 14:58:18 -0800 | [diff] [blame] | 14 | XMLDocument doc;
|
| 15 | doc.Parse( test );
|
| 16 | doc.Print( stdout );
|
| 17 | }
|
U-Lama\Lee | 4cee611 | 2011-12-31 14:58:18 -0800 | [diff] [blame] | 18 | {
|
Lee Thomason | fde6a75 | 2012-01-14 18:08:12 -0800 | [diff] [blame] | 19 | static const char* test = "<!--hello world\n"
|
Lee Thomason | 8a5dfee | 2012-01-18 17:43:40 -0800 | [diff] [blame] | 20 | " 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 Thomason | 5cae897 | 2012-01-24 18:03:07 -0800 | [diff] [blame] | 31 | static const char* test[] = { //"<element />",
|
| 32 | //"<element></element>",
|
| 33 | //"<element><subelement/></element>",
|
| 34 | //"<element><subelement></subelement></element>",
|
| 35 | "<element><subelement><subsub/></subelement></element>",
|
Lee Thomason | ec975ce | 2012-01-23 11:42:06 -0800 | [diff] [blame] | 36 | "<!--comment beside elements--><element><subelement></subelement></element>",
|
Lee Thomason | 5cae897 | 2012-01-24 18:03:07 -0800 | [diff] [blame] | 37 | //"<!--comment beside elements, this time with spaces--> \n <element> <subelement> \n </subelement> </element>",
|
Lee Thomason | 22aead1 | 2012-01-23 13:29:35 -0800 | [diff] [blame] | 38 | "<element attrib1='foo' attrib2=\"bar\" ></element>",
|
Lee Thomason | 5492a1c | 2012-01-23 15:32:10 -0800 | [diff] [blame] | 39 | "<element attrib1='foo' attrib2=\"bar\" ><subelement attrib3='yeehaa' /></element>",
|
Lee Thomason | 5cae897 | 2012-01-24 18:03:07 -0800 | [diff] [blame] | 40 | //"<element>Text inside element.</element>",
|
| 41 | //"<element><b></b></element>",
|
Lee Thomason | 67d6131 | 2012-01-24 16:01:51 -0800 | [diff] [blame] | 42 | "<element>Text inside and <b>bolded</b> in the element.</element>",
|
Lee Thomason | 24767b0 | 2012-01-25 17:16:23 -0800 | [diff] [blame^] | 43 | "<outer><element>Text inside and <b>bolded</b> in the element.</element></outer>",
|
Lee Thomason | dadcdfa | 2012-01-18 17:55:48 -0800 | [diff] [blame] | 44 | 0
|
| 45 | };
|
Lee Thomason | 6ee99fc | 2012-01-21 18:45:16 -0800 | [diff] [blame] | 46 | for( int i=0; test[i]; ++i ) {
|
Lee Thomason | dadcdfa | 2012-01-18 17:55:48 -0800 | [diff] [blame] | 47 | XMLDocument doc;
|
Lee Thomason | 6ee99fc | 2012-01-21 18:45:16 -0800 | [diff] [blame] | 48 | doc.Parse( test[i] );
|
Lee Thomason | 5cae897 | 2012-01-24 18:03:07 -0800 | [diff] [blame] | 49 | doc.Print();
|
Lee Thomason | ec975ce | 2012-01-23 11:42:06 -0800 | [diff] [blame] | 50 | printf( "----------------------------------------------\n" );
|
Lee Thomason | dadcdfa | 2012-01-18 17:55:48 -0800 | [diff] [blame] | 51 | }
|
U-Lama\Lee | 4cee611 | 2011-12-31 14:58:18 -0800 | [diff] [blame] | 52 | }
|
U-Lama\Lee | e13c3e6 | 2011-12-28 14:36:55 -0800 | [diff] [blame] | 53 | return 0;
|
| 54 | } |