165 Commits

Author SHA1 Message Date
Lee Thomason
686ef404b8 improve setversion script. set version 2.0.1 2014-03-16 10:16:49 -07:00
Lee Thomason
e7eb7d3327 Merge remote-tracking branch 'github/master' 2014-03-15 15:01:18 -07:00
Lee Thomason
5938e6f8a4 improving setversion.py 2014-03-15 15:00:54 -07:00
Lee Thomason
85afe9c5c7 setting version consistent with new guidelines. (not tagging...yet). 2014-02-23 21:42:16 -08:00
Lee Thomason
6324acd9f9 Merge branch 'uliwitness-overridecompactmode' 2014-02-23 21:08:22 -08:00
Lee Thomason
f4a8fbbdf7 minor edit 2014-02-22 17:04:53 -08:00
Lee Thomason
e693488742 fix compilation warning. 2014-02-22 16:27:27 -08:00
Uli Kusterer
613410095c Provide finer control over indentation inside the XMLPrinter. You'll have to subclass it to override its standard behaviour by overwriting CompactMode(). 2014-02-22 17:19:08 +01:00
Lee Thomason
5f88e72691 fix the build script. set the build properly 2014-02-21 22:57:38 -08:00
Lee Thomason
7de26f7dc7 Merge remote-tracking branch 'origin/master' 2014-02-21 22:47:21 -08:00
Lee Thomason
82d3200571 clean up some error checking logic 2014-02-21 22:47:18 -08:00
Lee Thomason
c18eb23326 spelling fixes and make PrintSpace() virtual and protected. 2014-02-21 17:31:17 -08:00
Uli Kusterer
5d1d27e88b Keep indentation control fully inside the XMLPrinter. You'll have to subclass it to override its standard behaviour by overwriting CompactMode(). 2014-02-20 11:50:22 +01:00
Uli Kusterer
07ac762b80 SetBoolFirstChild now makes sure its bool is not wrapped onto its own line. 2014-02-01 15:06:50 +01:00
Uli Kusterer
b85b4e0a60 Merge branch 'pernodecompactwhitespace'
* pernodecompactwhitespace:
  SetForceCompactMode() now also handles case of a single tag inside another correctly.
  Give tests a few more chances to fail, e.g. on tag sequences or attributes.
  Added SetForceCompactMode() for overriding the compact setting on a per-node level. All sub-nodes will be printed compact as well.

Conflicts:
	xmltest.cpp
2014-02-01 13:38:04 +01:00
Uli Kusterer
ca412e87f2 SetForceCompactMode() now also handles case of a single tag inside another correctly. 2014-02-01 13:35:05 +01:00
Uli Kusterer
15354f88c3 Give tests a few more chances to fail, e.g. on tag sequences or attributes. 2014-02-01 13:06:39 +01:00
Uli Kusterer
d5c9e8b81d Added SetForceCompactMode() for overriding the compact setting on a per-node level. All sub-nodes will be printed compact as well. 2014-02-01 12:57:57 +01:00
Uli Kusterer
593a33d061 Added SetForceCompactMode() for overriding the compact setting on a per-node level. All sub-nodes will be printed compact as well. 2014-02-01 12:48:51 +01:00
Uli Kusterer
53fe47c74e Remove long long stuff again. 2014-01-27 01:47:30 +01:00
Uli Kusterer
35ce309f73 Urk, forgot to build this one after merging and goofed a bit. 2014-01-25 03:37:16 +01:00
Uli Kusterer
2861a7e63a Merge branch 'master' of https://github.com/leethomason/tinyxml2
Conflicts:
	tinyxml2.cpp
	xmltest.cpp
2014-01-25 03:12:21 +01:00
Lee Thomason
5bb2d8079b add variants of SetText() to support types 2014-01-24 10:42:57 -08:00
Lee Thomason
9c0678a01d trim the test cases and review 2014-01-24 10:18:27 -08:00
Uli Kusterer
321072ee0b Add tests for SetText(). 2014-01-22 04:55:19 +01:00
Uli Kusterer
664d05662e Support for 'long long' number values. 2014-01-21 12:24:47 +01:00
Uli Kusterer
4cd1f269c2 Added IntText(), UnsignedText(), DoubleText() and FloatText() convenience wrappers. 2014-01-21 02:54:36 +01:00
Uli Kusterer
ff8e2041dd To bring BoolFirstChild() more in line with the other methods, reimplemented it in terms of a new QueryBoolFirstChild(). 2014-01-21 02:53:47 +01:00
Uli Kusterer
4af5573f42 Tests for SetBoolFirstChild and BoolFirstChild. 2014-01-21 02:36:47 +01:00
Uli Kusterer
c1c20bb196 Bools should really be implemented as self-closing <true /> and <false /> tags, not as 0/1 inside a tag, so removing those SetText variants again, in favor of SetBoolFirstChild() and BoolFirstChild() methods. 2014-01-21 02:23:20 +01:00
Uli Kusterer
7411c08e90 Add tests for SetText(). 2014-01-21 01:57:38 +01:00
Uli Kusterer
dcefa0e43f Add typed convenience setters for SetText(). 2014-01-21 01:36:41 +01:00
Uli Kusterer
869bb599c1 Make SetText() behave like the docs say. 2014-01-21 01:36:16 +01:00
Uli Kusterer
85fff5e50a Add comment for SetText(). 2014-01-21 01:35:30 +01:00
Uli Kusterer
8fe342a872 Add SetText() as analog to GetText(). 2014-01-21 01:12:47 +01:00
Lee Thomason
44ce7930b7 Merge branch 'master' of https://github.com/leethomason/tinyxml2 2014-01-14 12:30:18 -08:00
Lee Thomason
c3708ccf08 implement a fix to floating point precision as proposed by schuellc. 2014-01-14 12:30:03 -08:00
Lee Thomason
2ece2f1690 Merge pull request #150 from danmar/master
Fixed issue 147 (XMLDocument::LoadFile() may crash on non-regular file)
2014-01-10 13:35:19 -08:00
Daniel Marjamäki
ba4b328b3d Fixed issue 147 (XMLDocument::LoadFile() may crash on non-regular file) 2014-01-10 21:37:27 +01:00
Lee Thomason
343a5ff3bd Merge pull request #144 from sopvop/patch-1
add TINYXML2_EXPORT define when building shared lib
2013-12-12 13:47:11 -08:00
Leonid Onokhov
3dacebf8ee add TINYXML2_EXPORT define when building shared lib
otherwise it exports no symbols and msvc does not create import .lib
2013-12-12 15:07:34 +03:00
Lee Thomason
61871d60a6 Fix up the readme, add attribution for the logo. 2013-12-05 11:44:38 -08:00
Lee Thomason
ce0510ba2d rename Reset to Clear to be consistent with XMLDocument 2013-11-26 21:29:37 -08:00
Reinhard Klambauer
3bc3d4e24c Added a method to reset the memory buffer to the XMLPrinter class.
This enables to reset the printer memory to start again from the beginning.
2013-11-22 14:05:21 +01:00
Reinhard Klambauer
4e74b13e7a Added a method to reset the memory buffer of the DynArray class.
The the allocated memory will not be touched so the capacity keeps its current level.
2013-11-22 14:01:58 +01:00
Lee Thomason
370761b179 Merge pull request #140 from ledyba/check_data_len
you have to check len before accsessing "p".
2013-11-05 10:52:04 -08:00
psi
690ba07bda you have to check len before accsessing "p". 2013-11-03 10:54:33 +09:00
Lee Thomason
e1979a883b Merge pull request #139 from dennisjenkins75/master
Grammar error: there -> their.
2013-10-26 21:53:16 -07:00
Lee Thomason
5613cb9237 up the version 2013-10-26 21:52:35 -07:00
Lee Thomason
3b7927efb5 formatting tweaks 2013-10-26 21:50:46 -07:00
Dennis Jenkins
68a1c93e2e Grammar error: there -> their. 2013-10-25 23:01:34 -05:00
Michael Daumling
ed52328ced Insert() methods check for inserted XML to be in the same doc, and remove XML from old location if already inserted. 2013-10-23 07:47:29 +02:00
Lee Thomason
ab42b16bac Merge pull request #136 from FreakC/master
Issue #134
2013-10-22 11:36:29 -07:00
Michael Daumling
2162688ad3 Issue #134: Change 3 methods to not being inlined. They reference the StrPair class, which is not exported, thus creating linker problems with tinyxml2 in a DLL. 2013-10-22 17:03:37 +02:00
Lee Thomason
927fe73c5b Merge pull request #133 from dennisjenkins75/master
Small demo program to generate HTML5 via sub-classed tinyxml2::XMLPrinter
2013-10-16 13:59:10 -07:00
Dennis Jenkins
d31021392a Changed indentation style to match tinyxml2 project. 2013-10-11 16:59:49 -05:00
Dennis Jenkins
bc785155f2 Changed indentation style to match tinyxml2 project. 2013-10-11 16:55:14 -05:00
Dennis Jenkins
9460e5093c Demo/example/contrib of using tinyxml2 to generate confomant HTML5. 2013-10-11 16:48:55 -05:00
Lee Thomason
44ba601c5f Merge pull request #131 from dennisjenkins75/master
Minor tweaks to C++ encapsulation necessary to subclass XMLPrinter sufficiently to create XMLPrinterHTML5
2013-10-10 22:10:29 -07:00
Dennis Jenkins
59c75d3322 Added method DynArray::PeekTop(), provides useful abstraction in tinyxml2::XMLPrinterHTML5::CloseElement(). Made tinyxml2::CloseElement() and destructor virtual. Made tinyxml2::_SealElement(), _elementJustOpened and _stack all protected instead of private (needed in XMLPrinterHTML5 to selective prevent some elements from being self-closing). 2013-10-08 13:10:07 -05:00
Lee Thomason
74a81cf1d9 minor readme update 2013-09-12 23:59:43 -07:00
Lee Thomason
1f83145cb4 Merge branch 'master' of github.com:leethomason/tinyxml2 2013-09-12 23:53:47 -07:00
Lee Thomason
1688114e55 add logo 2013-09-12 23:53:08 -07:00
Lee Thomason
03238517b3 Merge pull request #125 from PKEuS/master
Added depth as constructor argument to XMLPrinter
2013-08-05 13:04:27 -07:00
PKEuS
1bfb95488f Added depth as constructor argument to XMLPrinter. This way, XML files that are not written with XMLDocument can be properly indented.
Removed unused forward declaration
2013-08-04 14:04:09 +02:00
Lee Thomason (grinliz)
db304256bb clean up the pass/fail logic, still return the same value from test if it fails 2013-07-31 12:24:52 -07:00
Lee Thomason
70d343f513 Merge pull request #124 from diasbruno/makefile-test
added test rule.
2013-07-31 12:21:42 -07:00
Lee Thomason
8b482728ef Merge pull request #123 from diasbruno/xmltest-return
xmltest: if one of the tests has failed, return > 0.
2013-07-31 12:21:25 -07:00
Lee Thomason
9c1ef1d4a3 Merge pull request #120 from PKEuS/master
Added support for building TinyXML into a .dll or .lib
2013-07-31 12:15:53 -07:00
Bruno Dias
032aa1b96c added test rule. 2013-07-31 12:01:12 -03:00
Bruno Dias
721b42da8e make the xmltest to return != 0, if one of the tests has failed. 2013-07-31 11:50:44 -03:00
PKEuS
95060350bd Removed dllexport/import attribute from private class, disable related warning C4251 2013-07-26 10:42:44 +02:00
PKEuS
0c55c70b11 Improved output paths in VS solution 2013-07-12 21:16:33 +02:00
PKEuS
16ed47dc14 Added support for building TinyXML as a .lib or .dll 2013-07-12 21:16:33 +02:00
Lee Thomason
1c9250cab5 Merge pull request #119 from PKEuS/master
Improved VS solution; fixed cppcheck messages
2013-07-07 17:37:22 -07:00
PKEuS
1c5f99e37c Fixed two cppcheck messages 2013-07-06 11:28:39 +02:00
PKEuS
632c57217c Improved VS solution: Added x64 configuration, enabled optimizations 2013-07-06 11:28:16 +02:00
Lee Thomason
392bcd2485 Merge pull request #114 from Vasily-Biryukov/doc
Small fixes in documentation
2013-05-20 13:00:15 -07:00
Vasily Biryukov
9a975b7bdb Small fixes in documentation 2013-05-19 17:01:05 +06:00
Lee Thomason
def0d2131a Merge pull request #112 from gupascal/master
Add a Code::Blocks project
2013-05-12 20:52:52 -07:00
Lee Thomason
6db1321100 Merge pull request #111 from pzychotic/master
Initialize pointers in constructor
2013-05-12 20:51:08 -07:00
Guillaume P
d60fe35073 Add a Code::Blocks project. 2013-05-12 15:11:37 +02:00
Thomas Roß
6189231187 Initialize pointers to satisfy static code analyser. 2013-05-12 14:07:38 +02:00
Lee Thomason (grinliz)
d6bd7360b8 fix floating point specifier and clean up a warning 2013-05-11 20:23:13 -07:00
Lee Thomason
f76fe94012 Merge pull request #110 from pzychotic/tests
Small test addition and fix
2013-05-11 20:11:55 -07:00
Lee Thomason
6a0db4f7e6 Merge pull request #109 from pzychotic/master
Fixed compiler warning for x64 build
2013-05-11 20:10:59 -07:00
Lee Thomason
576003627c Merge pull request #108 from ddiproietto/patch-1
Fixed compilation under MINGW64
2013-05-11 20:08:23 -07:00
Thomas Roß
a5221869c2 Added test for return value of QueryDoubleAttribute(). 2013-05-11 10:22:12 +02:00
Thomas Roß
36307f86da Fixed test input file not found when doing out-of-source builds. 2013-05-11 10:21:07 +02:00
Thomas Roß
1470edc595 Fixed compiler warning for x64 builds. 2013-05-10 15:44:12 +02:00
ddiproietto
a8ae1f6a4d Fixed compilation under MINGW64
Necessary on mingw64 2.22
2013-05-05 18:42:52 +03:00
Lee Thomason (grinliz)
d0a38c3a20 fix BOM preservation bugs. add new tests 2013-04-29 09:15:37 -07:00
Lee Thomason (grinliz)
1377fe7ec0 Merge branch 'master' of github.com:leethomason/tinyxml2 2013-04-20 15:11:42 -07:00
Lee Thomason
761c4c2ed5 Merge pull request #104 from Vasily-Biryukov/master
LoadFile() returns XML_NO_ERROR for empty documents
2013-04-20 15:11:24 -07:00
Lee Thomason (grinliz)
6faf169695 Merge branch 'master' of github.com:leethomason/tinyxml2 2013-04-20 14:58:12 -07:00
Lee Thomason (grinliz)
43229f91d4 whitespace 2013-04-20 14:57:59 -07:00
Vasily Biryukov
1cfafd0d24 Fixed: LoadFile() returns XML_NO_ERROR for empty documents. 2013-04-20 14:12:33 +06:00
Lee Thomason
c510a8c76e Merge pull request #100 from selfpoised/master
minor change: from " *end != 0 => *_end != 0"
2013-03-13 12:58:37 -07:00
selfpoised
4dd59bcdf4 Update tinyxml2.h
*end != 0 => *_end != 0
2013-03-13 16:54:15 +08:00
selfpoised
e77e19553d Update tinyxml2.h
format spaces
2013-03-13 14:08:29 +08:00
Lee Thomason
5a695f0e0c Merge pull request #99 from acmyo/typos
correct typos in comments / documentation
2013-03-09 20:40:55 -08:00
Andrew C. Martin
0fd8746f64 correct typos in comments / documentation 2013-03-09 20:09:45 -07:00
Lee Thomason (grinliz)
374c25e2a6 up the version to build 11 2013-02-01 19:45:01 -08:00
Lee Thomason (grinliz)
5efaa5f6bb Add the (very handy) QueryAttribute 2013-02-01 19:26:30 -08:00
Lee Thomason (grinliz)
61cea67517 removing debug output 2013-02-01 19:13:13 -08:00
Lee Thomason (grinliz)
ac83b4e278 adjust the size of the memory pools 2013-02-01 09:02:34 -08:00
Lee Thomason
c97ded4872 Merge pull request #98 from martinsh-shaiters/devel
Implementation & unit test for enhancement described in issue #74
2013-01-30 10:05:29 -08:00
Martinsh Shaiters
53ab79afad Add unit test for XMLDocument::Clear(). 2013-01-30 11:22:19 +02:00
Martinsh Shaiters
a9d42b0dd3 Replace InitDocument() with Clear() and make it part of the API. 2013-01-30 11:19:39 +02:00
Lee Thomason
8afdb09aa4 Merge pull request #97 from marek5335/master
Fix CMakeLists.txt for windows
2013-01-28 11:09:56 -08:00
Marek Pokorny
8e66b77c91 Fixed CMake config file to properly install on windows 2013-01-28 10:52:01 -08:00
Lee Thomason
86ca9dc1ee correctly set version via script 2013-01-28 07:31:59 -08:00
Lee Thomason
63339bcd7d up the version 2013-01-28 07:28:46 -08:00
Lee Thomason
0aecb5c770 Merge remote-tracking branch 'martinsh/issue#53-fix' 2013-01-28 07:23:19 -08:00
Martinsh Shaiters
95b3e6543b Add test case for element names with leading digit. 2013-01-26 23:08:10 +02:00
Martinsh Shaiters
c6d02f48d5 Implement new utility functions for testing validity of name and token characters. 2013-01-26 22:43:54 +02:00
Martinsh Shaiters
23e7ae6085 Add test for lead non-alpha characters in attribute names. 2013-01-26 20:15:44 +02:00
Lee Thomason
178e4ccd5b Add file load to xmltest. 2013-01-25 16:19:05 -08:00
Lee Thomason
980e535aae Merge pull request #91 from martinsh-shaiters/doxyfix
Example documentation moved to xmltest.cpp
2013-01-15 16:33:10 -08:00
Martinsh Shaiters
c9c8b77d87 Moves example documentation from xmltest.h to xmltest.cpp 2013-01-16 02:08:19 +02:00
Martinsh Shaiters
bbad12a922 Sets readme.md to be used as MainPage for generated documentation 2013-01-16 01:55:39 +02:00
Martinsh Shaiters
4504aab21d Upgrades dox to Doxyfile version 1.8.3
Upgrade removes deprecated options HTML_ALIGN_MEMBERS, SHOW_DIRECTORIES and USE_INLINE_TREES. These are deprecated since Doxygen release 1.8.1 (2012-05-09) [http://www.stack.nl/~dimitri/doxygen/changelog.html#1.8.1].
2013-01-16 00:54:58 +02:00
Lee Thomason
dfc494ffc5 Merge pull request #90 from martinsh-shaiters/mingw
Adds conditional include of io.h when compiling with MinGW
2013-01-15 13:47:59 -08:00
Lee Thomason
267d4d8f8e Merge pull request #88 from martinsh-shaiters/doxy
Eliminate warning about missing readme.txt, use readme.md
2013-01-15 13:47:14 -08:00
Martinsh Shaiters
39ddc268cb Adds conditional include of io.h when compiling with MinGW 2013-01-15 21:53:08 +02:00
Martinsh Shaiters
3acf157857 Eliminate warning about missing readme.txt, use readme.md 2013-01-15 06:20:22 +02:00
Lee Thomason
9352408301 Merge pull request #87 from MortenMacFly/master
Eliminate warnings with GCC/MinGW (Issue #83)
2013-01-14 11:10:43 -08:00
MortenMacFly
4ee49f1690 Eliminate warnings with GCC/MinGW 2013-01-14 20:03:14 +01:00
Lee Thomason
f563fa1a29 Merge pull request #85 from kainjow/master
Fixed some minor issues in the read me
2013-01-09 09:43:11 -08:00
Kevin Wojniak
273f7b4cf8 Fixed wrongly encoded apostrophe. Fixed typo. 2013-01-09 09:21:13 -08:00
Lee Thomason (grinliz)
15408a952d VS2010 Express solution files mangeled. Move to subdirectory and recreate 2013-01-08 08:46:50 -08:00
Lee Thomason
ec3454bafc Merge pull request #84 from Jerome7573/master
Reverting std lib is in std:: namespace and using .h versions instead
2013-01-07 15:07:23 -08:00
Jerome Martinez
242c3eaa33 Reverting std lib is in std:: namespace and using .h versions instead 2013-01-06 12:20:04 +01:00
Lee Thomason
a6412ac2d5 add a printing test 2012-12-13 15:39:11 -08:00
Lee Thomason
5b0a677712 fix incorrect assert on unused memory 2012-11-19 13:54:42 -08:00
Lee Thomason
998116e587 up the version 2012-11-12 13:04:56 -08:00
Lee Thomason
685b895172 trivial comment fix 2012-11-12 13:00:06 -08:00
Lee Thomason
8950b37aa0 Merge branch 'master' of https://github.com/leethomason/tinyxml2 2012-11-12 12:59:25 -08:00
Lee Thomason
248e523dad Merge pull request #80 from kainjow/master
Fix MSXML conflict
2012-11-12 12:59:18 -08:00
Lee Thomason
2fa8172236 type XMLError. fix some comments 2012-11-09 12:37:46 -08:00
Kevin Wojniak
04c22d250a Enclose code in namespace instead of 'using namespace' to resolve conflict on Windows with MSXML. Fixes issue #37. 2012-11-08 11:02:22 -08:00
Lee Thomason
67abded7f7 Merge branch 'master' of https://github.com/leethomason/tinyxml2 2012-10-25 16:12:48 -07:00
Lee Thomason
687f90e843 Merge pull request #76 from Jerome7573/master
Moved COUNT from private to public,
2012-10-24 10:20:38 -07:00
Lee Thomason
ae9ab0741e test case for unlinked nodes, commented out 2012-10-24 10:17:53 -07:00
Jerome Martinez
7921df1b47 Moved COUNT from private to public 2012-10-24 11:45:44 +02:00
Lee Thomason (grinliz)
856da21652 fix duplicated COUNT logic 2012-10-19 09:08:15 -07:00
Jerome Martinez
7fbefab95d std lib is in std:: namespace only and array definition is not possible with an enum 2012-10-19 11:30:33 +02:00
Lee Thomason
1aa8fc4a1e fix up rename on windows 2012-10-13 20:01:30 -07:00
Lee Thomason
624d43fc05 finish switching to _ for member vars 2012-10-12 10:58:48 -07:00
Lee Thomason
ed5c879dfe switch StrPair() over to _ for member vars 2012-10-12 10:09:48 -07:00
Lee Thomason
120b3a62be switch StrPair() over to _ for member vars 2012-10-12 10:06:59 -07:00
Lee Thomason
a9cf3f9f3f Switched to Artistic Style auto-formatting to allow integration of patches from other coding styles. 2012-10-11 16:56:51 -07:00
Lee Thomason
3572ae0308 Merge pull request #69 from sniperbat/master
just remove a compile warning :)
2012-10-11 09:48:06 -07:00
sniperbat
a5716b787a nothing but just remove compile warning 2012-10-11 15:22:28 +08:00
Lee Thomason
3cd66ee850 fix a fopen bug: rb should be w 2012-09-25 13:22:41 -07:00
Lee Thomason (grinliz)
99024dc20b Merge branch 'master' of github.com:leethomason/tinyxml2 2012-09-23 20:26:12 -07:00
Lee Thomason (grinliz)
fc6320e30a experimented with print f vs. g. increased version 2012-09-23 20:25:50 -07:00
Lee Thomason
ac8e0ce21c only turn off deprecated warnings for test file 2012-09-23 14:06:43 -07:00
Thomas Roß
0922b7389f Replaced pragmas with compiler define. 2012-09-23 16:31:22 +02:00
Lee Thomason (grinliz)
e2bcb32494 accept a nBytes argument for Parse() 2012-09-17 17:58:25 -07:00
Lee Thomason (grinliz)
2f1f6247e0 remove trailing spaces 2012-09-16 11:32:34 -07:00
Lee Thomason (grinliz)
6da5410110 changes for martell to clean up fopen 2012-09-09 22:05:49 -07:00
Lee Thomason (grinliz)
79869e77f9 changes for martell to clean up fopen 2012-09-09 22:04:52 -07:00
Lee Thomason (grinliz)
9b6011c478 working out whitespace notes 2012-09-09 19:12:06 -07:00
Martell
186476c665 Shut up visual studio 2012-09-06 16:41:46 +01:00
21 changed files with 4501 additions and 2684 deletions

4
.gitignore vendored
View File

@@ -3,7 +3,11 @@ Win32/
x64/
ipch/
resources/out/
tinyxml2/tinyxml2-cbp/bin/
tinyxml2/tinyxml2-cbp/obj/
*.sdf
*.suo
*.opensdf
*.user
*.depend
*.layout

View File

@@ -10,8 +10,8 @@ include(GNUInstallDirs)
################################
# set lib version here
set(GENERIC_LIB_VERSION "1.0.7")
set(GENERIC_LIB_SOVERSION "1")
set(GENERIC_LIB_VERSION "2.0.1")
set(GENERIC_LIB_SOVERSION "2")
################################
@@ -32,6 +32,7 @@ else(${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_BINARY_DIR})
add_custom_target(
${TARGET_DATA_COPY}
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/resources/dream.xml ${CMAKE_CURRENT_BINARY_DIR}/resources/
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/resources/empty.xml ${CMAKE_CURRENT_BINARY_DIR}/resources/
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/resources/utf8test.xml ${CMAKE_CURRENT_BINARY_DIR}/resources/
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/resources/utf8testverify.xml ${CMAKE_CURRENT_BINARY_DIR}/resources/)
endif(${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_BINARY_DIR})
@@ -52,6 +53,7 @@ if(BUILD_STATIC_LIBS)
endif(BUILD_STATIC_LIBS)
add_library(tinyxml2 SHARED tinyxml2.cpp tinyxml2.h)
set_target_properties(tinyxml2 PROPERTIES
COMPILE_DEFINITIONS "TINYXML2_EXPORT"
VERSION "${GENERIC_LIB_VERSION}"
SOVERSION "${GENERIC_LIB_SOVERSION}")
@@ -63,10 +65,12 @@ target_link_libraries(test tinyxml2)
if(BUILD_STATIC_LIBS)
install(TARGETS tinyxml2 tinyxml2static
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
else(BUILD_STATIC_LIBS)
install(TARGETS tinyxml2
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif(BUILD_STATIC_LIBS)
install(FILES tinyxml2.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})

View File

@@ -1,4 +1,6 @@
all: xmltest
xmltest: xmltest.cpp tinyxml2.cpp tinyxml2.h
test: clean xmltest
./xmltest
clean:
rm -f *.o xmltest

BIN
TinyXML2_small.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 326 KiB

108
contrib/html5-printer.cpp Normal file
View File

@@ -0,0 +1,108 @@
// g++ -Wall -O2 contrib/html5-printer.cpp -o html5-printer -ltinyxml2
// This program demonstrates how to use "tinyxml2" to generate conformant HTML5
// by deriving from the "tinyxml2::XMLPrinter" class.
// http://dev.w3.org/html5/markup/syntax.html
// In HTML5, there are 16 so-called "void" elements. "void elements" NEVER have
// inner content (but they MAY have attributes), and are assumed to be self-closing.
// An example of a self-closig HTML5 element is "<br/>" (line break)
// All other elements are called "non-void" and MUST never self-close.
// Examples: "<div class='lolcats'></div>".
// tinyxml2::XMLPrinter will emit _ALL_ XML elements with no inner content as
// self-closing. This behavior produces space-effeceint XML, but incorrect HTML5.
// Author: Dennis Jenkins, dennis (dot) jenkins (dot) 75 (at) gmail (dot) com.
// License: Same as tinyxml2 (zlib, see below)
// This example is a small contribution to the world! Enjoy it!
/*
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any
damages arising from the use of this software.
Permission is granted to anyone to use this software for any
purpose, including commercial applications, and to alter it and
redistribute it freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must
not claim that you wrote the original software. If you use this
software in a product, an acknowledgment in the product documentation
would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and
must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source
distribution.
*/
#include <tinyxml2.h>
#include <iostream>
#if defined (_MSC_VER)
#define strcasecmp stricmp
#endif
using namespace tinyxml2;
// Contrived input containing a mix of void and non-void HTML5 elements.
// When printed via XMLPrinter, some non-void elements will self-close (not valid HTML5).
static const char input[] =
"<html><body><p style='a'></p><br/>&copy;<col a='1' b='2'/><div a='1'></div></body></html>";
// XMLPrinterHTML5 is small enough, just put the entire implementation inline.
class XMLPrinterHTML5 : public XMLPrinter
{
public:
XMLPrinterHTML5 (FILE* file=0, bool compact = false, int depth = 0) :
XMLPrinter (file, compact, depth)
{}
protected:
virtual void CloseElement () {
if (_elementJustOpened && !isVoidElement (_stack.PeekTop())) {
SealElement();
}
XMLPrinter::CloseElement();
}
virtual bool isVoidElement (const char *name) {
// Complete list of all HTML5 "void elements",
// http://dev.w3.org/html5/markup/syntax.html
static const char *list[] = {
"area", "base", "br", "col", "command", "embed", "hr", "img",
"input", "keygen", "link", "meta", "param", "source", "track", "wbr",
NULL
};
// I could use 'bsearch', but I don't have MSVC to test on (it would work with gcc/libc).
for (const char **p = list; *p; ++p) {
if (!strcasecmp (name, *p)) {
return true;
}
}
return false;
}
};
int main (void) {
XMLDocument doc (false);
doc.Parse (input);
std::cout << "INPUT:\n" << input << "\n\n";
XMLPrinter prn (NULL, true);
doc.Print (&prn);
std::cout << "XMLPrinter (not valid HTML5):\n" << prn.CStr() << "\n\n";
XMLPrinterHTML5 html5 (NULL, true);
doc.Print (&html5);
std::cout << "XMLPrinterHTML5:\n" << html5.CStr() << "\n";
return 0;
}

176
dox
View File

@@ -1,4 +1,4 @@
# Doxyfile 1.8.0
# Doxyfile 1.8.3
# This file describes the settings to be used by the documentation system
# doxygen (www.doxygen.org) for a project.
@@ -32,7 +32,7 @@ PROJECT_NAME = "TinyXML-2"
# This could be handy for archiving the generated documentation or
# if some version control system is used.
PROJECT_NUMBER = 1.0.7
PROJECT_NUMBER = 2.0.1
# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer
@@ -126,7 +126,9 @@ FULL_PATH_NAMES = YES
# only done if one of the specified strings matches the left-hand part of
# the path. The tag can be used to show relative paths in the file list.
# If left blank the directory from which doxygen is run is used as the
# path to strip.
# path to strip. Note that you specify absolute paths here, but also
# relative paths, which will be relative from the directory where doxygen is
# started.
STRIP_FROM_PATH =
@@ -229,14 +231,15 @@ OPTIMIZE_FOR_FORTRAN = NO
OPTIMIZE_OUTPUT_VHDL = NO
# Doxygen selects the parser to use depending on the extension of the files it
# parses. With this tag you can assign which parser to use for a given extension.
# Doxygen has a built-in mapping, but you can override or extend it using this
# tag. The format is ext=language, where ext is a file extension, and language
# is one of the parsers supported by doxygen: IDL, Java, Javascript, CSharp, C,
# C++, D, PHP, Objective-C, Python, Fortran, VHDL, C, C++. For instance to make
# doxygen treat .inc files as Fortran files (default is PHP), and .f files as C
# (default is Fortran), use: inc=Fortran f=C. Note that for custom extensions
# you also need to set FILE_PATTERNS otherwise the files are not read by doxygen.
# parses. With this tag you can assign which parser to use for a given
# extension. Doxygen has a built-in mapping, but you can override or extend it
# using this tag. The format is ext=language, where ext is a file extension,
# and language is one of the parsers supported by doxygen: IDL, Java,
# Javascript, CSharp, C, C++, D, PHP, Objective-C, Python, Fortran, VHDL, C,
# C++. For instance to make doxygen treat .inc files as Fortran files (default
# is PHP), and .f files as C (default is Fortran), use: inc=Fortran f=C. Note
# that for custom extensions you also need to set FILE_PATTERNS otherwise the
# files are not read by doxygen.
EXTENSION_MAPPING =
@@ -249,6 +252,13 @@ EXTENSION_MAPPING =
MARKDOWN_SUPPORT = YES
# When enabled doxygen tries to link words that correspond to documented classes,
# or namespaces to their corresponding documentation. Such a link can be
# prevented in individual cases by by putting a % sign in front of the word or
# globally by setting AUTOLINK_SUPPORT to NO.
AUTOLINK_SUPPORT = YES
# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
# to include (a tag file for) the STL sources as input, then you should
# set this tag to YES in order to let doxygen match functions declarations and
@@ -269,10 +279,10 @@ CPP_CLI_SUPPORT = NO
SIP_SUPPORT = NO
# For Microsoft's IDL there are propget and propput attributes to indicate getter
# and setter methods for a property. Setting this option to YES (the default)
# will make doxygen replace the get and set methods by a property in the
# documentation. This will only work if the methods are indeed getting or
# For Microsoft's IDL there are propget and propput attributes to indicate
# getter and setter methods for a property. Setting this option to YES (the
# default) will make doxygen replace the get and set methods by a property in
# the documentation. This will only work if the methods are indeed getting or
# setting a simple type. If this is not the case, or you want to show the
# methods anyway, you should set this option to NO.
@@ -362,7 +372,8 @@ EXTRACT_ALL = NO
EXTRACT_PRIVATE = NO
# If the EXTRACT_PACKAGE tag is set to YES all members with package or internal scope will be included in the documentation.
# If the EXTRACT_PACKAGE tag is set to YES all members with package or internal
# scope will be included in the documentation.
EXTRACT_PACKAGE = NO
@@ -533,7 +544,8 @@ GENERATE_BUGLIST = NO
GENERATE_DEPRECATEDLIST= YES
# The ENABLED_SECTIONS tag can be used to enable conditional
# documentation sections, marked by \if sectionname ... \endif.
# documentation sections, marked by \if section-label ... \endif
# and \cond section-label ... \endcond blocks.
ENABLED_SECTIONS =
@@ -553,12 +565,6 @@ MAX_INITIALIZER_LINES = 30
SHOW_USED_FILES = YES
# If the sources in your project are distributed over multiple directories
# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy
# in the documentation. The default is NO.
SHOW_DIRECTORIES = NO
# Set the SHOW_FILES tag to NO to disable the generation of the Files page.
# This will remove the Files entry from the Quick Index and from the
# Folder Tree View (if specified). The default is YES.
@@ -584,7 +590,7 @@ FILE_VERSION_FILTER =
# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed
# by doxygen. The layout file controls the global structure of the generated
# output files in an output format independent way. The create the layout file
# output files in an output format independent way. To create the layout file
# that represents doxygen's defaults, run doxygen with the -l option.
# You can optionally specify a file name after the option, if omitted
# DoxygenLayout.xml will be used as the name of the layout file.
@@ -597,7 +603,8 @@ LAYOUT_FILE =
# requires the bibtex tool to be installed. See also
# http://en.wikipedia.org/wiki/BibTeX for more info. For LaTeX the style
# of the bibliography can be controlled using LATEX_BIB_STYLE. To use this
# feature you need bibtex and perl available in the search path.
# feature you need bibtex and perl available in the search path. Do not use
# file names with spaces, bibtex cannot handle them.
CITE_BIB_FILES =
@@ -661,7 +668,9 @@ WARN_LOGFILE =
# directories like "/usr/src/myproject". Separate the files or directories
# with spaces.
INPUT = tinyxml2.h xmltest.h readme.txt
INPUT = tinyxml2.h \
xmltest.cpp \
readme.md
# This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
@@ -779,6 +788,13 @@ FILTER_SOURCE_FILES = NO
FILTER_SOURCE_PATTERNS =
# If the USE_MD_FILE_AS_MAINPAGE tag refers to the name of a markdown file that
# is part of the input, its contents will be placed on the main page (index.html).
# This can be useful if you have a project on for instance GitHub and want reuse
# the introduction page also for the doxygen output.
USE_MDFILE_AS_MAINPAGE = readme.md
#---------------------------------------------------------------------------
# configuration options related to source browsing
#---------------------------------------------------------------------------
@@ -797,7 +813,7 @@ INLINE_SOURCES = NO
# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
# doxygen to hide any special comment blocks from generated source code
# fragments. Normal C and C++ comments will always remain visible.
# fragments. Normal C, C++ and Fortran comments will always remain visible.
STRIP_CODE_COMMENTS = YES
@@ -900,13 +916,23 @@ HTML_FOOTER =
# The HTML_STYLESHEET tag can be used to specify a user-defined cascading
# style sheet that is used by each HTML page. It can be used to
# fine-tune the look of the HTML output. If the tag is left blank doxygen
# will generate a default style sheet. Note that doxygen will try to copy
# the style sheet file to the HTML output directory, so don't put your own
# style sheet in the HTML output directory as well, or it will be erased!
# fine-tune the look of the HTML output. If left blank doxygen will
# generate a default style sheet. Note that it is recommended to use
# HTML_EXTRA_STYLESHEET instead of this one, as it is more robust and this
# tag will in the future become obsolete.
HTML_STYLESHEET =
# The HTML_EXTRA_STYLESHEET tag can be used to specify an additional
# user-defined cascading style sheet that is included after the standard
# style sheets created by doxygen. Using this option one can overrule
# certain style aspects. This is preferred over using HTML_STYLESHEET
# since it does not replace the standard style sheet and is therefor more
# robust against future updates. Doxygen will copy the style sheet file to
# the output directory.
HTML_EXTRA_STYLESHEET =
# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or
# other source files which should be copied to the HTML output directory. Note
# that these files will be copied to the base HTML output directory. Use the
@@ -947,20 +973,23 @@ HTML_COLORSTYLE_GAMMA = 80
HTML_TIMESTAMP = YES
# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes,
# files or namespaces will be aligned in HTML using tables. If set to
# NO a bullet list will be used.
HTML_ALIGN_MEMBERS = YES
# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
# documentation will contain sections that can be hidden and shown after the
# page has loaded. For this to work a browser that supports
# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox
# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari).
# page has loaded.
HTML_DYNAMIC_SECTIONS = NO
# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of
# entries shown in the various tree structured indices initially; the user
# can expand and collapse entries dynamically later on. Doxygen will expand
# the tree to such a level that at most the specified number of entries are
# visible (unless a fully collapsed tree already exceeds this amount).
# So setting the number of entries 1 will produce a full collapsed tree by
# default. 0 is a special value representing an infinite number of entries
# and will result in a full expanded tree by default.
HTML_INDEX_NUM_ENTRIES = 100
# If the GENERATE_DOCSET tag is set to YES, additional index files
# will be generated that can be used as input for Apple's Xcode 3
# integrated development environment, introduced with OSX 10.5 (Leopard).
@@ -988,9 +1017,9 @@ DOCSET_FEEDNAME = "Doxygen generated docs"
DOCSET_BUNDLE_ID = org.doxygen.Project
# When GENERATE_PUBLISHER_ID tag specifies a string that should uniquely identify
# the documentation publisher. This should be a reverse domain-name style
# string, e.g. com.mycompany.MyDocSet.documentation.
# When GENERATE_PUBLISHER_ID tag specifies a string that should uniquely
# identify the documentation publisher. This should be a reverse domain-name
# style string, e.g. com.mycompany.MyDocSet.documentation.
DOCSET_PUBLISHER_ID = org.doxygen.Publisher
@@ -1139,11 +1168,6 @@ GENERATE_TREEVIEW = NO
ENUM_VALUES_PER_LINE = 4
# By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories,
# and Class Hierarchy pages using a tree view instead of an ordered list.
USE_INLINE_TREES = NO
# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
# used to set the initial width (in pixels) of the frame in which the tree
# is shown.
@@ -1180,6 +1204,13 @@ FORMULA_TRANSPARENT = YES
USE_MATHJAX = NO
# When MathJax is enabled you can set the default output format to be used for
# thA MathJax output. Supported types are HTML-CSS, NativeMML (i.e. MathML) and
# SVG. The default value is HTML-CSS, which is slower, but has the best
# compatibility.
MATHJAX_FORMAT = HTML-CSS
# When MathJax is enabled you need to specify the location relative to the
# HTML output directory using the MATHJAX_RELPATH option. The destination
# directory should contain the MathJax.js script. For instance, if the mathjax
@@ -1208,15 +1239,50 @@ MATHJAX_EXTENSIONS =
SEARCHENGINE = YES
# When the SERVER_BASED_SEARCH tag is enabled the search engine will be
# implemented using a PHP enabled web server instead of at the web client
# using Javascript. Doxygen will generate the search PHP script and index
# file to put on the web server. The advantage of the server
# based approach is that it scales better to large projects and allows
# full text search. The disadvantages are that it is more difficult to setup
# and does not have live searching capabilities.
# implemented using a web server instead of a web client using Javascript.
# There are two flavours of web server based search depending on the
# EXTERNAL_SEARCH setting. When disabled, doxygen will generate a PHP script for
# searching and an index file used by the script. When EXTERNAL_SEARCH is
# enabled the indexing and searching needs to be provided by external tools.
# See the manual for details.
SERVER_BASED_SEARCH = NO
# When EXTERNAL_SEARCH is enabled doxygen will no longer generate the PHP
# script for searching. Instead the search results are written to an XML file
# which needs to be processed by an external indexer. Doxygen will invoke an
# external search engine pointed to by the SEARCHENGINE_URL option to obtain
# the search results. Doxygen ships with an example indexer (doxyindexer) and
# search engine (doxysearch.cgi) which are based on the open source search engine
# library Xapian. See the manual for configuration details.
EXTERNAL_SEARCH = NO
# The SEARCHENGINE_URL should point to a search engine hosted by a web server
# which will returned the search results when EXTERNAL_SEARCH is enabled.
# Doxygen ships with an example search engine (doxysearch) which is based on
# the open source search engine library Xapian. See the manual for configuration
# details.
SEARCHENGINE_URL =
# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the unindexed
# search data is written to a file for indexing by an external tool. With the
# SEARCHDATA_FILE tag the name of this file can be specified.
SEARCHDATA_FILE = searchdata.xml
# The EXTRA_SEARCH_MAPPINGS tag can be used to enable searching through other
# doxygen projects that are not otherwise connected via tags files, but are
# all added to the same search index. Each project needs to have a tag file set
# via GENERATE_TAGFILE. The search mapping then maps the name of the tag file
# to a relative location where the documentation can be found,
# similar to the
# TAGFILES option but without actually processing the tag file.
# The format is: EXTRA_SEARCH_MAPPINGS = tagname1=loc1 tagname2=loc2 ...
EXTRA_SEARCH_MAPPINGS =
#---------------------------------------------------------------------------
# configuration options related to the LaTeX output
#---------------------------------------------------------------------------
@@ -1711,7 +1777,7 @@ CALLER_GRAPH = NO
GRAPHICAL_HIERARCHY = YES
# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES
# If the DIRECTORY_GRAPH and HAVE_DOT tags are set to YES
# then doxygen will show the dependencies a directory has on other directories
# in a graphical way. The dependency relations are determined by the #include
# relations between the files in the directories.

View File

@@ -1,7 +1,8 @@
TinyXML-2
=========
![TinyXML-2 Logo](http://www.grinninglizard.com/tinyxml2/TinyXML2_small.png)
TinyXML is a simple, small, efficient, C++ XML parser that can be
TinyXML-2 is a simple, small, efficient, C++ XML parser that can be
easily integrated into other programs.
The master is hosted on github:
@@ -15,7 +16,7 @@ Examples are in the "related pages" tab of the HTML docs.
What it does.
-------------
In brief, TinyXML parses an XML document, and builds from that a
In brief, TinyXML-2 parses an XML document, and builds from that a
Document Object Model (DOM) that can be read, modified, and saved.
XML stands for "eXtensible Markup Language." It is a general purpose
@@ -45,24 +46,26 @@ TinyXML-2 attempts to be a flexible parser, but with truly correct and
compliant XML output. TinyXML-2 should compile on any reasonably C++
compliant system. It does not rely on exceptions, RTTI, or the STL.
What it doesn<EFBFBD>t do.
What it doesn't do.
-------------------
TinyXML-2 doesn't parse or use DTDs (Document Type Definitions) or XSLs
(eXtensible Stylesheet Language.) There are other parsers out there
that are much more fully
featured. But they are also much bigger, take longer to set up in
your project, have a higher learning curve, and often have a more
restrictive license. If you are working with browsers or have more
complete XML needs, TinyXML-2 is not the parser for you.
that are much more fully featured. But they are also much bigger,
take longer to set up in your project, have a higher learning curve,
and often have a more restrictive license. If you are working with
browsers or have more complete XML needs, TinyXML-2 is not the parser for you.
TinyXML-1 vs. TinyXML-2
-----------------------
Which should you use? TinyXML-2 uses a similar API to TinyXML-1 and the same
TinyXML-2 is now the focus of all development, well tested, and your
best choice unless you have a requirement to maintain TinyXML-1 code.
TinyXML-2 uses a similar API to TinyXML-1 and the same
rich test cases. But the implementation of the parser is completely re-written
to make it more appropriate for use in a game. It uses less memory, is faster,
and uses far few memory allocations.
and uses far fewer memory allocations.
TinyXML-2 has no requirement for STL, but has also dropped all STL support. All
strings are query and set as 'const char*'. This allows the use of internal
@@ -104,10 +107,12 @@ by the Document. When the Document is deleted, so are all the nodes it contains.
### White Space
#### Whitespace Preservation (default)
Microsoft has an excellent article on white space: http://msdn.microsoft.com/en-us/library/ms256097.aspx
By default, TinyXML-2 preserves white space in a (hopefully) sane way that is almost complient with the
spec.(TinyXML-1 used a completely outdated model.)
spec. (TinyXML-1 used a completely different model, much more similar to 'collapse', below.)
As a first step, all newlines / carriage-returns / line-feeds are normalized to a
line-feed character, as required by the XML spec.
@@ -136,17 +141,18 @@ valuable. TinyXML-2 sees these as the same XML:
#### Whitespace Collapse
For some applications, it is preferable to collapse whitespace. TinyXML-2
supports this with the 'whitespace' parameter to the XMLDocument constructor.
For some applications, it is preferable to collapse whitespace. Collapsing
whitespace gives you "HTML-like" behavior, which is sometimes more suitable
for hand typed documents.
TinyXML-2 supports this with the 'whitespace' parameter to the XMLDocument constructor.
(The default is to preserve whitespace, as described above.)
However, you may also use COLLAPSE_WHITESPACE, which will:
* Remove leading and trailing whitespace
* Convert newlines and line-feeds into a space character
* Collapse a run of any number of space characters into a single space character
This can be useful for text documents stored in XML.
* Remove leading and trailing whitespace
* Convert newlines and line-feeds into a space character
* Collapse a run of any number of space characters into a single space character
Note that (currently) there is a performance impact for using COLLAPSE_WHITESPACE.
It essentially causes the XML to be parsed twice.
@@ -162,7 +168,7 @@ characters. Namely:
&quot; "
&apos; '
These are recognized when the XML document is read, and translated to there
These are recognized when the XML document is read, and translated to their
UTF-8 equivalents. For instance, text with the XML of:
Far &amp; Away
@@ -194,7 +200,7 @@ Or the XMLPrinter class:
Printing to memory is supported by the XMLPrinter.
XMLPrinter printer;
doc->Print( &printer );
doc.Print( &printer );
// printer.CStr() has a const char* to the XML
#### Print without an XMLDocument
@@ -259,8 +265,9 @@ And additionally a test file:
* xmltest.cpp
Simply compile and run. There is a visual studio 2010 project included, a simple Makefile,
an XCode project, and a cmake CMakeLists.txt included to help you. The top of tinyxml.h
even has a simple g++ command line if you are are *nix and don't want to use a build system.
an XCode project, a Code::Blocks project, and a cmake CMakeLists.txt included to help you.
The top of tinyxml.h even has a simple g++ command line if you are are *nix and don't want
to use a build system.
Documentation
-------------
@@ -301,5 +308,9 @@ in shaping what is a very successful library. Extra thanks to Yves
Berquin and Andrew Ellerton who were key contributors.
TinyXML-2 grew from that effort. Lee Thomason is the original author
of TinyXML-2 (and TinyXML-1) but hopefully TinyXML-2 will be improved
by many contributors.
of TinyXML-2 (and TinyXML-1) but TinyXML-2 has been and is being improved
by many contributors.
Thanks to John Mackay at http://john.mackay.rosalilastudio.com for the TinyXML-2 logo!

0
resources/empty.xml Normal file
View File

View File

@@ -3,6 +3,7 @@
import re
import sys
import optparse
def fileProcess( name, lineFunction ):
filestream = open( name, 'r' )
@@ -25,16 +26,21 @@ def fileProcess( name, lineFunction ):
filestream.write( output );
filestream.close()
def echoInput( line ):
return line
major = input( "Major: " )
minor = input( "Minor: " )
build = input( "Build: " )
parser = optparse.OptionParser( "usage: %prog major minor build" )
(options, args) = parser.parse_args()
if len(args) != 3:
parser.error( "incorrect number of arguments" );
print "Setting dox,tinyxml2.h"
print "Version: " + `major` + "." + `minor` + "." + `build`
major = args[0]
minor = args[1]
build = args[2]
versionStr = major + "." + minor + "." + build
print ("Setting dox,tinyxml2.h")
print ("Version: " + major + "." + minor + "." + build)
#### Write the tinyxml.h ####
@@ -45,16 +51,16 @@ def engineRule( line ):
matchBuild = "static const int TIXML2_PATCH_VERSION"
if line[0:len(matchMajor)] == matchMajor:
print "1)tinyxml2.h Major found"
return matchMajor + " = " + `major` + ";\n"
print( "1)tinyxml2.h Major found" )
return matchMajor + " = " + major + ";\n"
elif line[0:len(matchMinor)] == matchMinor:
print "2)tinyxml2.h Minor found"
return matchMinor + " = " + `minor` + ";\n"
print( "2)tinyxml2.h Minor found" )
return matchMinor + " = " + minor + ";\n"
elif line[0:len(matchBuild)] == matchBuild:
print "3)tinyxml2.h Build found"
return matchBuild + " = " + `build` + ";\n"
print( "3)tinyxml2.h Build found" )
return matchBuild + " = " + build + ";\n"
else:
return line;
@@ -69,8 +75,8 @@ def doxRule( line ):
match = "PROJECT_NUMBER"
if line[0:len( match )] == match:
print "dox project found"
return "PROJECT_NUMBER = " + `major` + "." + `minor` + "." + `build` + "\n"
print( "dox project found" )
return "PROJECT_NUMBER = " + major + "." + minor + "." + build + "\n"
else:
return line;
@@ -85,8 +91,8 @@ def cmakeRule1( line ):
matchVersion = "set(GENERIC_LIB_VERSION"
if line[0:len(matchVersion)] == matchVersion:
print "1)tinyxml2.h Major found"
return matchVersion + " \"" + `major` + "." + `minor` + "." + `build` + "\")" + "\n"
print( "1)tinyxml2.h Major found" )
return matchVersion + " \"" + major + "." + minor + "." + build + "\")" + "\n"
else:
return line;
@@ -98,10 +104,15 @@ def cmakeRule2( line ):
matchSoversion = "set(GENERIC_LIB_SOVERSION"
if line[0:len(matchSoversion)] == matchSoversion:
print "1)tinyxml2.h Major found"
return matchSoversion + " \"" + `major` + "\")" + "\n"
print( "1)tinyxml2.h Major found" )
return matchSoversion + " \"" + major + "\")" + "\n"
else:
return line;
fileProcess( "CMakeLists.txt", cmakeRule2 )
print( "Release note:" )
print( '1. Build. g++ -Wall -DDEBUG tinyxml2.cpp xmltest.cpp -o gccxmltest.exe' )
print( '2. Commit. git commit -am"setting the version to ' + versionStr + '"' )
print( '3. Tag. git tag ' + versionStr )

2688
tinyxml2.cpp Normal file → Executable file

File diff suppressed because it is too large Load Diff

2551
tinyxml2.h Normal file → Executable file

File diff suppressed because it is too large Load Diff

View File

@@ -1,26 +0,0 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual C++ Express 2010
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tinyxml2", "tinyxml2\tinyxml2.vcxproj", "{16A1D446-5415-444E-A7B4-F35B7DA7EE8C}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64
Release|Win32 = Release|Win32
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{16A1D446-5415-444E-A7B4-F35B7DA7EE8C}.Debug|Win32.ActiveCfg = Debug|Win32
{16A1D446-5415-444E-A7B4-F35B7DA7EE8C}.Debug|Win32.Build.0 = Debug|Win32
{16A1D446-5415-444E-A7B4-F35B7DA7EE8C}.Debug|x64.ActiveCfg = Debug|x64
{16A1D446-5415-444E-A7B4-F35B7DA7EE8C}.Debug|x64.Build.0 = Debug|x64
{16A1D446-5415-444E-A7B4-F35B7DA7EE8C}.Release|Win32.ActiveCfg = Release|Win32
{16A1D446-5415-444E-A7B4-F35B7DA7EE8C}.Release|Win32.Build.0 = Release|Win32
{16A1D446-5415-444E-A7B4-F35B7DA7EE8C}.Release|x64.ActiveCfg = Release|x64
{16A1D446-5415-444E-A7B4-F35B7DA7EE8C}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

347
tinyxml2/test.vcxproj Normal file
View File

@@ -0,0 +1,347 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug-Dll|Win32">
<Configuration>Debug-Dll</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug-Dll|x64">
<Configuration>Debug-Dll</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug-Lib|Win32">
<Configuration>Debug-Lib</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug-Lib|x64">
<Configuration>Debug-Lib</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release-Dll|Win32">
<Configuration>Release-Dll</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release-Dll|x64">
<Configuration>Release-Dll</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release-Lib|Win32">
<Configuration>Release-Lib</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release-Lib|x64">
<Configuration>Release-Lib</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{E8FB2712-8666-4662-A5B8-2B5B0FB1A260}</ProjectGuid>
<RootNamespace>test</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-Lib|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-Lib|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-Dll|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-Dll|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release-Lib|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release-Lib|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release-Dll|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release-Dll|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<CharacterSet>Unicode</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<CharacterSet>Unicode</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug-Lib|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug-Lib|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug-Dll|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug-Dll|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release-Lib|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release-Lib|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release-Dll|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release-Dll|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-Dll|Win32'">
<OutDir>$(SolutionDir)bin\$(Platform)-$(Configuration)\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-Dll|Win32'">
<IntDir>$(SolutionDir)temp\$(Platform)-$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-Lib|Win32'">
<OutDir>$(SolutionDir)bin\$(Platform)-$(Configuration)\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-Lib|Win32'">
<IntDir>$(SolutionDir)temp\$(Platform)-$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release-Dll|Win32'">
<OutDir>$(SolutionDir)bin\$(Platform)-$(Configuration)\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release-Dll|Win32'">
<IntDir>$(SolutionDir)temp\$(Platform)-$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release-Lib|Win32'">
<OutDir>$(SolutionDir)bin\$(Platform)-$(Configuration)\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release-Lib|Win32'">
<IntDir>$(SolutionDir)temp\$(Platform)-$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-Dll|x64'">
<OutDir>$(SolutionDir)bin\$(Platform)-$(Configuration)\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-Dll|x64'">
<IntDir>$(SolutionDir)temp\$(Platform)-$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-Lib|x64'">
<OutDir>$(SolutionDir)bin\$(Platform)-$(Configuration)\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-Lib|x64'">
<IntDir>$(SolutionDir)temp\$(Platform)-$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release-Dll|x64'">
<OutDir>$(SolutionDir)bin\$(Platform)-$(Configuration)\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release-Dll|x64'">
<IntDir>$(SolutionDir)temp\$(Platform)-$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release-Lib|x64'">
<OutDir>$(SolutionDir)bin\$(Platform)-$(Configuration)\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release-Lib|x64'">
<IntDir>$(SolutionDir)temp\$(Platform)-$(Configuration)\</IntDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug-Lib|Win32'">
<ClCompile>
<WarningLevel>Level4</WarningLevel>
<Optimization>Disabled</Optimization>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug-Lib|x64'">
<ClCompile>
<WarningLevel>Level4</WarningLevel>
<Optimization>Disabled</Optimization>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug-Dll|Win32'">
<ClCompile>
<WarningLevel>Level4</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>TINYXML2_IMPORT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug-Dll|x64'">
<ClCompile>
<WarningLevel>Level4</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>TINYXML2_IMPORT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release-Lib|Win32'">
<ClCompile>
<WarningLevel>Level4</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release-Lib|x64'">
<ClCompile>
<WarningLevel>Level4</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release-Dll|Win32'">
<ClCompile>
<WarningLevel>Level4</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<OmitFramePointers>true</OmitFramePointers>
<EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations>
<StringPooling>true</StringPooling>
<PreprocessorDefinitions>TINYXML2_IMPORT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<GenerateDebugInformation>false</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<SubSystem>Console</SubSystem>
<SetChecksum>true</SetChecksum>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release-Dll|x64'">
<ClCompile>
<WarningLevel>Level4</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<OmitFramePointers>true</OmitFramePointers>
<EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations>
<StringPooling>true</StringPooling>
<PreprocessorDefinitions>TINYXML2_IMPORT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<GenerateDebugInformation>false</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<SubSystem>Console</SubSystem>
<SetChecksum>true</SetChecksum>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level4</WarningLevel>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level4</WarningLevel>
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
<IntrinsicFunctions>true</IntrinsicFunctions>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<OmitFramePointers>true</OmitFramePointers>
<EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations>
<StringPooling>true</StringPooling>
</ClCompile>
<Link>
<GenerateDebugInformation>false</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<SetChecksum>true</SetChecksum>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level4</WarningLevel>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level4</WarningLevel>
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
<IntrinsicFunctions>true</IntrinsicFunctions>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<OmitFramePointers>true</OmitFramePointers>
<EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations>
<StringPooling>true</StringPooling>
</ClCompile>
<Link>
<GenerateDebugInformation>false</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<SetChecksum>true</SetChecksum>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\xmltest.cpp" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="tinyxml2.vcxproj">
<Project>{d1c528b6-aa02-4d29-9d61-dc08e317a70d}</Project>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<ClCompile Include="..\xmltest.cpp" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,3 @@
The (default) Release configuration of this project builds a ready to use static library.
The Debug configuration of this project builds an executable console application that
executes all tests provided for tinyxml2 in the xmltest.cpp file.

View File

@@ -0,0 +1,49 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
<FileVersion major="1" minor="6" />
<Project>
<Option title="tinyxml2-cbp" />
<Option execution_dir="../" />
<Option pch_mode="2" />
<Option compiler="gcc" />
<Build>
<Target title="Release">
<Option output="bin/Release/tinyxml2" prefix_auto="1" extension_auto="1" />
<Option working_dir="" />
<Option object_output="obj/Release/" />
<Option type="2" />
<Option compiler="gcc" />
<Compiler>
<Add option="-O2" />
</Compiler>
<Linker>
<Add option="-s" />
</Linker>
</Target>
<Target title="Debug">
<Option output="bin/Debug/tinyxml2-cbp" prefix_auto="1" extension_auto="1" />
<Option working_dir="../../" />
<Option object_output="obj/Debug/" />
<Option type="1" />
<Option compiler="gcc" />
<Compiler>
<Add option="-g" />
</Compiler>
</Target>
</Build>
<Compiler>
<Add option="-Wall" />
</Compiler>
<Unit filename="../../tinyxml2.cpp" />
<Unit filename="../../tinyxml2.h" />
<Unit filename="../../xmltest.cpp">
<Option target="Debug" />
</Unit>
<Extensions>
<code_completion />
<envvars />
<debugger />
<lib_finder disable_auto="1" />
</Extensions>
</Project>
</CodeBlocks_project_file>

56
tinyxml2/tinyxml2.sln Executable file
View File

@@ -0,0 +1,56 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tinyxml2", "tinyxml2.vcxproj", "{D1C528B6-AA02-4D29-9D61-DC08E317A70D}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test", "test.vcxproj", "{E8FB2712-8666-4662-A5B8-2B5B0FB1A260}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug-Dll|Win32 = Debug-Dll|Win32
Debug-Dll|x64 = Debug-Dll|x64
Debug-Lib|Win32 = Debug-Lib|Win32
Debug-Lib|x64 = Debug-Lib|x64
Release-Dll|Win32 = Release-Dll|Win32
Release-Dll|x64 = Release-Dll|x64
Release-Lib|Win32 = Release-Lib|Win32
Release-Lib|x64 = Release-Lib|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{D1C528B6-AA02-4D29-9D61-DC08E317A70D}.Debug-Dll|Win32.ActiveCfg = Debug-Dll|Win32
{D1C528B6-AA02-4D29-9D61-DC08E317A70D}.Debug-Dll|Win32.Build.0 = Debug-Dll|Win32
{D1C528B6-AA02-4D29-9D61-DC08E317A70D}.Debug-Dll|x64.ActiveCfg = Debug-Dll|x64
{D1C528B6-AA02-4D29-9D61-DC08E317A70D}.Debug-Dll|x64.Build.0 = Debug-Dll|x64
{D1C528B6-AA02-4D29-9D61-DC08E317A70D}.Debug-Lib|Win32.ActiveCfg = Debug-Lib|Win32
{D1C528B6-AA02-4D29-9D61-DC08E317A70D}.Debug-Lib|Win32.Build.0 = Debug-Lib|Win32
{D1C528B6-AA02-4D29-9D61-DC08E317A70D}.Debug-Lib|x64.ActiveCfg = Debug-Lib|x64
{D1C528B6-AA02-4D29-9D61-DC08E317A70D}.Debug-Lib|x64.Build.0 = Debug-Lib|x64
{D1C528B6-AA02-4D29-9D61-DC08E317A70D}.Release-Dll|Win32.ActiveCfg = Release-Dll|Win32
{D1C528B6-AA02-4D29-9D61-DC08E317A70D}.Release-Dll|Win32.Build.0 = Release-Dll|Win32
{D1C528B6-AA02-4D29-9D61-DC08E317A70D}.Release-Dll|x64.ActiveCfg = Release-Dll|x64
{D1C528B6-AA02-4D29-9D61-DC08E317A70D}.Release-Dll|x64.Build.0 = Release-Dll|x64
{D1C528B6-AA02-4D29-9D61-DC08E317A70D}.Release-Lib|Win32.ActiveCfg = Release-Lib|Win32
{D1C528B6-AA02-4D29-9D61-DC08E317A70D}.Release-Lib|Win32.Build.0 = Release-Lib|Win32
{D1C528B6-AA02-4D29-9D61-DC08E317A70D}.Release-Lib|x64.ActiveCfg = Release-Lib|x64
{D1C528B6-AA02-4D29-9D61-DC08E317A70D}.Release-Lib|x64.Build.0 = Release-Lib|x64
{E8FB2712-8666-4662-A5B8-2B5B0FB1A260}.Debug-Dll|Win32.ActiveCfg = Debug-Dll|Win32
{E8FB2712-8666-4662-A5B8-2B5B0FB1A260}.Debug-Dll|Win32.Build.0 = Debug-Dll|Win32
{E8FB2712-8666-4662-A5B8-2B5B0FB1A260}.Debug-Dll|x64.ActiveCfg = Debug-Dll|x64
{E8FB2712-8666-4662-A5B8-2B5B0FB1A260}.Debug-Dll|x64.Build.0 = Debug-Dll|x64
{E8FB2712-8666-4662-A5B8-2B5B0FB1A260}.Debug-Lib|Win32.ActiveCfg = Debug-Lib|Win32
{E8FB2712-8666-4662-A5B8-2B5B0FB1A260}.Debug-Lib|Win32.Build.0 = Debug-Lib|Win32
{E8FB2712-8666-4662-A5B8-2B5B0FB1A260}.Debug-Lib|x64.ActiveCfg = Debug-Lib|x64
{E8FB2712-8666-4662-A5B8-2B5B0FB1A260}.Debug-Lib|x64.Build.0 = Debug-Lib|x64
{E8FB2712-8666-4662-A5B8-2B5B0FB1A260}.Release-Dll|Win32.ActiveCfg = Release-Dll|Win32
{E8FB2712-8666-4662-A5B8-2B5B0FB1A260}.Release-Dll|Win32.Build.0 = Release-Dll|Win32
{E8FB2712-8666-4662-A5B8-2B5B0FB1A260}.Release-Dll|x64.ActiveCfg = Release-Dll|x64
{E8FB2712-8666-4662-A5B8-2B5B0FB1A260}.Release-Dll|x64.Build.0 = Release-Dll|x64
{E8FB2712-8666-4662-A5B8-2B5B0FB1A260}.Release-Lib|Win32.ActiveCfg = Release-Lib|Win32
{E8FB2712-8666-4662-A5B8-2B5B0FB1A260}.Release-Lib|Win32.Build.0 = Release-Lib|Win32
{E8FB2712-8666-4662-A5B8-2B5B0FB1A260}.Release-Lib|x64.ActiveCfg = Release-Lib|x64
{E8FB2712-8666-4662-A5B8-2B5B0FB1A260}.Release-Lib|x64.Build.0 = Release-Lib|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

357
tinyxml2/tinyxml2.vcxproj Normal file → Executable file
View File

@@ -1,158 +1,383 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<ProjectConfiguration Include="Debug-Dll|Win32">
<Configuration>Debug-Dll</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<ProjectConfiguration Include="Debug-Dll|x64">
<Configuration>Debug-Dll</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<ProjectConfiguration Include="Debug-Lib|Win32">
<Configuration>Debug-Lib</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<ProjectConfiguration Include="Debug-Lib|x64">
<Configuration>Debug-Lib</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release-Dll|Win32">
<Configuration>Release-Dll</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release-Dll|x64">
<Configuration>Release-Dll</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release-Lib|Win32">
<Configuration>Release-Lib</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release-Lib|x64">
<Configuration>Release-Lib</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{16A1D446-5415-444E-A7B4-F35B7DA7EE8C}</ProjectGuid>
<ProjectGuid>{D1C528B6-AA02-4D29-9D61-DC08E317A70D}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>tinyxml2</RootNamespace>
<VCTargetsPath Condition="'$(VCTargetsPath11)' != '' and '$(VSVersion)' == '' and $(VisualStudioVersion) == ''">$(VCTargetsPath11)</VCTargetsPath>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-Lib|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-Dll|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-Lib|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-Dll|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release-Lib|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release-Dll|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release-Lib|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release-Dll|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ConfigurationType>StaticLibrary</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ConfigurationType>StaticLibrary</ConfigurationType>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ConfigurationType>StaticLibrary</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ConfigurationType>StaticLibrary</ConfigurationType>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug-Lib|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug-Dll|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug-Lib|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug-Dll|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release-Lib|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release-Dll|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release-Lib|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release-Dll|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-Lib|Win32'">
<LinkIncremental>true</LinkIncremental>
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
<IntDir>$(Platform)\$(Configuration)\</IntDir>
<OutDir>$(SolutionDir)bin\$(Platform)-$(Configuration)\</OutDir>
<IntDir>$(SolutionDir)temp\$(Platform)-$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-Dll|Win32'">
<LinkIncremental>true</LinkIncremental>
<OutDir>$(SolutionDir)bin\$(Platform)-$(Configuration)\</OutDir>
<IntDir>$(SolutionDir)temp\$(Platform)-$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-Lib|x64'">
<LinkIncremental>true</LinkIncremental>
<OutDir>$(SolutionDir)bin\$(Platform)-$(Configuration)\</OutDir>
<IntDir>$(SolutionDir)temp\$(Platform)-$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-Dll|x64'">
<LinkIncremental>true</LinkIncremental>
<OutDir>$(SolutionDir)bin\$(Platform)-$(Configuration)\</OutDir>
<IntDir>$(SolutionDir)temp\$(Platform)-$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release-Lib|Win32'">
<LinkIncremental>false</LinkIncremental>
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
<IntDir>$(Platform)\$(Configuration)\</IntDir>
<OutDir>$(SolutionDir)bin\$(Platform)-$(Configuration)\</OutDir>
<IntDir>$(SolutionDir)temp\$(Platform)-$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release-Dll|Win32'">
<LinkIncremental>false</LinkIncremental>
<OutDir>$(SolutionDir)bin\$(Platform)-$(Configuration)\</OutDir>
<IntDir>$(SolutionDir)temp\$(Platform)-$(Configuration)\</IntDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release-Lib|x64'">
<LinkIncremental>false</LinkIncremental>
<OutDir>$(SolutionDir)bin\$(Platform)-$(Configuration)\</OutDir>
<IntDir>$(SolutionDir)temp\$(Platform)-$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release-Dll|x64'">
<LinkIncremental>false</LinkIncremental>
<OutDir>$(SolutionDir)bin\$(Platform)-$(Configuration)\</OutDir>
<IntDir>$(SolutionDir)temp\$(Platform)-$(Configuration)\</IntDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug-Lib|Win32'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level4</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ExceptionHandling>false</ExceptionHandling>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug-Dll|Win32'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level4</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;TINYXML2_EXPORT;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<SubSystem>NotSet</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug-Lib|x64'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level4</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ExceptionHandling>false</ExceptionHandling>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug-Dll|x64'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level4</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;TINYXML2_EXPORT;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<SubSystem>NotSet</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release-Lib|Win32'">
<ClCompile>
<WarningLevel>Level4</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<OmitFramePointers>true</OmitFramePointers>
<EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations>
<StringPooling>true</StringPooling>
<BufferSecurityCheck>false</BufferSecurityCheck>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<SetChecksum>true</SetChecksum>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release-Dll|Win32'">
<ClCompile>
<WarningLevel>Level4</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;TINYXML2_EXPORT;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<OmitFramePointers>true</OmitFramePointers>
<EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations>
<StringPooling>true</StringPooling>
<BufferSecurityCheck>false</BufferSecurityCheck>
</ClCompile>
<Link>
<SubSystem>NotSet</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<SetChecksum>true</SetChecksum>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release-Lib|x64'">
<ClCompile>
<WarningLevel>Level4</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<OmitFramePointers>true</OmitFramePointers>
<EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations>
<StringPooling>true</StringPooling>
<BufferSecurityCheck>false</BufferSecurityCheck>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<SetChecksum>true</SetChecksum>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release-Dll|x64'">
<ClCompile>
<WarningLevel>Level4</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;TINYXML2_EXPORT;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<OmitFramePointers>true</OmitFramePointers>
<EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations>
<StringPooling>true</StringPooling>
<BufferSecurityCheck>false</BufferSecurityCheck>
</ClCompile>
<Link>
<SubSystem>NotSet</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<SetChecksum>true</SetChecksum>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Lib>
<IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
</Lib>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Lib>
<IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
</Lib>
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
<ClCompile>
<IntrinsicFunctions>true</IntrinsicFunctions>
</ClCompile>
<ClCompile>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
</ClCompile>
<ClCompile>
<OmitFramePointers>true</OmitFramePointers>
</ClCompile>
<ClCompile>
<EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations>
<StringPooling>true</StringPooling>
<BufferSecurityCheck>false</BufferSecurityCheck>
</ClCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Lib>
<IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
</Lib>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Lib>
<IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
</Lib>
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
</ClCompile>
<ClCompile>
<IntrinsicFunctions>true</IntrinsicFunctions>
</ClCompile>
<ClCompile>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
</ClCompile>
<ClCompile>
<OmitFramePointers>true</OmitFramePointers>
</ClCompile>
<ClCompile>
<EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations>
<StringPooling>true</StringPooling>
<BufferSecurityCheck>false</BufferSecurityCheck>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\tinyxml2.cpp" />
<ClCompile Include="..\xmltest.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\tinyxml2.h" />
</ItemGroup>
<ItemGroup>
<None Include="..\readme.md" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>

22
tinyxml2/tinyxml2.vcxproj.filters Normal file → Executable file
View File

@@ -1,27 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<ClCompile Include="..\tinyxml2.cpp" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\xmltest.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\tinyxml2.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\tinyxml2.h">
<Filter>Source Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="..\readme.md">
<Filter>Source Files</Filter>
</None>
<ClInclude Include="..\tinyxml2.h" />
</ItemGroup>
</Project>

View File

@@ -1,5 +1,8 @@
#include "tinyxml2.h"
#if defined( _MSC_VER )
#define _CRT_SECURE_NO_WARNINGS // This test file is not intended to be secure.
#endif
#include "tinyxml2.h"
#include <cstdlib>
#include <cstring>
#include <ctime>
@@ -11,6 +14,8 @@
#include <windows.h>
_CrtMemState startMemState;
_CrtMemState endMemState;
#elif defined(MINGW32) || defined(__MINGW32__)
#include <io.h> // mkdir
#else
#include <sys/stat.h> // mkdir
#endif
@@ -20,7 +25,7 @@ int gPass = 0;
int gFail = 0;
bool XMLTest (const char* testString, const char* expected, const char* found, bool echo=true )
bool XMLTest (const char* testString, const char* expected, const char* found, bool echo=true, bool extraNL=false )
{
bool pass = !strcmp( expected, found );
if ( pass )
@@ -28,10 +33,19 @@ bool XMLTest (const char* testString, const char* expected, const char* found, b
else
printf ("[fail]");
if ( !echo )
if ( !echo ) {
printf (" %s\n", testString);
else
printf (" %s [%s][%s]\n", testString, expected, found);
}
else {
if ( extraNL ) {
printf( " %s\n", testString );
printf( "%s\n", expected );
printf( "%s\n", found );
}
else {
printf (" %s [%s][%s]\n", testString, expected, found);
}
}
if ( pass )
++gPass;
@@ -74,7 +88,6 @@ void NullLineEndings( char* p )
}
// Comments in the header. (Don't know how to get Doxygen to read comments in this file.)
int example_1()
{
XMLDocument doc;
@@ -82,9 +95,17 @@ int example_1()
return doc.ErrorID();
}
/** @page Example-1 Load an XML File
* @dontinclude ./xmltest.cpp
* Basic XML file loading.
* The basic syntax to load an XML file from
* disk and check for an error. (ErrorID()
* will return 0 for no error.)
* @skip example_1()
* @until }
*/
// Comments in the header. (Don't know how to get Doxygen to read comments in this file.)
int example_2()
{
static const char* xml = "<element/>";
@@ -93,11 +114,20 @@ int example_2()
return doc.ErrorID();
}
/** @page Example-2 Parse an XML from char buffer
* @dontinclude ./xmltest.cpp
* Basic XML string parsing.
* The basic syntax to parse an XML for
* a char* and check for an error. (ErrorID()
* will return 0 for no error.)
* @skip example_2()
* @until }
*/
int example_3()
{
static const char* xml =
static const char* xml =
"<?xml version=\"1.0\"?>"
"<!DOCTYPE PLAY SYSTEM \"play.dtd\">"
"<PLAY>"
@@ -110,13 +140,76 @@ int example_3()
XMLElement* titleElement = doc.FirstChildElement( "PLAY" )->FirstChildElement( "TITLE" );
const char* title = titleElement->GetText();
printf( "Name of play (1): %s\n", title );
XMLText* textNode = titleElement->FirstChild()->ToText();
title = textNode->Value();
printf( "Name of play (2): %s\n", title );
return doc.ErrorID();
}
/** @page Example-3 Get information out of XML
@dontinclude ./xmltest.cpp
In this example, we navigate a simple XML
file, and read some interesting text. Note
that this example doesn't use error
checking; working code should check for null
pointers when walking an XML tree, or use
XMLHandle.
(The XML is an excerpt from "dream.xml").
@skip example_3()
@until </PLAY>";
The structure of the XML file is:
<ul>
<li>(declaration)</li>
<li>(dtd stuff)</li>
<li>Element "PLAY"</li>
<ul>
<li>Element "TITLE"</li>
<ul>
<li>Text "A Midsummer Night's Dream"</li>
</ul>
</ul>
</ul>
For this example, we want to print out the
title of the play. The text of the title (what
we want) is child of the "TITLE" element which
is a child of the "PLAY" element.
We want to skip the declaration and dtd, so the
method FirstChildElement() is a good choice. The
FirstChildElement() of the Document is the "PLAY"
Element, the FirstChildElement() of the "PLAY" Element
is the "TITLE" Element.
@until ( "TITLE" );
We can then use the convenience function GetText()
to get the title of the play.
@until title );
Text is just another Node in the XML DOM. And in
fact you should be a little cautious with it, as
text nodes can contain elements.
@verbatim
Consider: A Midsummer Night's <b>Dream</b>
@endverbatim
It is more correct to actually query the Text Node
if in doubt:
@until title );
Noting that here we use FirstChild() since we are
looking for XMLText, not an element, and ToText()
is a cast from a Node to a XMLText.
*/
bool example_4()
@@ -128,7 +221,7 @@ bool example_4()
" <v>2</v>"
" </textApproach>"
"</information>";
XMLDocument doc;
doc.Parse( xml );
@@ -145,25 +238,76 @@ bool example_4()
return !doc.Error() && ( v0 == v1 );
}
/** @page Example-4 Read attributes and text information.
@dontinclude ./xmltest.cpp
There are fundamentally 2 ways of writing a key-value
pair into an XML file. (Something that's always annoyed
me about XML.) Either by using attributes, or by writing
the key name into an element and the value into
the text node wrapped by the element. Both approaches
are illustrated in this example, which shows two ways
to encode the value "2" into the key "v":
@skip example_4()
@until "</information>";
TinyXML-2 has accessors for both approaches.
When using an attribute, you navigate to the XMLElement
with that attribute and use the QueryIntAttribute()
group of methods. (Also QueryFloatAttribute(), etc.)
@skip XMLElement* attributeApproachElement
@until &v0 );
When using the text approach, you need to navigate
down one more step to the XMLElement that contains
the text. Note the extra FirstChildElement( "v" )
in the code below. The value of the text can then
be safely queried with the QueryIntText() group
of methods. (Also QueryFloatText(), etc.)
@skip XMLElement* textApproachElement
@until &v1 );
*/
int main( int /*argc*/, const char ** /*argv*/ )
int main( int argc, const char ** argv )
{
#if defined( _MSC_VER ) && defined( DEBUG )
_CrtMemCheckpoint( &startMemState );
#endif
#if defined(_MSC_VER)
#pragma warning ( push )
#pragma warning ( disable : 4996 ) // Fail to see a compelling reason why this should be deprecated.
#endif
#if defined(_MSC_VER)
_mkdir( "resources/out/" );
#if defined(_MSC_VER) || defined(MINGW32) || defined(__MINGW32__)
#if defined __MINGW64_VERSION_MAJOR && defined __MINGW64_VERSION_MINOR
//MINGW64: both 32 and 64-bit
mkdir( "resources/out/" );
#else
_mkdir( "resources/out/" );
#endif
#else
mkdir( "resources/out/", S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
#endif
if ( argc > 1 ) {
XMLDocument* doc = new XMLDocument();
clock_t startTime = clock();
doc->LoadFile( argv[1] );
clock_t loadTime = clock();
int errorID = doc->ErrorID();
delete doc; doc = 0;
clock_t deleteTime = clock();
printf( "Test file '%s' loaded. ErrorID=%d\n", argv[1], errorID );
if ( !errorID ) {
printf( "Load time=%u\n", (unsigned)(loadTime - startTime) );
printf( "Delete time=%u\n", (unsigned)(deleteTime - loadTime) );
printf( "Total time=%u\n", (unsigned)(deleteTime - startTime) );
}
exit(0);
}
FILE* fp = fopen( "resources/dream.xml", "r" );
if ( !fp ) {
printf( "Error opening test file 'dream.xml'.\n"
@@ -178,16 +322,12 @@ int main( int /*argc*/, const char ** /*argv*/ )
}
fclose( fp );
#if defined(_MSC_VER)
#pragma warning ( pop )
#endif
XMLTest( "Example-1", 0, example_1() );
XMLTest( "Example-2", 0, example_2() );
XMLTest( "Example-3", 0, example_3() );
XMLTest( "Example-4", true, example_4() );
/* ------ Example 2: Lookup information. ---- */
/* ------ Example 2: Lookup information. ---- */
{
static const char* test[] = { "<element />",
@@ -268,7 +408,7 @@ int main( int /*argc*/, const char ** /*argv*/ )
XMLTest( "Programmatic DOM", "comment", doc->FirstChildElement( "element" )->FirstChild()->Value() );
XMLTest( "Programmatic DOM", "0", doc->FirstChildElement( "element" )->FirstChildElement()->Attribute( "attrib" ) );
XMLTest( "Programmatic DOM", 2, doc->FirstChildElement()->LastChildElement( "sub" )->IntAttribute( "attrib" ) );
XMLTest( "Programmatic DOM", "& Text!",
XMLTest( "Programmatic DOM", "& Text!",
doc->FirstChildElement()->LastChildElement( "sub" )->FirstChild()->ToText()->Value() );
// And now deletion:
@@ -343,7 +483,7 @@ int main( int /*argc*/, const char ** /*argv*/ )
XMLDocument doc;
doc.Parse( error );
XMLTest( "Bad XML", doc.ErrorID(), (int)XML_ERROR_PARSING_ATTRIBUTE );
XMLTest( "Bad XML", doc.ErrorID(), XML_ERROR_PARSING_ATTRIBUTE );
}
{
@@ -361,6 +501,7 @@ int main( int /*argc*/, const char ** /*argv*/ )
XMLTest( "Query attribute: int as double", result, (int)XML_NO_ERROR );
XMLTest( "Query attribute: int as double", (int)dVal, 1 );
result = ele->QueryDoubleAttribute( "attr1", &dVal );
XMLTest( "Query attribute: double as double", result, (int)XML_NO_ERROR );
XMLTest( "Query attribute: double as double", (int)dVal, 2 );
result = ele->QueryIntAttribute( "attr1", &iVal );
XMLTest( "Query attribute: double as int", result, (int)XML_NO_ERROR );
@@ -379,8 +520,8 @@ int main( int /*argc*/, const char ** /*argv*/ )
XMLElement* ele = doc.FirstChildElement();
int iVal;
double dVal;
int iVal, iVal2;
double dVal, dVal2;
ele->SetAttribute( "str", "strValue" );
ele->SetAttribute( "int", 1 );
@@ -390,10 +531,15 @@ int main( int /*argc*/, const char ** /*argv*/ )
ele->QueryIntAttribute( "int", &iVal );
ele->QueryDoubleAttribute( "double", &dVal );
ele->QueryAttribute( "int", &iVal2 );
ele->QueryAttribute( "double", &dVal2 );
XMLTest( "Attribute match test", ele->Attribute( "str", "strValue" ), "strValue" );
XMLTest( "Attribute round trip. c-string.", "strValue", cStr );
XMLTest( "Attribute round trip. int.", 1, iVal );
XMLTest( "Attribute round trip. double.", -1, (int)dVal );
XMLTest( "Alternate query", true, iVal == iVal2 );
XMLTest( "Alternate query", true, dVal == dVal2 );
}
{
@@ -402,7 +548,7 @@ int main( int /*argc*/, const char ** /*argv*/ )
// Get the attribute "value" from the "Russian" element and check it.
XMLElement* element = doc.FirstChildElement( "document" )->FirstChildElement( "Russian" );
const unsigned char correctValue[] = { 0xd1U, 0x86U, 0xd0U, 0xb5U, 0xd0U, 0xbdU, 0xd0U, 0xbdU,
const unsigned char correctValue[] = { 0xd1U, 0x86U, 0xd0U, 0xb5U, 0xd0U, 0xbdU, 0xd0U, 0xbdU,
0xd0U, 0xbeU, 0xd1U, 0x81U, 0xd1U, 0x82U, 0xd1U, 0x8cU, 0 };
XMLTest( "UTF-8: Russian value.", (const char*)correctValue, element->Attribute( "value" ) );
@@ -424,16 +570,8 @@ int main( int /*argc*/, const char ** /*argv*/ )
// Check the round trip.
int okay = 0;
#if defined(_MSC_VER)
#pragma warning ( push )
#pragma warning ( disable : 4996 ) // Fail to see a compelling reason why this should be deprecated.
#endif
FILE* saved = fopen( "resources/out/utf8testout.xml", "r" );
FILE* verify = fopen( "resources/utf8testverify.xml", "r" );
#if defined(_MSC_VER)
#pragma warning ( pop )
#endif
if ( saved && verify )
{
@@ -479,6 +617,61 @@ int main( int /*argc*/, const char ** /*argv*/ )
}
// --------SetText()-----------
{
const char* str = "<foo></foo>";
XMLDocument doc;
doc.Parse( str );
XMLElement* element = doc.RootElement();
element->SetText("darkness.");
XMLTest( "SetText() normal use (open/close).", "darkness.", element->GetText() );
element->SetText("blue flame.");
XMLTest( "SetText() replace.", "blue flame.", element->GetText() );
str = "<foo/>";
doc.Parse( str );
element = doc.RootElement();
element->SetText("The driver");
XMLTest( "SetText() normal use. (self-closing)", "The driver", element->GetText() );
element->SetText("<b>horses</b>");
XMLTest( "SetText() replace with tag-like text.", "<b>horses</b>", element->GetText() );
//doc.Print();
str = "<foo><bar>Text in nested element</bar></foo>";
doc.Parse( str );
element = doc.RootElement();
element->SetText("wolves");
XMLTest( "SetText() prefix to nested non-text children.", "wolves", element->GetText() );
str = "<foo/>";
doc.Parse( str );
element = doc.RootElement();
element->SetText( "str" );
XMLTest( "SetText types", "str", element->GetText() );
element->SetText( 1 );
XMLTest( "SetText types", "1", element->GetText() );
element->SetText( 1U );
XMLTest( "SetText types", "1", element->GetText() );
element->SetText( true );
XMLTest( "SetText types", "1", element->GetText() ); // TODO: should be 'true'?
element->SetText( 1.5f );
XMLTest( "SetText types", "1.5", element->GetText() );
element->SetText( 1.5 );
XMLTest( "SetText types", "1.5", element->GetText() );
}
// ---------- CDATA ---------------
{
const char* str = "<xmlElement>"
@@ -491,7 +684,7 @@ int main( int /*argc*/, const char ** /*argv*/ )
doc.Parse( str );
doc.Print();
XMLTest( "CDATA parse.", doc.FirstChildElement()->FirstChild()->Value(),
XMLTest( "CDATA parse.", doc.FirstChildElement()->FirstChild()->Value(),
"I am > the rules!\n...since I make symbolic puns",
false );
}
@@ -508,7 +701,7 @@ int main( int /*argc*/, const char ** /*argv*/ )
doc.Parse( str );
doc.Print();
XMLTest( "CDATA parse. [ tixml1:1480107 ]", doc.FirstChildElement()->FirstChild()->Value(),
XMLTest( "CDATA parse. [ tixml1:1480107 ]", doc.FirstChildElement()->FirstChild()->Value(),
"<b>I am > the rules!</b>\n...since I make symbolic puns",
false );
}
@@ -548,28 +741,15 @@ int main( int /*argc*/, const char ** /*argv*/ )
XMLTest( "Entity transformation: read. ", expected, context, true );
#if defined(_MSC_VER)
#pragma warning ( push )
#pragma warning ( disable : 4996 ) // Fail to see a compelling reason why this should be deprecated.
#endif
FILE* textfile = fopen( "resources/out/textfile.txt", "w" );
#if defined(_MSC_VER)
#pragma warning ( pop )
#endif
if ( textfile )
{
XMLPrinter streamer( textfile );
psg->Accept( &streamer );
fclose( textfile );
}
#if defined(_MSC_VER)
#pragma warning ( push )
#pragma warning ( disable : 4996 ) // Fail to see a compelling reason why this should be deprecated.
#endif
textfile = fopen( "resources/out/textfile.txt", "r" );
#if defined(_MSC_VER)
#pragma warning ( pop )
#endif
textfile = fopen( "resources/out/textfile.txt", "r" );
TIXMLASSERT( textfile );
if ( textfile )
{
@@ -590,11 +770,11 @@ int main( int /*argc*/, const char ** /*argv*/ )
"<passages count=\"006\" formatversion=\"20020620\">"
"<psg context=\"Line 5 has &quot;quotation marks&quot; and &apos;apostrophe marks&apos;.\">Crazy &ttk;</psg>"
"</passages>";
XMLDocument doc( false );
doc.Parse( passages );
XMLTest( "No entity parsing.", doc.FirstChildElement()->FirstChildElement()->Attribute( "context" ),
XMLTest( "No entity parsing.", doc.FirstChildElement()->FirstChildElement()->Attribute( "context" ),
"Line 5 has &quot;quotation marks&quot; and &apos;apostrophe marks&apos;." );
XMLTest( "No entity parsing.", doc.FirstChildElement()->FirstChildElement()->FirstChild()->Value(),
"Crazy &ttk;" );
@@ -625,7 +805,7 @@ int main( int /*argc*/, const char ** /*argv*/ )
{
// DOCTYPE not preserved (950171)
//
//
const char* doctype =
"<?xml version=\"1.0\" ?>"
"<!DOCTYPE PLAY SYSTEM 'play.dtd'>"
@@ -639,7 +819,7 @@ int main( int /*argc*/, const char ** /*argv*/ )
doc.DeleteChild( doc.RootElement() );
doc.LoadFile( "resources/out/test7.xml" );
doc.Print();
const XMLUnknown* decl = doc.FirstChild()->NextSibling()->ToUnknown();
XMLTest( "Correct value of unknown.", "DOCTYPE PLAY SYSTEM 'play.dtd'", decl->Value() );
@@ -647,7 +827,7 @@ int main( int /*argc*/, const char ** /*argv*/ )
{
// Comments do not stream out correctly.
const char* doctype =
const char* doctype =
"<!-- Somewhat<evil> -->";
XMLDocument doc;
doc.Parse( doctype );
@@ -662,8 +842,8 @@ int main( int /*argc*/, const char ** /*argv*/ )
XMLDocument doc;
doc.Parse( doctype );
XMLTest( "Parsing repeated attributes.", (int)XML_ERROR_PARSING_ATTRIBUTE, doc.ErrorID() ); // is an error to tinyxml (didn't use to be, but caused issues)
XMLTest( "Parsing repeated attributes.", XML_ERROR_PARSING_ATTRIBUTE, doc.ErrorID() ); // is an error to tinyxml (didn't use to be, but caused issues)
doc.PrintError();
}
@@ -681,7 +861,7 @@ int main( int /*argc*/, const char ** /*argv*/ )
const char* str = " ";
XMLDocument doc;
doc.Parse( str );
XMLTest( "Empty document error", (int)XML_ERROR_EMPTY_DOCUMENT, doc.ErrorID() );
XMLTest( "Empty document error", XML_ERROR_EMPTY_DOCUMENT, doc.ErrorID() );
}
{
@@ -708,8 +888,8 @@ int main( int /*argc*/, const char ** /*argv*/ )
xml.Parse("<x> ");
XMLTest("Missing end tag with trailing whitespace", xml.Error(), true);
xml.Parse("<x></y>");
XMLTest("Mismatched tags", xml.ErrorID(), (int)XML_ERROR_MISMATCHED_ELEMENT);
}
XMLTest("Mismatched tags", xml.ErrorID(), XML_ERROR_MISMATCHED_ELEMENT);
}
{
@@ -756,7 +936,7 @@ int main( int /*argc*/, const char ** /*argv*/ )
XMLDocument doc;
doc.Parse( (const char*)buf);
}
}
{
@@ -806,14 +986,14 @@ int main( int /*argc*/, const char ** /*argv*/ )
}
XMLTest( "Error in snprinf handling.", true, doc.Error() );
}
{
// Attribute ordering.
static const char* xml = "<element attrib1=\"1\" attrib2=\"2\" attrib3=\"3\" />";
XMLDocument doc;
doc.Parse( xml );
XMLElement* ele = doc.FirstChildElement();
const XMLAttribute* a = ele->FirstAttribute();
XMLTest( "Attribute order", "1", a->Value() );
a = a->Next();
@@ -821,13 +1001,13 @@ int main( int /*argc*/, const char ** /*argv*/ )
a = a->Next();
XMLTest( "Attribute order", "3", a->Value() );
XMLTest( "Attribute order", "attrib3", a->Name() );
ele->DeleteAttribute( "attrib2" );
a = ele->FirstAttribute();
XMLTest( "Attribute order", "1", a->Value() );
a = a->Next();
XMLTest( "Attribute order", "3", a->Value() );
ele->DeleteAttribute( "attrib1" );
ele->DeleteAttribute( "attrib3" );
XMLTest( "Attribute order (empty)", false, ele->FirstAttribute() ? true : false );
@@ -879,7 +1059,7 @@ int main( int /*argc*/, const char ** /*argv*/ )
ele = docH.FirstChildElement( "none" ).FirstChildElement( "element" ).ToElement();
XMLTest( "Handle, dne, mutable", false, ele != 0 );
}
{
static const char* xml = "<element attrib='bar'><sub>Text</sub></element>";
XMLDocument doc;
@@ -897,7 +1077,7 @@ int main( int /*argc*/, const char ** /*argv*/ )
XMLDocument doc;
doc.InsertEndChild( doc.NewDeclaration() );
doc.SetBOM( true );
XMLPrinter printer;
doc.Print( &printer );
@@ -946,7 +1126,35 @@ int main( int /*argc*/, const char ** /*argv*/ )
doc.Parse( xml );
XMLTest( "Non-alpha element lead letter parses.", doc.Error(), false );
}
{
const char* xml = "<element _attr1=\"foo\" :attr2=\"bar\"></element>";
XMLDocument doc;
doc.Parse( xml );
XMLTest("Non-alpha attribute lead character parses.", doc.Error(), false);
}
{
const char* xml = "<3lement></3lement>";
XMLDocument doc;
doc.Parse( xml );
XMLTest("Element names with lead digit fail to parse.", doc.Error(), true);
}
{
const char* xml = "<element/>WOA THIS ISN'T GOING TO PARSE";
XMLDocument doc;
doc.Parse( xml, 10 );
XMLTest( "Set length of incoming data", doc.Error(), false );
}
{
XMLDocument doc;
doc.LoadFile( "resources/dream.xml" );
doc.Clear();
XMLTest( "Document Clear()'s", doc.NoChildren(), true );
}
// ----------- Whitespace ------------
{
const char* xml = "<element>"
@@ -966,13 +1174,194 @@ int main( int /*argc*/, const char ** /*argv*/ )
}
}
#if 0
{
// Passes if assert doesn't fire.
XMLDocument xmlDoc;
xmlDoc.NewDeclaration();
xmlDoc.NewComment("Configuration file");
XMLElement *root = xmlDoc.NewElement("settings");
root->SetAttribute("version", 2);
}
#endif
{
const char* xml = "<element> </element>";
XMLDocument doc( true, COLLAPSE_WHITESPACE );
doc.Parse( xml );
XMLTest( "Whitespace all space", true, 0 == doc.FirstChildElement()->FirstChild() );
}
{
// An assert should not fire.
const char* xml = "<element/>";
XMLDocument doc;
doc.Parse( xml );
XMLElement* ele = doc.NewElement( "unused" ); // This will get cleaned up with the 'doc' going out of scope.
XMLTest( "Tracking unused elements", true, ele != 0, false );
}
{
const char* xml = "<parent><child>abc</child></parent>";
XMLDocument doc;
doc.Parse( xml );
XMLElement* ele = doc.FirstChildElement( "parent")->FirstChildElement( "child");
XMLPrinter printer;
ele->Accept( &printer );
XMLTest( "Printing of sub-element", "<child>abc</child>\n", printer.CStr(), false );
}
{
XMLDocument doc;
XMLError error = doc.LoadFile( "resources/empty.xml" );
XMLTest( "Loading an empty file", XML_ERROR_EMPTY_DOCUMENT, error );
}
{
// BOM preservation
static const char* xml_bom_preservation = "\xef\xbb\xbf<element/>\n";
{
XMLDocument doc;
XMLTest( "BOM preservation (parse)", XML_NO_ERROR, doc.Parse( xml_bom_preservation ), false );
XMLPrinter printer;
doc.Print( &printer );
XMLTest( "BOM preservation (compare)", xml_bom_preservation, printer.CStr(), false, true );
doc.SaveFile( "resources/bomtest.xml" );
}
{
XMLDocument doc;
doc.LoadFile( "resources/bomtest.xml" );
XMLTest( "BOM preservation (load)", true, doc.HasBOM(), false );
XMLPrinter printer;
doc.Print( &printer );
XMLTest( "BOM preservation (compare)", xml_bom_preservation, printer.CStr(), false, true );
}
}
{
// Insertion with Removal
const char* xml = "<?xml version=\"1.0\" ?>"
"<root>"
"<one>"
"<subtree>"
"<elem>element 1</elem>text<!-- comment -->"
"</subtree>"
"</one>"
"<two/>"
"</root>";
const char* xmlInsideTwo = "<?xml version=\"1.0\" ?>"
"<root>"
"<one/>"
"<two>"
"<subtree>"
"<elem>element 1</elem>text<!-- comment -->"
"</subtree>"
"</two>"
"</root>";
const char* xmlAfterOne = "<?xml version=\"1.0\" ?>"
"<root>"
"<one/>"
"<subtree>"
"<elem>element 1</elem>text<!-- comment -->"
"</subtree>"
"<two/>"
"</root>";
const char* xmlAfterTwo = "<?xml version=\"1.0\" ?>"
"<root>"
"<one/>"
"<two/>"
"<subtree>"
"<elem>element 1</elem>text<!-- comment -->"
"</subtree>"
"</root>";
XMLDocument doc;
doc.Parse(xml);
XMLElement* subtree = doc.RootElement()->FirstChildElement("one")->FirstChildElement("subtree");
XMLElement* two = doc.RootElement()->FirstChildElement("two");
two->InsertFirstChild(subtree);
XMLPrinter printer1(0, true);
doc.Accept(&printer1);
XMLTest("Move node from within <one> to <two>", xmlInsideTwo, printer1.CStr());
doc.Parse(xml);
subtree = doc.RootElement()->FirstChildElement("one")->FirstChildElement("subtree");
two = doc.RootElement()->FirstChildElement("two");
doc.RootElement()->InsertAfterChild(two, subtree);
XMLPrinter printer2(0, true);
doc.Accept(&printer2);
XMLTest("Move node from within <one> after <two>", xmlAfterTwo, printer2.CStr(), false);
doc.Parse(xml);
XMLNode* one = doc.RootElement()->FirstChildElement("one");
subtree = one->FirstChildElement("subtree");
doc.RootElement()->InsertAfterChild(one, subtree);
XMLPrinter printer3(0, true);
doc.Accept(&printer3);
XMLTest("Move node from within <one> after <one>", xmlAfterOne, printer3.CStr(), false);
doc.Parse(xml);
subtree = doc.RootElement()->FirstChildElement("one")->FirstChildElement("subtree");
two = doc.RootElement()->FirstChildElement("two");
doc.RootElement()->InsertEndChild(subtree);
XMLPrinter printer4(0, true);
doc.Accept(&printer4);
XMLTest("Move node from within <one> after <two>", xmlAfterTwo, printer4.CStr(), false);
}
{
const char* xml = "<svg width = \"128\" height = \"128\">"
" <text> </text>"
"</svg>";
XMLDocument doc;
doc.Parse(xml);
doc.Print();
}
#if 1
// the question being explored is what kind of print to use:
// https://github.com/leethomason/tinyxml2/issues/63
{
//const char* xml = "<element attrA='123456789.123456789' attrB='1.001e9' attrC='1.0e-10' attrD='1001000000.000000' attrE='0.1234567890123456789'/>";
const char* xml = "<element/>";
XMLDocument doc;
doc.Parse( xml );
doc.FirstChildElement()->SetAttribute( "attrA-f64", 123456789.123456789 );
doc.FirstChildElement()->SetAttribute( "attrB-f64", 1.001e9 );
doc.FirstChildElement()->SetAttribute( "attrC-f64", 1.0e9 );
doc.FirstChildElement()->SetAttribute( "attrC-f64", 1.0e20 );
doc.FirstChildElement()->SetAttribute( "attrD-f64", 1.0e-10 );
doc.FirstChildElement()->SetAttribute( "attrD-f64", 0.123456789 );
doc.FirstChildElement()->SetAttribute( "attrA-f32", 123456789.123456789f );
doc.FirstChildElement()->SetAttribute( "attrB-f32", 1.001e9f );
doc.FirstChildElement()->SetAttribute( "attrC-f32", 1.0e9f );
doc.FirstChildElement()->SetAttribute( "attrC-f32", 1.0e20f );
doc.FirstChildElement()->SetAttribute( "attrD-f32", 1.0e-10f );
doc.FirstChildElement()->SetAttribute( "attrD-f32", 0.123456789f );
doc.Print();
/* The result of this test is platform, compiler, and library version dependent. :("
XMLPrinter printer;
doc.Print( &printer );
XMLTest( "Float and double formatting.",
"<element attrA-f64=\"123456789.12345679\" attrB-f64=\"1001000000\" attrC-f64=\"1e+20\" attrD-f64=\"0.123456789\" attrA-f32=\"1.2345679e+08\" attrB-f32=\"1.001e+09\" attrC-f32=\"1e+20\" attrD-f32=\"0.12345679\"/>\n",
printer.CStr(),
true );
*/
}
#endif
// ----------- Performance tracking --------------
{
#if defined( _MSC_VER )
@@ -980,14 +1369,7 @@ int main( int /*argc*/, const char ** /*argv*/ )
QueryPerformanceFrequency( (LARGE_INTEGER*) &freq );
#endif
#if defined(_MSC_VER)
#pragma warning ( push )
#pragma warning ( disable : 4996 ) // Fail to see a compelling reason why this should be deprecated.
#endif
FILE* fp = fopen( "resources/dream.xml", "r" );
#if defined(_MSC_VER)
#pragma warning ( pop )
#endif
fseek( fp, 0, SEEK_END );
long size = ftell( fp );
fseek( fp, 0, SEEK_SET );
@@ -1015,7 +1397,7 @@ int main( int /*argc*/, const char ** /*argv*/ )
delete [] mem;
static const char* note =
static const char* note =
#ifdef DEBUG
"DEBUG";
#else
@@ -1030,7 +1412,7 @@ int main( int /*argc*/, const char ** /*argv*/ )
}
#if defined( _MSC_VER ) && defined( DEBUG )
_CrtMemCheckpoint( &endMemState );
_CrtMemCheckpoint( &endMemState );
//_CrtMemDumpStatistics( &endMemState );
_CrtMemState diffMemState;
@@ -1040,5 +1422,6 @@ int main( int /*argc*/, const char ** /*argv*/ )
#endif
printf ("\nPass %d, Fail %d\n", gPass, gFail);
return 0;
return gFail;
}

129
xmltest.h
View File

@@ -1,129 +0,0 @@
// Purely doxygen documentation
// What follows is the docs for the examples.
// I'd like the docs to be just before the
// actual examples in xmltest.cpp, but I
// can't seem to get doxygen to do that. It
// would be a wonderful patch if anyone figures
// it out.
/** @page Example-1 Load an XML File
* @dontinclude ./xmltest.cpp
* Basic XML file loading.
* The basic syntax to load an XML file from
* disk and check for an error. (ErrorID()
* will return 0 for no error.)
* @skip example_1()
* @until }
*/
/** @page Example-2 Parse an XML from char buffer
* @dontinclude ./xmltest.cpp
* Basic XML string parsing.
* The basic syntax to parse an XML for
* a char* and check for an error. (ErrorID()
* will return 0 for no error.)
* @skip example_2()
* @until }
*/
/** @page Example-3 Get information out of XML
@dontinclude ./xmltest.cpp
In this example, we navigate a simple XML
file, and read some interesting text. Note
that this is examlpe doesn't use error
checking; working code should check for null
pointers when walking an XML tree, or use
XMLHandle.
(The XML is an excerpt from "dream.xml").
@skip example_3
@until </PLAY>";
The structure of the XML file is:
<ul>
<li>(declaration)</li>
<li>(dtd stuff)</li>
<li>Element "PLAY"</li>
<ul>
<li>Element "TITLE"</li>
<ul>
<li>Text "A Midsummer Night's Dream"</li>
</ul>
</ul>
</ul>
For this example, we want to print out the
title of the play. The text of the title (what
we want) is child of the "TITLE" element which
is a child of the "PLAY" element.
We want to skip the declaration and dtd, so the
method FirstChildElement() is a good choice. The
FirstChildElement() of the Document is the "PLAY"
Element, the FirstChildElement() of the "PLAY" Element
is the "TITLE" Element.
@until ( "TITLE" );
We can then use the convenience function GetText()
to get the title of the play.
@until title );
Text is just another Node in the XML DOM. And in
fact you should be a little cautious with it, as
text nodes can contain elements.
@verbatim
Consider: A Midsummer Night's <b>Dream</b>
@endverbatim
It is more correct to actually query the Text Node
if in doubt:
@until title );
Noting that here we use FirstChild() since we are
looking for XMLText, not an element, and ToText()
is a cast from a Node to a XMLText.
*/
/** @page Example-4 Read attributes and text information.
@dontinclude ./xmltest.cpp
There are fundamentally 2 ways of writing a key-value
pair into an XML file. (Something that's always annoyed
me about XML.) Either by using attributes, or by writing
the key name into an element and the value into
the text node wrapped by the element. Both approaches
are illustrated in this example, which shows two ways
to encode the value "2" into the key "v":
@skip example_4
@until "</information>";
TinyXML-2 has accessors for both approaches.
When using an attribute, you navigate to the XMLElement
with that attribute and use the QueryIntAttribute()
group of methods. (Also QueryFloatAttribute(), etc.)
@skip XMLElement* attributeApproachElement
@until &v0 );
When using the text approach, you need to navigate
down one more step to the XMLElement that contains
the text. Note the extra FirstChildElement( "v" )
in the code below. The value of the text can then
be safely queried with the QueryIntText() group
of methods. (Also QueryFloatText(), etc.)
@skip XMLElement* textApproachElement
@until &v1 );
*/