xmltest.cpp 893 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #include "tinyxml2.h"
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4. using namespace tinyxml2;
  5. int main( int argc, const char* argv )
  6. {
  7. #if 0
  8. {
  9. static const char* test = "<!--hello world-->";
  10. XMLDocument doc;
  11. doc.Parse( test );
  12. doc.Print( stdout );
  13. }
  14. {
  15. static const char* test = "<!--hello world\n"
  16. " line 2\r"
  17. " line 3\r\n"
  18. " line 4\n\r"
  19. " line 5\r-->";
  20. XMLDocument doc;
  21. doc.Parse( test );
  22. doc.Print( stdout );
  23. }
  24. #endif
  25. {
  26. static const char* test[] = { //"<element />",
  27. // "<element></element>",
  28. "<element><subelement/></element>",
  29. 0
  30. };
  31. for( int i=0; test[i]; ++i ) {
  32. XMLDocument doc;
  33. doc.Parse( test[i] );
  34. doc.Print( stdout );
  35. }
  36. }
  37. return 0;
  38. }