mirror of
https://github.com/AxioDL/tinyxml2.git
synced 2025-12-09 05:27:44 +00:00
Compare commits
220 Commits
whitespace
...
mikemayer6
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c3cdfa6349 | ||
|
|
282285a069 | ||
|
|
f2496f5824 | ||
|
|
853de8169b | ||
|
|
869f1487e2 | ||
|
|
6d202ff20e | ||
|
|
72bb0ecc39 | ||
|
|
9de541f465 | ||
|
|
b0776aeead | ||
|
|
5ee1c6ef77 | ||
|
|
9fb2b0f42c | ||
|
|
5321a0e21f | ||
|
|
c755667aa0 | ||
|
|
331596e83c | ||
|
|
cd8550c29c | ||
|
|
9f52ad5289 | ||
|
|
003368429f | ||
|
|
8f5d3f8e80 | ||
|
|
bb5ffac22d | ||
|
|
fb732f97d4 | ||
|
|
3659fe1d33 | ||
|
|
cf6d886903 | ||
|
|
e3225b1c64 | ||
|
|
30152836da | ||
|
|
83a6d8c373 | ||
|
|
d526944e3c | ||
|
|
b6b4e82626 | ||
|
|
59b9aaea43 | ||
|
|
ec19a0e513 | ||
|
|
b6ea923f0f | ||
|
|
63f3de1a3c | ||
|
|
dc50a31758 | ||
|
|
67a5bb0ac1 | ||
|
|
0b26702ac9 | ||
|
|
01578db56b | ||
|
|
2af5679b26 | ||
|
|
5657176b61 | ||
|
|
73c822c201 | ||
|
|
acb9c9c260 | ||
|
|
fca00d0ebc | ||
|
|
08e7f7be59 | ||
|
|
84bd9624c6 | ||
|
|
91d34a0989 | ||
|
|
cf33e37d25 | ||
|
|
d740b64044 | ||
|
|
500fb6aa21 | ||
|
|
ca5d684a2b | ||
|
|
6ee53e7d49 | ||
|
|
256adb6371 | ||
|
|
98112fcdba | ||
|
|
433f1272d4 | ||
|
|
b59ac45131 | ||
|
|
a0744c8dca | ||
|
|
8f7b87b323 | ||
|
|
686ef404b8 | ||
|
|
e7eb7d3327 | ||
|
|
5938e6f8a4 | ||
|
|
268c683fbd | ||
|
|
85afe9c5c7 | ||
|
|
6324acd9f9 | ||
|
|
f4a8fbbdf7 | ||
|
|
e693488742 | ||
|
|
613410095c | ||
|
|
5f88e72691 | ||
|
|
7de26f7dc7 | ||
|
|
82d3200571 | ||
|
|
c18eb23326 | ||
|
|
5d1d27e88b | ||
|
|
07ac762b80 | ||
|
|
b85b4e0a60 | ||
|
|
ca412e87f2 | ||
|
|
15354f88c3 | ||
|
|
d5c9e8b81d | ||
|
|
593a33d061 | ||
|
|
53fe47c74e | ||
|
|
35ce309f73 | ||
|
|
2861a7e63a | ||
|
|
5bb2d8079b | ||
|
|
9c0678a01d | ||
|
|
321072ee0b | ||
|
|
664d05662e | ||
|
|
4cd1f269c2 | ||
|
|
ff8e2041dd | ||
|
|
4af5573f42 | ||
|
|
c1c20bb196 | ||
|
|
7411c08e90 | ||
|
|
dcefa0e43f | ||
|
|
869bb599c1 | ||
|
|
85fff5e50a | ||
|
|
8fe342a872 | ||
|
|
44ce7930b7 | ||
|
|
c3708ccf08 | ||
|
|
2ece2f1690 | ||
|
|
ba4b328b3d | ||
|
|
343a5ff3bd | ||
|
|
3dacebf8ee | ||
|
|
61871d60a6 | ||
|
|
ce0510ba2d | ||
|
|
3bc3d4e24c | ||
|
|
4e74b13e7a | ||
|
|
370761b179 | ||
|
|
690ba07bda | ||
|
|
e1979a883b | ||
|
|
5613cb9237 | ||
|
|
3b7927efb5 | ||
|
|
68a1c93e2e | ||
|
|
ed52328ced | ||
|
|
ab42b16bac | ||
|
|
2162688ad3 | ||
|
|
927fe73c5b | ||
|
|
d31021392a | ||
|
|
bc785155f2 | ||
|
|
9460e5093c | ||
|
|
44ba601c5f | ||
|
|
59c75d3322 | ||
|
|
74a81cf1d9 | ||
|
|
1f83145cb4 | ||
|
|
1688114e55 | ||
|
|
03238517b3 | ||
|
|
1bfb95488f | ||
|
|
db304256bb | ||
|
|
70d343f513 | ||
|
|
8b482728ef | ||
|
|
9c1ef1d4a3 | ||
|
|
032aa1b96c | ||
|
|
721b42da8e | ||
|
|
95060350bd | ||
|
|
0c55c70b11 | ||
|
|
16ed47dc14 | ||
|
|
1c9250cab5 | ||
|
|
1c5f99e37c | ||
|
|
632c57217c | ||
|
|
392bcd2485 | ||
|
|
9a975b7bdb | ||
|
|
def0d2131a | ||
|
|
6db1321100 | ||
|
|
d60fe35073 | ||
|
|
6189231187 | ||
|
|
d6bd7360b8 | ||
|
|
f76fe94012 | ||
|
|
6a0db4f7e6 | ||
|
|
576003627c | ||
|
|
a5221869c2 | ||
|
|
36307f86da | ||
|
|
1470edc595 | ||
|
|
a8ae1f6a4d | ||
|
|
d0a38c3a20 | ||
|
|
1377fe7ec0 | ||
|
|
761c4c2ed5 | ||
|
|
6faf169695 | ||
|
|
43229f91d4 | ||
|
|
1cfafd0d24 | ||
|
|
c510a8c76e | ||
|
|
4dd59bcdf4 | ||
|
|
e77e19553d | ||
|
|
5a695f0e0c | ||
|
|
0fd8746f64 | ||
|
|
374c25e2a6 | ||
|
|
5efaa5f6bb | ||
|
|
61cea67517 | ||
|
|
ac83b4e278 | ||
|
|
c97ded4872 | ||
|
|
53ab79afad | ||
|
|
a9d42b0dd3 | ||
|
|
8afdb09aa4 | ||
|
|
8e66b77c91 | ||
|
|
86ca9dc1ee | ||
|
|
63339bcd7d | ||
|
|
0aecb5c770 | ||
|
|
95b3e6543b | ||
|
|
c6d02f48d5 | ||
|
|
23e7ae6085 | ||
|
|
178e4ccd5b | ||
|
|
980e535aae | ||
|
|
c9c8b77d87 | ||
|
|
bbad12a922 | ||
|
|
4504aab21d | ||
|
|
dfc494ffc5 | ||
|
|
267d4d8f8e | ||
|
|
39ddc268cb | ||
|
|
3acf157857 | ||
|
|
9352408301 | ||
|
|
4ee49f1690 | ||
|
|
f563fa1a29 | ||
|
|
273f7b4cf8 | ||
|
|
15408a952d | ||
|
|
ec3454bafc | ||
|
|
242c3eaa33 | ||
|
|
a6412ac2d5 | ||
|
|
5b0a677712 | ||
|
|
998116e587 | ||
|
|
685b895172 | ||
|
|
8950b37aa0 | ||
|
|
248e523dad | ||
|
|
2fa8172236 | ||
|
|
04c22d250a | ||
|
|
67abded7f7 | ||
|
|
687f90e843 | ||
|
|
ae9ab0741e | ||
|
|
7921df1b47 | ||
|
|
856da21652 | ||
|
|
7fbefab95d | ||
|
|
1aa8fc4a1e | ||
|
|
624d43fc05 | ||
|
|
ed5c879dfe | ||
|
|
120b3a62be | ||
|
|
a9cf3f9f3f | ||
|
|
3572ae0308 | ||
|
|
a5716b787a | ||
|
|
3cd66ee850 | ||
|
|
99024dc20b | ||
|
|
fc6320e30a | ||
|
|
ac8e0ce21c | ||
|
|
0922b7389f | ||
|
|
e2bcb32494 | ||
|
|
2f1f6247e0 | ||
|
|
6da5410110 | ||
|
|
79869e77f9 | ||
|
|
9b6011c478 | ||
|
|
186476c665 |
4
.gitignore
vendored
4
.gitignore
vendored
@@ -3,7 +3,11 @@ Win32/
|
|||||||
x64/
|
x64/
|
||||||
ipch/
|
ipch/
|
||||||
resources/out/
|
resources/out/
|
||||||
|
tinyxml2/tinyxml2-cbp/bin/
|
||||||
|
tinyxml2/tinyxml2-cbp/obj/
|
||||||
*.sdf
|
*.sdf
|
||||||
*.suo
|
*.suo
|
||||||
*.opensdf
|
*.opensdf
|
||||||
*.user
|
*.user
|
||||||
|
*.depend
|
||||||
|
*.layout
|
||||||
@@ -10,8 +10,8 @@ include(GNUInstallDirs)
|
|||||||
################################
|
################################
|
||||||
# set lib version here
|
# set lib version here
|
||||||
|
|
||||||
set(GENERIC_LIB_VERSION "1.0.7")
|
set(GENERIC_LIB_VERSION "2.2.0")
|
||||||
set(GENERIC_LIB_SOVERSION "1")
|
set(GENERIC_LIB_SOVERSION "2")
|
||||||
|
|
||||||
|
|
||||||
################################
|
################################
|
||||||
@@ -32,6 +32,7 @@ else(${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_BINARY_DIR})
|
|||||||
add_custom_target(
|
add_custom_target(
|
||||||
${TARGET_DATA_COPY}
|
${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/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/utf8test.xml ${CMAKE_CURRENT_BINARY_DIR}/resources/
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/resources/utf8testverify.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})
|
endif(${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_BINARY_DIR})
|
||||||
@@ -52,6 +53,7 @@ if(BUILD_STATIC_LIBS)
|
|||||||
endif(BUILD_STATIC_LIBS)
|
endif(BUILD_STATIC_LIBS)
|
||||||
add_library(tinyxml2 SHARED tinyxml2.cpp tinyxml2.h)
|
add_library(tinyxml2 SHARED tinyxml2.cpp tinyxml2.h)
|
||||||
set_target_properties(tinyxml2 PROPERTIES
|
set_target_properties(tinyxml2 PROPERTIES
|
||||||
|
COMPILE_DEFINITIONS "TINYXML2_EXPORT"
|
||||||
VERSION "${GENERIC_LIB_VERSION}"
|
VERSION "${GENERIC_LIB_VERSION}"
|
||||||
SOVERSION "${GENERIC_LIB_SOVERSION}")
|
SOVERSION "${GENERIC_LIB_SOVERSION}")
|
||||||
|
|
||||||
@@ -63,10 +65,12 @@ target_link_libraries(test tinyxml2)
|
|||||||
|
|
||||||
if(BUILD_STATIC_LIBS)
|
if(BUILD_STATIC_LIBS)
|
||||||
install(TARGETS tinyxml2 tinyxml2static
|
install(TARGETS tinyxml2 tinyxml2static
|
||||||
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||||
else(BUILD_STATIC_LIBS)
|
else(BUILD_STATIC_LIBS)
|
||||||
install(TARGETS tinyxml2
|
install(TARGETS tinyxml2
|
||||||
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||||
endif(BUILD_STATIC_LIBS)
|
endif(BUILD_STATIC_LIBS)
|
||||||
install(FILES tinyxml2.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
install(FILES tinyxml2.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
||||||
|
|||||||
2
Makefile
2
Makefile
@@ -1,4 +1,6 @@
|
|||||||
all: xmltest
|
all: xmltest
|
||||||
xmltest: xmltest.cpp tinyxml2.cpp tinyxml2.h
|
xmltest: xmltest.cpp tinyxml2.cpp tinyxml2.h
|
||||||
|
test: clean xmltest
|
||||||
|
./xmltest
|
||||||
clean:
|
clean:
|
||||||
rm -f *.o xmltest
|
rm -f *.o xmltest
|
||||||
|
|||||||
BIN
TinyXML2_small.png
Normal file
BIN
TinyXML2_small.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 326 KiB |
108
contrib/html5-printer.cpp
Normal file
108
contrib/html5-printer.cpp
Normal 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/>©<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;
|
||||||
|
}
|
||||||
67
readme.md
67
readme.md
@@ -1,7 +1,8 @@
|
|||||||
TinyXML-2
|
TinyXML-2
|
||||||
=========
|
=========
|
||||||
|

|
||||||
|
|
||||||
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.
|
easily integrated into other programs.
|
||||||
|
|
||||||
The master is hosted on github:
|
The master is hosted on github:
|
||||||
@@ -15,7 +16,7 @@ Examples are in the "related pages" tab of the HTML docs.
|
|||||||
What it does.
|
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.
|
Document Object Model (DOM) that can be read, modified, and saved.
|
||||||
|
|
||||||
XML stands for "eXtensible Markup Language." It is a general purpose
|
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 XML output. TinyXML-2 should compile on any reasonably C++
|
||||||
compliant system. It does not rely on exceptions, RTTI, or the STL.
|
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
|
TinyXML-2 doesn't parse or use DTDs (Document Type Definitions) or XSLs
|
||||||
(eXtensible Stylesheet Language.) There are other parsers out there
|
(eXtensible Stylesheet Language.) There are other parsers out there
|
||||||
that are much more fully
|
that are much more fully featured. But they are also much bigger,
|
||||||
featured. But they are also much bigger, take longer to set up in
|
take longer to set up in your project, have a higher learning curve,
|
||||||
your project, have a higher learning curve, and often have a more
|
and often have a more restrictive license. If you are working with
|
||||||
restrictive license. If you are working with browsers or have more
|
browsers or have more complete XML needs, TinyXML-2 is not the parser for you.
|
||||||
complete XML needs, TinyXML-2 is not the parser for you.
|
|
||||||
|
|
||||||
TinyXML-1 vs. TinyXML-2
|
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
|
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,
|
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
|
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
|
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
|
### White Space
|
||||||
|
|
||||||
|
#### Whitespace Preservation (default)
|
||||||
|
|
||||||
Microsoft has an excellent article on white space: http://msdn.microsoft.com/en-us/library/ms256097.aspx
|
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
|
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
|
As a first step, all newlines / carriage-returns / line-feeds are normalized to a
|
||||||
line-feed character, as required by the XML spec.
|
line-feed character, as required by the XML spec.
|
||||||
@@ -136,17 +141,18 @@ valuable. TinyXML-2 sees these as the same XML:
|
|||||||
|
|
||||||
#### Whitespace Collapse
|
#### Whitespace Collapse
|
||||||
|
|
||||||
For some applications, it is preferable to collapse whitespace. TinyXML-2
|
For some applications, it is preferable to collapse whitespace. Collapsing
|
||||||
supports this with the 'whitespace' parameter to the XMLDocument constructor.
|
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.)
|
(The default is to preserve whitespace, as described above.)
|
||||||
|
|
||||||
However, you may also use COLLAPSE_WHITESPACE, which will:
|
However, you may also use COLLAPSE_WHITESPACE, which will:
|
||||||
|
|
||||||
* Remove leading and trailing whitespace
|
* Remove leading and trailing whitespace
|
||||||
* Convert newlines and line-feeds into a space character
|
* Convert newlines and line-feeds into a space character
|
||||||
* Collapse a run of any number of space characters into a single 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.
|
|
||||||
|
|
||||||
Note that (currently) there is a performance impact for using COLLAPSE_WHITESPACE.
|
Note that (currently) there is a performance impact for using COLLAPSE_WHITESPACE.
|
||||||
It essentially causes the XML to be parsed twice.
|
It essentially causes the XML to be parsed twice.
|
||||||
@@ -162,7 +168,7 @@ characters. Namely:
|
|||||||
" "
|
" "
|
||||||
' '
|
' '
|
||||||
|
|
||||||
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:
|
UTF-8 equivalents. For instance, text with the XML of:
|
||||||
|
|
||||||
Far & Away
|
Far & Away
|
||||||
@@ -194,7 +200,7 @@ Or the XMLPrinter class:
|
|||||||
Printing to memory is supported by the XMLPrinter.
|
Printing to memory is supported by the XMLPrinter.
|
||||||
|
|
||||||
XMLPrinter printer;
|
XMLPrinter printer;
|
||||||
doc->Print( &printer );
|
doc.Print( &printer );
|
||||||
// printer.CStr() has a const char* to the XML
|
// printer.CStr() has a const char* to the XML
|
||||||
|
|
||||||
#### Print without an XMLDocument
|
#### Print without an XMLDocument
|
||||||
@@ -259,8 +265,17 @@ And additionally a test file:
|
|||||||
* xmltest.cpp
|
* xmltest.cpp
|
||||||
|
|
||||||
Simply compile and run. There is a visual studio 2010 project included, a simple Makefile,
|
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
|
an XCode project, a Code::Blocks project, and a cmake CMakeLists.txt included to help you.
|
||||||
even has a simple g++ command line if you are are *nix and don't want to use a build system.
|
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.
|
||||||
|
|
||||||
|
Versioning
|
||||||
|
----------
|
||||||
|
|
||||||
|
TinyXML-2 uses semantic versioning. http://semver.org/ Releases are now tagged in github.
|
||||||
|
|
||||||
|
Note that the major version will (probably) change fairly rapidly. API changes are fairly
|
||||||
|
common.
|
||||||
|
|
||||||
Documentation
|
Documentation
|
||||||
-------------
|
-------------
|
||||||
@@ -301,5 +316,9 @@ in shaping what is a very successful library. Extra thanks to Yves
|
|||||||
Berquin and Andrew Ellerton who were key contributors.
|
Berquin and Andrew Ellerton who were key contributors.
|
||||||
|
|
||||||
TinyXML-2 grew from that effort. Lee Thomason is the original author
|
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
|
of TinyXML-2 (and TinyXML-1) but TinyXML-2 has been and is being improved
|
||||||
by many contributors.
|
by many contributors.
|
||||||
|
|
||||||
|
Thanks to John Mackay at http://john.mackay.rosalilastudio.com for the TinyXML-2 logo!
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
67
resources/dictionary.xml
Normal file
67
resources/dictionary.xml
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
<!DOCTYPE Dictionary [
|
||||||
|
<!-- Test of the ability to parse internally defined DTD -->
|
||||||
|
<!-- Test for comment nastiness: <]> -->
|
||||||
|
<!ELEMENT Dictionary (Storage+) >
|
||||||
|
<!ELEMENT Storage (WordFile+, WordList?) >
|
||||||
|
<!ELEMENT Growth EMPTY >
|
||||||
|
<!ELEMENT WordFile (Growth?) >
|
||||||
|
<!ELEMENT WordList (Initialization?) >
|
||||||
|
<!ELEMENT Initialization EMPTY >
|
||||||
|
|
||||||
|
<!ATTLIST Storage name CDATA #REQUIRED
|
||||||
|
life (permanent|temporary) "permanent"
|
||||||
|
tested (true|false) "true">
|
||||||
|
|
||||||
|
<!ATTLIST WordFile name CDATA #REQUIRED
|
||||||
|
size CDATA "500M"
|
||||||
|
recyled (true|false) "true"
|
||||||
|
tracking (on|off) "off">
|
||||||
|
|
||||||
|
<!ATTLIST Growth next CDATA "500M"
|
||||||
|
max CDATA "unlimited">
|
||||||
|
|
||||||
|
<!ATTLIST WordList method (local|dictionary) "local">
|
||||||
|
|
||||||
|
<!ATTLIST Initialization method (dynamic|static) "dynamic"
|
||||||
|
size CDATA "1M" >
|
||||||
|
|
||||||
|
]>
|
||||||
|
|
||||||
|
<Dictionary>
|
||||||
|
|
||||||
|
<Storage name="APP_DATA" life="permanent" tested="true">
|
||||||
|
<WordFile name="/data15/local/task_list01.dict" size="250M" recyled="true" tracking="off">
|
||||||
|
</WordFile>
|
||||||
|
<WordFile name="/data15/local/task_list02.dict" size="250M" recyled="true" tracking="on">
|
||||||
|
<Growth next="500M" max="unlimited"/>
|
||||||
|
</WordFile>
|
||||||
|
<WordList method="local">
|
||||||
|
<Initialization method="dynamic"/>
|
||||||
|
</WordList>
|
||||||
|
</Storage>
|
||||||
|
|
||||||
|
|
||||||
|
<Storage name="APP_INDEX" life="permanent" tested="true">
|
||||||
|
<WordFile name="/data20/local/site_list01.dict" size="250M" recyled="true" tracking="off">
|
||||||
|
</WordFile>
|
||||||
|
<WordFile name="/data20/local/site_list02.dict" size="250M" recyled="true" tracking="on">
|
||||||
|
<Growth next="500M" max="unlimited"/>
|
||||||
|
</WordFile>
|
||||||
|
<WordList method="local">
|
||||||
|
<Initialization method="dynamic"/>
|
||||||
|
</WordList>
|
||||||
|
</Storage>
|
||||||
|
|
||||||
|
|
||||||
|
<Storage name="APP_TEMP" life="temporary" tested="false">
|
||||||
|
<WordFile name="/data23/local/user_words01.dict" size="500M" recyled="true" tracking="on">
|
||||||
|
<Growth next="500M" max="unlimited"/>
|
||||||
|
</WordFile>
|
||||||
|
<WordList method="local">
|
||||||
|
<Initialization method="static" size="1M"/>
|
||||||
|
</WordList>
|
||||||
|
</Storage>
|
||||||
|
|
||||||
|
</Dictionary>
|
||||||
0
resources/empty.xml
Normal file
0
resources/empty.xml
Normal file
@@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
|
import optparse
|
||||||
|
|
||||||
def fileProcess( name, lineFunction ):
|
def fileProcess( name, lineFunction ):
|
||||||
filestream = open( name, 'r' )
|
filestream = open( name, 'r' )
|
||||||
@@ -25,16 +26,21 @@ def fileProcess( name, lineFunction ):
|
|||||||
filestream.write( output );
|
filestream.write( output );
|
||||||
filestream.close()
|
filestream.close()
|
||||||
|
|
||||||
|
|
||||||
def echoInput( line ):
|
def echoInput( line ):
|
||||||
return line
|
return line
|
||||||
|
|
||||||
major = input( "Major: " )
|
parser = optparse.OptionParser( "usage: %prog major minor build" )
|
||||||
minor = input( "Minor: " )
|
(options, args) = parser.parse_args()
|
||||||
build = input( "Build: " )
|
if len(args) != 3:
|
||||||
|
parser.error( "incorrect number of arguments" );
|
||||||
|
|
||||||
print "Setting dox,tinyxml2.h"
|
major = args[0]
|
||||||
print "Version: " + `major` + "." + `minor` + "." + `build`
|
minor = args[1]
|
||||||
|
build = args[2]
|
||||||
|
versionStr = major + "." + minor + "." + build
|
||||||
|
|
||||||
|
print ("Setting dox,tinyxml2.h")
|
||||||
|
print ("Version: " + major + "." + minor + "." + build)
|
||||||
|
|
||||||
#### Write the tinyxml.h ####
|
#### Write the tinyxml.h ####
|
||||||
|
|
||||||
@@ -45,16 +51,16 @@ def engineRule( line ):
|
|||||||
matchBuild = "static const int TIXML2_PATCH_VERSION"
|
matchBuild = "static const int TIXML2_PATCH_VERSION"
|
||||||
|
|
||||||
if line[0:len(matchMajor)] == matchMajor:
|
if line[0:len(matchMajor)] == matchMajor:
|
||||||
print "1)tinyxml2.h Major found"
|
print( "1)tinyxml2.h Major found" )
|
||||||
return matchMajor + " = " + `major` + ";\n"
|
return matchMajor + " = " + major + ";\n"
|
||||||
|
|
||||||
elif line[0:len(matchMinor)] == matchMinor:
|
elif line[0:len(matchMinor)] == matchMinor:
|
||||||
print "2)tinyxml2.h Minor found"
|
print( "2)tinyxml2.h Minor found" )
|
||||||
return matchMinor + " = " + `minor` + ";\n"
|
return matchMinor + " = " + minor + ";\n"
|
||||||
|
|
||||||
elif line[0:len(matchBuild)] == matchBuild:
|
elif line[0:len(matchBuild)] == matchBuild:
|
||||||
print "3)tinyxml2.h Build found"
|
print( "3)tinyxml2.h Build found" )
|
||||||
return matchBuild + " = " + `build` + ";\n"
|
return matchBuild + " = " + build + ";\n"
|
||||||
|
|
||||||
else:
|
else:
|
||||||
return line;
|
return line;
|
||||||
@@ -69,8 +75,8 @@ def doxRule( line ):
|
|||||||
match = "PROJECT_NUMBER"
|
match = "PROJECT_NUMBER"
|
||||||
|
|
||||||
if line[0:len( match )] == match:
|
if line[0:len( match )] == match:
|
||||||
print "dox project found"
|
print( "dox project found" )
|
||||||
return "PROJECT_NUMBER = " + `major` + "." + `minor` + "." + `build` + "\n"
|
return "PROJECT_NUMBER = " + major + "." + minor + "." + build + "\n"
|
||||||
|
|
||||||
else:
|
else:
|
||||||
return line;
|
return line;
|
||||||
@@ -85,8 +91,8 @@ def cmakeRule1( line ):
|
|||||||
matchVersion = "set(GENERIC_LIB_VERSION"
|
matchVersion = "set(GENERIC_LIB_VERSION"
|
||||||
|
|
||||||
if line[0:len(matchVersion)] == matchVersion:
|
if line[0:len(matchVersion)] == matchVersion:
|
||||||
print "1)tinyxml2.h Major found"
|
print( "1)tinyxml2.h Major found" )
|
||||||
return matchVersion + " \"" + `major` + "." + `minor` + "." + `build` + "\")" + "\n"
|
return matchVersion + " \"" + major + "." + minor + "." + build + "\")" + "\n"
|
||||||
|
|
||||||
else:
|
else:
|
||||||
return line;
|
return line;
|
||||||
@@ -98,10 +104,20 @@ def cmakeRule2( line ):
|
|||||||
matchSoversion = "set(GENERIC_LIB_SOVERSION"
|
matchSoversion = "set(GENERIC_LIB_SOVERSION"
|
||||||
|
|
||||||
if line[0:len(matchSoversion)] == matchSoversion:
|
if line[0:len(matchSoversion)] == matchSoversion:
|
||||||
print "1)tinyxml2.h Major found"
|
print( "1)tinyxml2.h Major found" )
|
||||||
return matchSoversion + " \"" + `major` + "\")" + "\n"
|
return matchSoversion + " \"" + major + "\")" + "\n"
|
||||||
|
|
||||||
else:
|
else:
|
||||||
return line;
|
return line;
|
||||||
|
|
||||||
fileProcess( "CMakeLists.txt", cmakeRule2 )
|
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 )
|
||||||
|
print( ' OR git tag -a ' + versionStr + ' -m [tag message]' )
|
||||||
|
print( 'Remember to "git push" both code and tag. For the tag:' )
|
||||||
|
print( 'git push origin [tagname]')
|
||||||
|
|
||||||
|
|
||||||
2822
tinyxml2.cpp
Normal file → Executable file
2822
tinyxml2.cpp
Normal file → Executable file
File diff suppressed because it is too large
Load Diff
2636
tinyxml2.h
Normal file → Executable file
2636
tinyxml2.h
Normal file → Executable file
File diff suppressed because it is too large
Load Diff
26
tinyxml2.sln
26
tinyxml2.sln
@@ -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
347
tinyxml2/test.vcxproj
Normal 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>
|
||||||
6
tinyxml2/test.vcxproj.filters
Normal file
6
tinyxml2/test.vcxproj.filters
Normal 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>
|
||||||
3
tinyxml2/tinyxml2-cbp/README
Normal file
3
tinyxml2/tinyxml2-cbp/README
Normal 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.
|
||||||
49
tinyxml2/tinyxml2-cbp/tinyxml2-cbp.cbp
Normal file
49
tinyxml2/tinyxml2-cbp/tinyxml2-cbp.cbp
Normal 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
56
tinyxml2/tinyxml2.sln
Executable 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
357
tinyxml2/tinyxml2.vcxproj
Normal file → Executable file
@@ -1,158 +1,383 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<ItemGroup Label="ProjectConfigurations">
|
<ItemGroup Label="ProjectConfigurations">
|
||||||
<ProjectConfiguration Include="Debug|Win32">
|
<ProjectConfiguration Include="Debug-Dll|Win32">
|
||||||
<Configuration>Debug</Configuration>
|
<Configuration>Debug-Dll</Configuration>
|
||||||
<Platform>Win32</Platform>
|
<Platform>Win32</Platform>
|
||||||
</ProjectConfiguration>
|
</ProjectConfiguration>
|
||||||
<ProjectConfiguration Include="Debug|x64">
|
<ProjectConfiguration Include="Debug-Dll|x64">
|
||||||
<Configuration>Debug</Configuration>
|
<Configuration>Debug-Dll</Configuration>
|
||||||
<Platform>x64</Platform>
|
<Platform>x64</Platform>
|
||||||
</ProjectConfiguration>
|
</ProjectConfiguration>
|
||||||
<ProjectConfiguration Include="Release|Win32">
|
<ProjectConfiguration Include="Debug-Lib|Win32">
|
||||||
<Configuration>Release</Configuration>
|
<Configuration>Debug-Lib</Configuration>
|
||||||
<Platform>Win32</Platform>
|
<Platform>Win32</Platform>
|
||||||
</ProjectConfiguration>
|
</ProjectConfiguration>
|
||||||
<ProjectConfiguration Include="Release|x64">
|
<ProjectConfiguration Include="Debug-Lib|x64">
|
||||||
<Configuration>Release</Configuration>
|
<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>
|
<Platform>x64</Platform>
|
||||||
</ProjectConfiguration>
|
</ProjectConfiguration>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<PropertyGroup Label="Globals">
|
<PropertyGroup Label="Globals">
|
||||||
<ProjectGuid>{16A1D446-5415-444E-A7B4-F35B7DA7EE8C}</ProjectGuid>
|
<ProjectGuid>{D1C528B6-AA02-4D29-9D61-DC08E317A70D}</ProjectGuid>
|
||||||
<Keyword>Win32Proj</Keyword>
|
<Keyword>Win32Proj</Keyword>
|
||||||
<RootNamespace>tinyxml2</RootNamespace>
|
<RootNamespace>tinyxml2</RootNamespace>
|
||||||
<VCTargetsPath Condition="'$(VCTargetsPath11)' != '' and '$(VSVersion)' == '' and $(VisualStudioVersion) == ''">$(VCTargetsPath11)</VCTargetsPath>
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-Lib|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-Dll|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-Lib|x64'" Label="Configuration">
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
<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>
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release-Dll|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
<UseDebugLibraries>false</UseDebugLibraries>
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
</PropertyGroup>
|
</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" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
<ImportGroup Label="ExtensionSettings">
|
<ImportGroup Label="ExtensionSettings">
|
||||||
</ImportGroup>
|
</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" />
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
</ImportGroup>
|
</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" />
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
</ImportGroup>
|
</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" />
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
</ImportGroup>
|
</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" />
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<PropertyGroup Label="UserMacros" />
|
<PropertyGroup Label="UserMacros" />
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-Lib|Win32'">
|
||||||
<LinkIncremental>true</LinkIncremental>
|
<LinkIncremental>true</LinkIncremental>
|
||||||
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
|
<OutDir>$(SolutionDir)bin\$(Platform)-$(Configuration)\</OutDir>
|
||||||
<IntDir>$(Platform)\$(Configuration)\</IntDir>
|
<IntDir>$(SolutionDir)temp\$(Platform)-$(Configuration)\</IntDir>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-Dll|Win32'">
|
||||||
<LinkIncremental>true</LinkIncremental>
|
<LinkIncremental>true</LinkIncremental>
|
||||||
|
<OutDir>$(SolutionDir)bin\$(Platform)-$(Configuration)\</OutDir>
|
||||||
|
<IntDir>$(SolutionDir)temp\$(Platform)-$(Configuration)\</IntDir>
|
||||||
</PropertyGroup>
|
</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>
|
<LinkIncremental>false</LinkIncremental>
|
||||||
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
|
<OutDir>$(SolutionDir)bin\$(Platform)-$(Configuration)\</OutDir>
|
||||||
<IntDir>$(Platform)\$(Configuration)\</IntDir>
|
<IntDir>$(SolutionDir)temp\$(Platform)-$(Configuration)\</IntDir>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release-Dll|Win32'">
|
||||||
<LinkIncremental>false</LinkIncremental>
|
<LinkIncremental>false</LinkIncremental>
|
||||||
|
<OutDir>$(SolutionDir)bin\$(Platform)-$(Configuration)\</OutDir>
|
||||||
|
<IntDir>$(SolutionDir)temp\$(Platform)-$(Configuration)\</IntDir>
|
||||||
</PropertyGroup>
|
</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>
|
<ClCompile>
|
||||||
<PrecompiledHeader>
|
<PrecompiledHeader>
|
||||||
</PrecompiledHeader>
|
</PrecompiledHeader>
|
||||||
<WarningLevel>Level4</WarningLevel>
|
<WarningLevel>Level4</WarningLevel>
|
||||||
<Optimization>Disabled</Optimization>
|
<Optimization>Disabled</Optimization>
|
||||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<ExceptionHandling>false</ExceptionHandling>
|
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Console</SubSystem>
|
<SubSystem>Console</SubSystem>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</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>
|
<ClCompile>
|
||||||
<PrecompiledHeader>
|
<PrecompiledHeader>
|
||||||
</PrecompiledHeader>
|
</PrecompiledHeader>
|
||||||
<WarningLevel>Level4</WarningLevel>
|
<WarningLevel>Level4</WarningLevel>
|
||||||
<Optimization>Disabled</Optimization>
|
<Optimization>Disabled</Optimization>
|
||||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<ExceptionHandling>false</ExceptionHandling>
|
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Console</SubSystem>
|
<SubSystem>Console</SubSystem>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</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'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<Lib>
|
||||||
|
<IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
|
||||||
|
</Lib>
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
|
||||||
<PrecompiledHeader>
|
|
||||||
</PrecompiledHeader>
|
|
||||||
<Optimization>MaxSpeed</Optimization>
|
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
|
||||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
|
||||||
<StringPooling>true</StringPooling>
|
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<ClCompile>
|
||||||
<SubSystem>Console</SubSystem>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
</ClCompile>
|
||||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
<ClCompile>
|
||||||
<OptimizeReferences>true</OptimizeReferences>
|
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||||
</Link>
|
</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>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<Lib>
|
||||||
|
<IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
|
||||||
|
</Lib>
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
|
||||||
<PrecompiledHeader>
|
</ClCompile>
|
||||||
</PrecompiledHeader>
|
<ClCompile>
|
||||||
<Optimization>MaxSpeed</Optimization>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
</ClCompile>
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<ClCompile>
|
||||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||||
<StringPooling>true</StringPooling>
|
</ClCompile>
|
||||||
|
<ClCompile>
|
||||||
|
<OmitFramePointers>true</OmitFramePointers>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile>
|
||||||
|
<EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations>
|
||||||
|
<StringPooling>true</StringPooling>
|
||||||
|
<BufferSecurityCheck>false</BufferSecurityCheck>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
|
||||||
<SubSystem>Console</SubSystem>
|
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
|
||||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
|
||||||
<OptimizeReferences>true</OptimizeReferences>
|
|
||||||
</Link>
|
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="..\tinyxml2.cpp" />
|
<ClCompile Include="..\tinyxml2.cpp" />
|
||||||
<ClCompile Include="..\xmltest.cpp" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="..\tinyxml2.h" />
|
<ClInclude Include="..\tinyxml2.h" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
|
||||||
<None Include="..\readme.md" />
|
|
||||||
</ItemGroup>
|
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
<ImportGroup Label="ExtensionTargets">
|
<ImportGroup Label="ExtensionTargets">
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
|
|||||||
22
tinyxml2/tinyxml2.vcxproj.filters
Normal file → Executable file
22
tinyxml2/tinyxml2.vcxproj.filters
Normal file → Executable file
@@ -1,27 +1,9 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Filter Include="Source Files">
|
<ClCompile Include="..\tinyxml2.cpp" />
|
||||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
|
||||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
|
||||||
</Filter>
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="..\xmltest.cpp">
|
<ClInclude Include="..\tinyxml2.h" />
|
||||||
<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>
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
591
xmltest.cpp
591
xmltest.cpp
@@ -1,5 +1,10 @@
|
|||||||
#include "tinyxml2.h"
|
#if defined( _MSC_VER )
|
||||||
|
#if !defined( _CRT_SECURE_NO_WARNINGS )
|
||||||
|
#define _CRT_SECURE_NO_WARNINGS // This test file is not intended to be secure.
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "tinyxml2.h"
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
@@ -11,6 +16,8 @@
|
|||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
_CrtMemState startMemState;
|
_CrtMemState startMemState;
|
||||||
_CrtMemState endMemState;
|
_CrtMemState endMemState;
|
||||||
|
#elif defined(MINGW32) || defined(__MINGW32__)
|
||||||
|
#include <io.h> // mkdir
|
||||||
#else
|
#else
|
||||||
#include <sys/stat.h> // mkdir
|
#include <sys/stat.h> // mkdir
|
||||||
#endif
|
#endif
|
||||||
@@ -20,7 +27,7 @@ int gPass = 0;
|
|||||||
int gFail = 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 );
|
bool pass = !strcmp( expected, found );
|
||||||
if ( pass )
|
if ( pass )
|
||||||
@@ -28,10 +35,19 @@ bool XMLTest (const char* testString, const char* expected, const char* found, b
|
|||||||
else
|
else
|
||||||
printf ("[fail]");
|
printf ("[fail]");
|
||||||
|
|
||||||
if ( !echo )
|
if ( !echo ) {
|
||||||
printf (" %s\n", testString);
|
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 )
|
if ( pass )
|
||||||
++gPass;
|
++gPass;
|
||||||
@@ -74,17 +90,25 @@ void NullLineEndings( char* p )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Comments in the header. (Don't know how to get Doxygen to read comments in this file.)
|
int example_1(const char *xml_file)
|
||||||
int example_1()
|
|
||||||
{
|
{
|
||||||
XMLDocument doc;
|
XMLDocument doc;
|
||||||
doc.LoadFile( "resources/dream.xml" );
|
|
||||||
|
doc.LoadFile( xml_file );
|
||||||
|
|
||||||
return doc.ErrorID();
|
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()
|
int example_2()
|
||||||
{
|
{
|
||||||
static const char* xml = "<element/>";
|
static const char* xml = "<element/>";
|
||||||
@@ -93,11 +117,20 @@ int example_2()
|
|||||||
|
|
||||||
return doc.ErrorID();
|
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()
|
int example_3()
|
||||||
{
|
{
|
||||||
static const char* xml =
|
static const char* xml =
|
||||||
"<?xml version=\"1.0\"?>"
|
"<?xml version=\"1.0\"?>"
|
||||||
"<!DOCTYPE PLAY SYSTEM \"play.dtd\">"
|
"<!DOCTYPE PLAY SYSTEM \"play.dtd\">"
|
||||||
"<PLAY>"
|
"<PLAY>"
|
||||||
@@ -110,13 +143,76 @@ int example_3()
|
|||||||
XMLElement* titleElement = doc.FirstChildElement( "PLAY" )->FirstChildElement( "TITLE" );
|
XMLElement* titleElement = doc.FirstChildElement( "PLAY" )->FirstChildElement( "TITLE" );
|
||||||
const char* title = titleElement->GetText();
|
const char* title = titleElement->GetText();
|
||||||
printf( "Name of play (1): %s\n", title );
|
printf( "Name of play (1): %s\n", title );
|
||||||
|
|
||||||
XMLText* textNode = titleElement->FirstChild()->ToText();
|
XMLText* textNode = titleElement->FirstChild()->ToText();
|
||||||
title = textNode->Value();
|
title = textNode->Value();
|
||||||
printf( "Name of play (2): %s\n", title );
|
printf( "Name of play (2): %s\n", title );
|
||||||
|
|
||||||
return doc.ErrorID();
|
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()
|
bool example_4()
|
||||||
@@ -128,7 +224,7 @@ bool example_4()
|
|||||||
" <v>2</v>"
|
" <v>2</v>"
|
||||||
" </textApproach>"
|
" </textApproach>"
|
||||||
"</information>";
|
"</information>";
|
||||||
|
|
||||||
XMLDocument doc;
|
XMLDocument doc;
|
||||||
doc.Parse( xml );
|
doc.Parse( xml );
|
||||||
|
|
||||||
@@ -145,25 +241,76 @@ bool example_4()
|
|||||||
|
|
||||||
return !doc.Error() && ( v0 == v1 );
|
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 )
|
#if defined( _MSC_VER ) && defined( DEBUG )
|
||||||
_CrtMemCheckpoint( &startMemState );
|
_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
|
#endif
|
||||||
|
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER) || defined(MINGW32) || defined(__MINGW32__)
|
||||||
_mkdir( "resources/out/" );
|
#if defined __MINGW64_VERSION_MAJOR && defined __MINGW64_VERSION_MINOR
|
||||||
|
//MINGW64: both 32 and 64-bit
|
||||||
|
mkdir( "resources/out/" );
|
||||||
|
#else
|
||||||
|
_mkdir( "resources/out/" );
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
mkdir( "resources/out/", S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
|
mkdir( "resources/out/", S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
|
||||||
#endif
|
#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" );
|
FILE* fp = fopen( "resources/dream.xml", "r" );
|
||||||
if ( !fp ) {
|
if ( !fp ) {
|
||||||
printf( "Error opening test file 'dream.xml'.\n"
|
printf( "Error opening test file 'dream.xml'.\n"
|
||||||
@@ -178,16 +325,13 @@ int main( int /*argc*/, const char ** /*argv*/ )
|
|||||||
}
|
}
|
||||||
fclose( fp );
|
fclose( fp );
|
||||||
|
|
||||||
#if defined(_MSC_VER)
|
XMLTest( "Example-1", 0, example_1("resources/dream.xml") );
|
||||||
#pragma warning ( pop )
|
XMLTest( "Example-1", 0, example_1("resources/dictionary.xml") );
|
||||||
#endif
|
|
||||||
|
|
||||||
XMLTest( "Example-1", 0, example_1() );
|
|
||||||
XMLTest( "Example-2", 0, example_2() );
|
XMLTest( "Example-2", 0, example_2() );
|
||||||
XMLTest( "Example-3", 0, example_3() );
|
XMLTest( "Example-3", 0, example_3() );
|
||||||
XMLTest( "Example-4", true, example_4() );
|
XMLTest( "Example-4", true, example_4() );
|
||||||
|
|
||||||
/* ------ Example 2: Lookup information. ---- */
|
/* ------ Example 2: Lookup information. ---- */
|
||||||
|
|
||||||
{
|
{
|
||||||
static const char* test[] = { "<element />",
|
static const char* test[] = { "<element />",
|
||||||
@@ -268,7 +412,7 @@ int main( int /*argc*/, const char ** /*argv*/ )
|
|||||||
XMLTest( "Programmatic DOM", "comment", doc->FirstChildElement( "element" )->FirstChild()->Value() );
|
XMLTest( "Programmatic DOM", "comment", doc->FirstChildElement( "element" )->FirstChild()->Value() );
|
||||||
XMLTest( "Programmatic DOM", "0", doc->FirstChildElement( "element" )->FirstChildElement()->Attribute( "attrib" ) );
|
XMLTest( "Programmatic DOM", "0", doc->FirstChildElement( "element" )->FirstChildElement()->Attribute( "attrib" ) );
|
||||||
XMLTest( "Programmatic DOM", 2, doc->FirstChildElement()->LastChildElement( "sub" )->IntAttribute( "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() );
|
doc->FirstChildElement()->LastChildElement( "sub" )->FirstChild()->ToText()->Value() );
|
||||||
|
|
||||||
// And now deletion:
|
// And now deletion:
|
||||||
@@ -313,9 +457,9 @@ int main( int /*argc*/, const char ** /*argv*/ )
|
|||||||
|
|
||||||
XMLTest( "Dream", "xml version=\"1.0\"",
|
XMLTest( "Dream", "xml version=\"1.0\"",
|
||||||
doc.FirstChild()->ToDeclaration()->Value() );
|
doc.FirstChild()->ToDeclaration()->Value() );
|
||||||
XMLTest( "Dream", true, doc.FirstChild()->NextSibling()->ToUnknown() ? true : false );
|
XMLTest( "Dream", true, doc.FirstChild()->NextSibling()->ToDtd() ? true : false );
|
||||||
XMLTest( "Dream", "DOCTYPE PLAY SYSTEM \"play.dtd\"",
|
XMLTest( "Dream", "DOCTYPE PLAY SYSTEM \"play.dtd\"",
|
||||||
doc.FirstChild()->NextSibling()->ToUnknown()->Value() );
|
doc.FirstChild()->NextSibling()->ToDtd()->Value() );
|
||||||
XMLTest( "Dream", "And Robin shall restore amends.",
|
XMLTest( "Dream", "And Robin shall restore amends.",
|
||||||
doc.LastChild()->LastChild()->LastChild()->LastChild()->LastChildElement()->GetText() );
|
doc.LastChild()->LastChild()->LastChild()->LastChild()->LastChildElement()->GetText() );
|
||||||
XMLTest( "Dream", "And Robin shall restore amends.",
|
XMLTest( "Dream", "And Robin shall restore amends.",
|
||||||
@@ -325,14 +469,36 @@ int main( int /*argc*/, const char ** /*argv*/ )
|
|||||||
doc2.LoadFile( "resources/out/dreamout.xml" );
|
doc2.LoadFile( "resources/out/dreamout.xml" );
|
||||||
XMLTest( "Dream-out", "xml version=\"1.0\"",
|
XMLTest( "Dream-out", "xml version=\"1.0\"",
|
||||||
doc2.FirstChild()->ToDeclaration()->Value() );
|
doc2.FirstChild()->ToDeclaration()->Value() );
|
||||||
XMLTest( "Dream-out", true, doc2.FirstChild()->NextSibling()->ToUnknown() ? true : false );
|
XMLTest( "Dream-out", true, doc2.FirstChild()->NextSibling()->ToDtd() ? true : false );
|
||||||
XMLTest( "Dream-out", "DOCTYPE PLAY SYSTEM \"play.dtd\"",
|
XMLTest( "Dream-out", "DOCTYPE PLAY SYSTEM \"play.dtd\"",
|
||||||
doc2.FirstChild()->NextSibling()->ToUnknown()->Value() );
|
doc2.FirstChild()->NextSibling()->ToDtd()->Value() );
|
||||||
XMLTest( "Dream-out", "And Robin shall restore amends.",
|
XMLTest( "Dream-out", "And Robin shall restore amends.",
|
||||||
doc2.LastChild()->LastChild()->LastChild()->LastChild()->LastChildElement()->GetText() );
|
doc2.LastChild()->LastChild()->LastChild()->LastChild()->LastChildElement()->GetText() );
|
||||||
|
|
||||||
//gNewTotal = gNew - newStart;
|
//gNewTotal = gNew - newStart;
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
// Test: Dictionary
|
||||||
|
XMLDocument doc;
|
||||||
|
doc.LoadFile( "resources/dictionary.xml" );
|
||||||
|
|
||||||
|
doc.SaveFile( "resources/out/dictionaryout.xml" );
|
||||||
|
doc.PrintError();
|
||||||
|
|
||||||
|
XMLTest( "Dictionary", "xml version=\"1.0\" encoding=\"UTF-8\"",
|
||||||
|
doc.FirstChild()->ToDeclaration()->Value() );
|
||||||
|
XMLTest( "Dictionary", true, doc.FirstChild()->NextSibling()->ToDtd() ? true : false );
|
||||||
|
XMLTest( "Dictionary", "500M",
|
||||||
|
doc.LastChild()->LastChild()->FirstChild()->ToElement()->Attribute("size") );
|
||||||
|
|
||||||
|
XMLDocument doc2;
|
||||||
|
doc2.LoadFile( "resources/out/dictionaryout.xml" );
|
||||||
|
XMLTest( "Dictionary-out", "xml version=\"1.0\" encoding=\"UTF-8\"",
|
||||||
|
doc2.FirstChild()->ToDeclaration()->Value() );
|
||||||
|
XMLTest( "Dictionary-out", true, doc2.FirstChild()->NextSibling()->ToDtd() ? true : false );
|
||||||
|
XMLTest( "Dictionary", "500M",
|
||||||
|
doc2.LastChild()->LastChild()->FirstChild()->ToElement()->Attribute("size") );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
@@ -343,7 +509,7 @@ int main( int /*argc*/, const char ** /*argv*/ )
|
|||||||
|
|
||||||
XMLDocument doc;
|
XMLDocument doc;
|
||||||
doc.Parse( error );
|
doc.Parse( error );
|
||||||
XMLTest( "Bad XML", doc.ErrorID(), (int)XML_ERROR_PARSING_ATTRIBUTE );
|
XMLTest( "Bad XML", doc.ErrorID(), XML_ERROR_PARSING_ATTRIBUTE );
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
@@ -361,6 +527,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", result, (int)XML_NO_ERROR );
|
||||||
XMLTest( "Query attribute: int as double", (int)dVal, 1 );
|
XMLTest( "Query attribute: int as double", (int)dVal, 1 );
|
||||||
result = ele->QueryDoubleAttribute( "attr1", &dVal );
|
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 );
|
XMLTest( "Query attribute: double as double", (int)dVal, 2 );
|
||||||
result = ele->QueryIntAttribute( "attr1", &iVal );
|
result = ele->QueryIntAttribute( "attr1", &iVal );
|
||||||
XMLTest( "Query attribute: double as int", result, (int)XML_NO_ERROR );
|
XMLTest( "Query attribute: double as int", result, (int)XML_NO_ERROR );
|
||||||
@@ -379,8 +546,8 @@ int main( int /*argc*/, const char ** /*argv*/ )
|
|||||||
|
|
||||||
XMLElement* ele = doc.FirstChildElement();
|
XMLElement* ele = doc.FirstChildElement();
|
||||||
|
|
||||||
int iVal;
|
int iVal, iVal2;
|
||||||
double dVal;
|
double dVal, dVal2;
|
||||||
|
|
||||||
ele->SetAttribute( "str", "strValue" );
|
ele->SetAttribute( "str", "strValue" );
|
||||||
ele->SetAttribute( "int", 1 );
|
ele->SetAttribute( "int", 1 );
|
||||||
@@ -390,10 +557,15 @@ int main( int /*argc*/, const char ** /*argv*/ )
|
|||||||
ele->QueryIntAttribute( "int", &iVal );
|
ele->QueryIntAttribute( "int", &iVal );
|
||||||
ele->QueryDoubleAttribute( "double", &dVal );
|
ele->QueryDoubleAttribute( "double", &dVal );
|
||||||
|
|
||||||
|
ele->QueryAttribute( "int", &iVal2 );
|
||||||
|
ele->QueryAttribute( "double", &dVal2 );
|
||||||
|
|
||||||
XMLTest( "Attribute match test", ele->Attribute( "str", "strValue" ), "strValue" );
|
XMLTest( "Attribute match test", ele->Attribute( "str", "strValue" ), "strValue" );
|
||||||
XMLTest( "Attribute round trip. c-string.", "strValue", cStr );
|
XMLTest( "Attribute round trip. c-string.", "strValue", cStr );
|
||||||
XMLTest( "Attribute round trip. int.", 1, iVal );
|
XMLTest( "Attribute round trip. int.", 1, iVal );
|
||||||
XMLTest( "Attribute round trip. double.", -1, (int)dVal );
|
XMLTest( "Attribute round trip. double.", -1, (int)dVal );
|
||||||
|
XMLTest( "Alternate query", true, iVal == iVal2 );
|
||||||
|
XMLTest( "Alternate query", true, dVal == dVal2 );
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
@@ -402,7 +574,7 @@ int main( int /*argc*/, const char ** /*argv*/ )
|
|||||||
|
|
||||||
// Get the attribute "value" from the "Russian" element and check it.
|
// Get the attribute "value" from the "Russian" element and check it.
|
||||||
XMLElement* element = doc.FirstChildElement( "document" )->FirstChildElement( "Russian" );
|
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 };
|
0xd0U, 0xbeU, 0xd1U, 0x81U, 0xd1U, 0x82U, 0xd1U, 0x8cU, 0 };
|
||||||
|
|
||||||
XMLTest( "UTF-8: Russian value.", (const char*)correctValue, element->Attribute( "value" ) );
|
XMLTest( "UTF-8: Russian value.", (const char*)correctValue, element->Attribute( "value" ) );
|
||||||
@@ -424,16 +596,8 @@ int main( int /*argc*/, const char ** /*argv*/ )
|
|||||||
// Check the round trip.
|
// Check the round trip.
|
||||||
int okay = 0;
|
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* saved = fopen( "resources/out/utf8testout.xml", "r" );
|
||||||
FILE* verify = fopen( "resources/utf8testverify.xml", "r" );
|
FILE* verify = fopen( "resources/utf8testverify.xml", "r" );
|
||||||
#if defined(_MSC_VER)
|
|
||||||
#pragma warning ( pop )
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if ( saved && verify )
|
if ( saved && verify )
|
||||||
{
|
{
|
||||||
@@ -479,6 +643,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 ---------------
|
// ---------- CDATA ---------------
|
||||||
{
|
{
|
||||||
const char* str = "<xmlElement>"
|
const char* str = "<xmlElement>"
|
||||||
@@ -491,7 +710,7 @@ int main( int /*argc*/, const char ** /*argv*/ )
|
|||||||
doc.Parse( str );
|
doc.Parse( str );
|
||||||
doc.Print();
|
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",
|
"I am > the rules!\n...since I make symbolic puns",
|
||||||
false );
|
false );
|
||||||
}
|
}
|
||||||
@@ -508,7 +727,7 @@ int main( int /*argc*/, const char ** /*argv*/ )
|
|||||||
doc.Parse( str );
|
doc.Parse( str );
|
||||||
doc.Print();
|
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",
|
"<b>I am > the rules!</b>\n...since I make symbolic puns",
|
||||||
false );
|
false );
|
||||||
}
|
}
|
||||||
@@ -548,28 +767,15 @@ int main( int /*argc*/, const char ** /*argv*/ )
|
|||||||
|
|
||||||
XMLTest( "Entity transformation: read. ", expected, context, true );
|
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" );
|
FILE* textfile = fopen( "resources/out/textfile.txt", "w" );
|
||||||
#if defined(_MSC_VER)
|
|
||||||
#pragma warning ( pop )
|
|
||||||
#endif
|
|
||||||
if ( textfile )
|
if ( textfile )
|
||||||
{
|
{
|
||||||
XMLPrinter streamer( textfile );
|
XMLPrinter streamer( textfile );
|
||||||
psg->Accept( &streamer );
|
psg->Accept( &streamer );
|
||||||
fclose( textfile );
|
fclose( textfile );
|
||||||
}
|
}
|
||||||
#if defined(_MSC_VER)
|
|
||||||
#pragma warning ( push )
|
textfile = fopen( "resources/out/textfile.txt", "r" );
|
||||||
#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
|
|
||||||
TIXMLASSERT( textfile );
|
TIXMLASSERT( textfile );
|
||||||
if ( textfile )
|
if ( textfile )
|
||||||
{
|
{
|
||||||
@@ -590,11 +796,11 @@ int main( int /*argc*/, const char ** /*argv*/ )
|
|||||||
"<passages count=\"006\" formatversion=\"20020620\">"
|
"<passages count=\"006\" formatversion=\"20020620\">"
|
||||||
"<psg context=\"Line 5 has "quotation marks" and 'apostrophe marks'.\">Crazy &ttk;</psg>"
|
"<psg context=\"Line 5 has "quotation marks" and 'apostrophe marks'.\">Crazy &ttk;</psg>"
|
||||||
"</passages>";
|
"</passages>";
|
||||||
|
|
||||||
XMLDocument doc( false );
|
XMLDocument doc( false );
|
||||||
doc.Parse( passages );
|
doc.Parse( passages );
|
||||||
|
|
||||||
XMLTest( "No entity parsing.", doc.FirstChildElement()->FirstChildElement()->Attribute( "context" ),
|
XMLTest( "No entity parsing.", doc.FirstChildElement()->FirstChildElement()->Attribute( "context" ),
|
||||||
"Line 5 has "quotation marks" and 'apostrophe marks'." );
|
"Line 5 has "quotation marks" and 'apostrophe marks'." );
|
||||||
XMLTest( "No entity parsing.", doc.FirstChildElement()->FirstChildElement()->FirstChild()->Value(),
|
XMLTest( "No entity parsing.", doc.FirstChildElement()->FirstChildElement()->FirstChild()->Value(),
|
||||||
"Crazy &ttk;" );
|
"Crazy &ttk;" );
|
||||||
@@ -625,7 +831,7 @@ int main( int /*argc*/, const char ** /*argv*/ )
|
|||||||
|
|
||||||
{
|
{
|
||||||
// DOCTYPE not preserved (950171)
|
// DOCTYPE not preserved (950171)
|
||||||
//
|
//
|
||||||
const char* doctype =
|
const char* doctype =
|
||||||
"<?xml version=\"1.0\" ?>"
|
"<?xml version=\"1.0\" ?>"
|
||||||
"<!DOCTYPE PLAY SYSTEM 'play.dtd'>"
|
"<!DOCTYPE PLAY SYSTEM 'play.dtd'>"
|
||||||
@@ -639,15 +845,15 @@ int main( int /*argc*/, const char ** /*argv*/ )
|
|||||||
doc.DeleteChild( doc.RootElement() );
|
doc.DeleteChild( doc.RootElement() );
|
||||||
doc.LoadFile( "resources/out/test7.xml" );
|
doc.LoadFile( "resources/out/test7.xml" );
|
||||||
doc.Print();
|
doc.Print();
|
||||||
|
|
||||||
const XMLUnknown* decl = doc.FirstChild()->NextSibling()->ToUnknown();
|
const XMLDtd* decl = doc.FirstChild()->NextSibling()->ToDtd();
|
||||||
XMLTest( "Correct value of unknown.", "DOCTYPE PLAY SYSTEM 'play.dtd'", decl->Value() );
|
XMLTest( "Correct value of unknown.", "DOCTYPE PLAY SYSTEM 'play.dtd'", decl->Value() );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
// Comments do not stream out correctly.
|
// Comments do not stream out correctly.
|
||||||
const char* doctype =
|
const char* doctype =
|
||||||
"<!-- Somewhat<evil> -->";
|
"<!-- Somewhat<evil> -->";
|
||||||
XMLDocument doc;
|
XMLDocument doc;
|
||||||
doc.Parse( doctype );
|
doc.Parse( doctype );
|
||||||
@@ -662,8 +868,8 @@ int main( int /*argc*/, const char ** /*argv*/ )
|
|||||||
|
|
||||||
XMLDocument doc;
|
XMLDocument doc;
|
||||||
doc.Parse( doctype );
|
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();
|
doc.PrintError();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -681,7 +887,7 @@ int main( int /*argc*/, const char ** /*argv*/ )
|
|||||||
const char* str = " ";
|
const char* str = " ";
|
||||||
XMLDocument doc;
|
XMLDocument doc;
|
||||||
doc.Parse( str );
|
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 +914,8 @@ int main( int /*argc*/, const char ** /*argv*/ )
|
|||||||
xml.Parse("<x> ");
|
xml.Parse("<x> ");
|
||||||
XMLTest("Missing end tag with trailing whitespace", xml.Error(), true);
|
XMLTest("Missing end tag with trailing whitespace", xml.Error(), true);
|
||||||
xml.Parse("<x></y>");
|
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 +962,7 @@ int main( int /*argc*/, const char ** /*argv*/ )
|
|||||||
|
|
||||||
XMLDocument doc;
|
XMLDocument doc;
|
||||||
doc.Parse( (const char*)buf);
|
doc.Parse( (const char*)buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
@@ -806,14 +1012,14 @@ int main( int /*argc*/, const char ** /*argv*/ )
|
|||||||
}
|
}
|
||||||
XMLTest( "Error in snprinf handling.", true, doc.Error() );
|
XMLTest( "Error in snprinf handling.", true, doc.Error() );
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
// Attribute ordering.
|
// Attribute ordering.
|
||||||
static const char* xml = "<element attrib1=\"1\" attrib2=\"2\" attrib3=\"3\" />";
|
static const char* xml = "<element attrib1=\"1\" attrib2=\"2\" attrib3=\"3\" />";
|
||||||
XMLDocument doc;
|
XMLDocument doc;
|
||||||
doc.Parse( xml );
|
doc.Parse( xml );
|
||||||
XMLElement* ele = doc.FirstChildElement();
|
XMLElement* ele = doc.FirstChildElement();
|
||||||
|
|
||||||
const XMLAttribute* a = ele->FirstAttribute();
|
const XMLAttribute* a = ele->FirstAttribute();
|
||||||
XMLTest( "Attribute order", "1", a->Value() );
|
XMLTest( "Attribute order", "1", a->Value() );
|
||||||
a = a->Next();
|
a = a->Next();
|
||||||
@@ -821,13 +1027,13 @@ int main( int /*argc*/, const char ** /*argv*/ )
|
|||||||
a = a->Next();
|
a = a->Next();
|
||||||
XMLTest( "Attribute order", "3", a->Value() );
|
XMLTest( "Attribute order", "3", a->Value() );
|
||||||
XMLTest( "Attribute order", "attrib3", a->Name() );
|
XMLTest( "Attribute order", "attrib3", a->Name() );
|
||||||
|
|
||||||
ele->DeleteAttribute( "attrib2" );
|
ele->DeleteAttribute( "attrib2" );
|
||||||
a = ele->FirstAttribute();
|
a = ele->FirstAttribute();
|
||||||
XMLTest( "Attribute order", "1", a->Value() );
|
XMLTest( "Attribute order", "1", a->Value() );
|
||||||
a = a->Next();
|
a = a->Next();
|
||||||
XMLTest( "Attribute order", "3", a->Value() );
|
XMLTest( "Attribute order", "3", a->Value() );
|
||||||
|
|
||||||
ele->DeleteAttribute( "attrib1" );
|
ele->DeleteAttribute( "attrib1" );
|
||||||
ele->DeleteAttribute( "attrib3" );
|
ele->DeleteAttribute( "attrib3" );
|
||||||
XMLTest( "Attribute order (empty)", false, ele->FirstAttribute() ? true : false );
|
XMLTest( "Attribute order (empty)", false, ele->FirstAttribute() ? true : false );
|
||||||
@@ -879,7 +1085,7 @@ int main( int /*argc*/, const char ** /*argv*/ )
|
|||||||
ele = docH.FirstChildElement( "none" ).FirstChildElement( "element" ).ToElement();
|
ele = docH.FirstChildElement( "none" ).FirstChildElement( "element" ).ToElement();
|
||||||
XMLTest( "Handle, dne, mutable", false, ele != 0 );
|
XMLTest( "Handle, dne, mutable", false, ele != 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
static const char* xml = "<element attrib='bar'><sub>Text</sub></element>";
|
static const char* xml = "<element attrib='bar'><sub>Text</sub></element>";
|
||||||
XMLDocument doc;
|
XMLDocument doc;
|
||||||
@@ -897,7 +1103,7 @@ int main( int /*argc*/, const char ** /*argv*/ )
|
|||||||
XMLDocument doc;
|
XMLDocument doc;
|
||||||
doc.InsertEndChild( doc.NewDeclaration() );
|
doc.InsertEndChild( doc.NewDeclaration() );
|
||||||
doc.SetBOM( true );
|
doc.SetBOM( true );
|
||||||
|
|
||||||
XMLPrinter printer;
|
XMLPrinter printer;
|
||||||
doc.Print( &printer );
|
doc.Print( &printer );
|
||||||
|
|
||||||
@@ -946,7 +1152,35 @@ int main( int /*argc*/, const char ** /*argv*/ )
|
|||||||
doc.Parse( xml );
|
doc.Parse( xml );
|
||||||
XMLTest( "Non-alpha element lead letter parses.", doc.Error(), false );
|
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 ------------
|
// ----------- Whitespace ------------
|
||||||
{
|
{
|
||||||
const char* xml = "<element>"
|
const char* xml = "<element>"
|
||||||
@@ -966,13 +1200,196 @@ 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>";
|
const char* xml = "<element> </element>";
|
||||||
XMLDocument doc( true, COLLAPSE_WHITESPACE );
|
XMLDocument doc( true, COLLAPSE_WHITESPACE );
|
||||||
doc.Parse( xml );
|
doc.Parse( xml );
|
||||||
XMLTest( "Whitespace all space", true, 0 == doc.FirstChildElement()->FirstChild() );
|
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 );
|
||||||
|
XMLTest( "Loading an empty file and ErrorName as string", "XML_ERROR_EMPTY_DOCUMENT", doc.ErrorName() );
|
||||||
|
doc.PrintError();
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
// 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 --------------
|
// ----------- Performance tracking --------------
|
||||||
{
|
{
|
||||||
#if defined( _MSC_VER )
|
#if defined( _MSC_VER )
|
||||||
@@ -980,14 +1397,7 @@ int main( int /*argc*/, const char ** /*argv*/ )
|
|||||||
QueryPerformanceFrequency( (LARGE_INTEGER*) &freq );
|
QueryPerformanceFrequency( (LARGE_INTEGER*) &freq );
|
||||||
#endif
|
#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" );
|
FILE* fp = fopen( "resources/dream.xml", "r" );
|
||||||
#if defined(_MSC_VER)
|
|
||||||
#pragma warning ( pop )
|
|
||||||
#endif
|
|
||||||
fseek( fp, 0, SEEK_END );
|
fseek( fp, 0, SEEK_END );
|
||||||
long size = ftell( fp );
|
long size = ftell( fp );
|
||||||
fseek( fp, 0, SEEK_SET );
|
fseek( fp, 0, SEEK_SET );
|
||||||
@@ -1015,7 +1425,7 @@ int main( int /*argc*/, const char ** /*argv*/ )
|
|||||||
|
|
||||||
delete [] mem;
|
delete [] mem;
|
||||||
|
|
||||||
static const char* note =
|
static const char* note =
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
"DEBUG";
|
"DEBUG";
|
||||||
#else
|
#else
|
||||||
@@ -1030,7 +1440,7 @@ int main( int /*argc*/, const char ** /*argv*/ )
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if defined( _MSC_VER ) && defined( DEBUG )
|
#if defined( _MSC_VER ) && defined( DEBUG )
|
||||||
_CrtMemCheckpoint( &endMemState );
|
_CrtMemCheckpoint( &endMemState );
|
||||||
//_CrtMemDumpStatistics( &endMemState );
|
//_CrtMemDumpStatistics( &endMemState );
|
||||||
|
|
||||||
_CrtMemState diffMemState;
|
_CrtMemState diffMemState;
|
||||||
@@ -1040,5 +1450,6 @@ int main( int /*argc*/, const char ** /*argv*/ )
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
printf ("\nPass %d, Fail %d\n", gPass, gFail);
|
printf ("\nPass %d, Fail %d\n", gPass, gFail);
|
||||||
return 0;
|
|
||||||
|
return gFail;
|
||||||
}
|
}
|
||||||
|
|||||||
129
xmltest.h
129
xmltest.h
@@ -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 );
|
|
||||||
*/
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user