Compare commits
27 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bf15233ad8 | ||
|
|
8504195843 | ||
|
|
8db004b74c | ||
|
|
3d6a5477a7 | ||
|
|
bbbb8c9a90 | ||
|
|
e444268103 | ||
|
|
6ac05b2b9a | ||
|
|
655b15c078 | ||
|
|
59b01033f3 | ||
|
|
37ccc71008 | ||
|
|
3574d3e22f | ||
|
|
de62366e6a | ||
|
|
20f2d5eec7 | ||
|
|
a9c28ce3e3 | ||
|
|
2c642bf25e | ||
|
|
f4520c9905 | ||
|
|
1eb8a3f765 | ||
|
|
d09f879ada | ||
|
|
e620245043 | ||
|
|
d7455034ea | ||
|
|
7d9ca1e73c | ||
|
|
ad7bdf9ed2 | ||
|
|
8916a3c587 | ||
|
|
73f5409b62 | ||
|
|
ff61650517 | ||
|
|
a9a0ea22fb | ||
|
|
d39b13bbb7 |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -18,3 +18,5 @@ tinyxml2/temp/
|
|||||||
*.o
|
*.o
|
||||||
*.vc.db
|
*.vc.db
|
||||||
*.vc.opendb
|
*.vc.opendb
|
||||||
|
libtinyxml2.a
|
||||||
|
xmltest
|
||||||
|
|||||||
@@ -21,8 +21,8 @@ include(CTest)
|
|||||||
################################
|
################################
|
||||||
# set lib version here
|
# set lib version here
|
||||||
|
|
||||||
set(GENERIC_LIB_VERSION "7.1.0")
|
set(GENERIC_LIB_VERSION "8.0.0")
|
||||||
set(GENERIC_LIB_SOVERSION "7")
|
set(GENERIC_LIB_SOVERSION "8")
|
||||||
|
|
||||||
################################
|
################################
|
||||||
# Add definitions
|
# Add definitions
|
||||||
@@ -79,9 +79,15 @@ export(TARGETS tinyxml2
|
|||||||
|
|
||||||
install(TARGETS tinyxml2
|
install(TARGETS tinyxml2
|
||||||
EXPORT ${CMAKE_PROJECT_NAME}Targets
|
EXPORT ${CMAKE_PROJECT_NAME}Targets
|
||||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
RUNTIME
|
||||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
COMPONENT tinyxml2_runtime
|
||||||
|
LIBRARY
|
||||||
|
DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||||
|
COMPONENT tinyxml2_libraries
|
||||||
|
ARCHIVE
|
||||||
|
DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||||
|
COMPONENT tinyxml2_libraries)
|
||||||
|
|
||||||
if(BUILD_TESTING AND BUILD_TESTS)
|
if(BUILD_TESTING AND BUILD_TESTS)
|
||||||
add_executable(xmltest xmltest.cpp)
|
add_executable(xmltest xmltest.cpp)
|
||||||
@@ -98,10 +104,10 @@ if(BUILD_TESTING AND BUILD_TESTS)
|
|||||||
add_test(NAME xmltest COMMAND xmltest WORKING_DIRECTORY $<TARGET_FILE_DIR:xmltest>)
|
add_test(NAME xmltest COMMAND xmltest WORKING_DIRECTORY $<TARGET_FILE_DIR:xmltest>)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
install(FILES tinyxml2.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
install(FILES tinyxml2.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} COMPONENT tinyxml2_headers)
|
||||||
|
|
||||||
configure_file(tinyxml2.pc.in tinyxml2.pc @ONLY)
|
configure_file(tinyxml2.pc.in tinyxml2.pc @ONLY)
|
||||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/tinyxml2.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
|
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/tinyxml2.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig COMPONENT tinyxml2_config)
|
||||||
|
|
||||||
# uninstall target
|
# uninstall target
|
||||||
if(NOT TARGET uninstall)
|
if(NOT TARGET uninstall)
|
||||||
@@ -129,7 +135,9 @@ write_basic_package_version_file(
|
|||||||
install(FILES
|
install(FILES
|
||||||
${CMAKE_BINARY_DIR}/${CMAKE_PROJECT_NAME}Config.cmake
|
${CMAKE_BINARY_DIR}/${CMAKE_PROJECT_NAME}Config.cmake
|
||||||
${CMAKE_BINARY_DIR}/${CMAKE_PROJECT_NAME}ConfigVersion.cmake
|
${CMAKE_BINARY_DIR}/${CMAKE_PROJECT_NAME}ConfigVersion.cmake
|
||||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${CMAKE_PROJECT_NAME})
|
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${CMAKE_PROJECT_NAME}
|
||||||
|
COMPONENT tinyxml2_config)
|
||||||
|
|
||||||
install(EXPORT ${CMAKE_PROJECT_NAME}Targets NAMESPACE tinyxml2::
|
install(EXPORT ${CMAKE_PROJECT_NAME}Targets NAMESPACE tinyxml2::
|
||||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${CMAKE_PROJECT_NAME})
|
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${CMAKE_PROJECT_NAME}
|
||||||
|
COMPONENT tinyxml2_config)
|
||||||
|
|||||||
2
dox
2
dox
@@ -38,7 +38,7 @@ PROJECT_NAME = "TinyXML-2"
|
|||||||
# could be handy for archiving the generated documentation or if some version
|
# could be handy for archiving the generated documentation or if some version
|
||||||
# control system is used.
|
# control system is used.
|
||||||
|
|
||||||
PROJECT_NUMBER = 7.1.0
|
PROJECT_NUMBER = 8.0.0
|
||||||
|
|
||||||
# Using the PROJECT_BRIEF tag one can provide an optional one line description
|
# Using the PROJECT_BRIEF tag one can provide an optional one line description
|
||||||
# for a project that appears at the top of each page and should give viewer a
|
# for a project that appears at the top of each page and should give viewer a
|
||||||
|
|||||||
15
readme.md
15
readme.md
@@ -262,11 +262,24 @@ There are 2 files in TinyXML-2:
|
|||||||
And additionally a test file:
|
And additionally a test file:
|
||||||
* xmltest.cpp
|
* xmltest.cpp
|
||||||
|
|
||||||
Simply compile and run. There is a visual studio 2017 project included, a simple Makefile,
|
Simply compile and run. There is a visual studio 2019 project included, a simple Makefile,
|
||||||
an Xcode project, a Code::Blocks project, and a cmake CMakeLists.txt included to help you.
|
an Xcode project, a Code::Blocks project, and a cmake CMakeLists.txt included to help you.
|
||||||
The top of tinyxml.h even has a simple g++ command line if you are using Unix/Linux/BSD and
|
The top of tinyxml.h even has a simple g++ command line if you are using Unix/Linux/BSD and
|
||||||
don't want to use a build system.
|
don't want to use a build system.
|
||||||
|
|
||||||
|
Building TinyXML-2 - Using vcpkg
|
||||||
|
--------------------------------
|
||||||
|
|
||||||
|
You can download and install TinyXML-2 using the [vcpkg](https://github.com/Microsoft/vcpkg) dependency manager:
|
||||||
|
|
||||||
|
git clone https://github.com/Microsoft/vcpkg.git
|
||||||
|
cd vcpkg
|
||||||
|
./bootstrap-vcpkg.sh
|
||||||
|
./vcpkg integrate install
|
||||||
|
./vcpkg install tinyxml2
|
||||||
|
|
||||||
|
The TinyXML-2 port in vcpkg is kept up to date by Microsoft team members and community contributors. If the version is out of date, please [create an issue or pull request](https://github.com/Microsoft/vcpkg) on the vcpkg repository.
|
||||||
|
|
||||||
Versioning
|
Versioning
|
||||||
----------
|
----------
|
||||||
|
|
||||||
|
|||||||
49
tinyxml2.cpp
49
tinyxml2.cpp
@@ -617,17 +617,17 @@ bool XMLUtil::ToBool( const char* str, bool* value )
|
|||||||
*value = (ival==0) ? false : true;
|
*value = (ival==0) ? false : true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
static const char* TRUE[] = { "true", "True", "TRUE", 0 };
|
static const char* TRUE_VALS[] = { "true", "True", "TRUE", 0 };
|
||||||
static const char* FALSE[] = { "false", "False", "FALSE", 0 };
|
static const char* FALSE_VALS[] = { "false", "False", "FALSE", 0 };
|
||||||
|
|
||||||
for (int i = 0; TRUE[i]; ++i) {
|
for (int i = 0; TRUE_VALS[i]; ++i) {
|
||||||
if (StringEqual(str, TRUE[i])) {
|
if (StringEqual(str, TRUE_VALS[i])) {
|
||||||
*value = true;
|
*value = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (int i = 0; FALSE[i]; ++i) {
|
for (int i = 0; FALSE_VALS[i]; ++i) {
|
||||||
if (StringEqual(str, FALSE[i])) {
|
if (StringEqual(str, FALSE_VALS[i])) {
|
||||||
*value = false;
|
*value = false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -1961,6 +1961,39 @@ XMLAttribute* XMLElement::CreateAttribute()
|
|||||||
return attrib;
|
return attrib;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
XMLElement* XMLElement::InsertNewChildElement(const char* name)
|
||||||
|
{
|
||||||
|
XMLElement* node = _document->NewElement(name);
|
||||||
|
return InsertEndChild(node) ? node : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
XMLComment* XMLElement::InsertNewComment(const char* comment)
|
||||||
|
{
|
||||||
|
XMLComment* node = _document->NewComment(comment);
|
||||||
|
return InsertEndChild(node) ? node : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
XMLText* XMLElement::InsertNewText(const char* text)
|
||||||
|
{
|
||||||
|
XMLText* node = _document->NewText(text);
|
||||||
|
return InsertEndChild(node) ? node : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
XMLDeclaration* XMLElement::InsertNewDeclaration(const char* text)
|
||||||
|
{
|
||||||
|
XMLDeclaration* node = _document->NewDeclaration(text);
|
||||||
|
return InsertEndChild(node) ? node : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
XMLUnknown* XMLElement::InsertNewUnknown(const char* text)
|
||||||
|
{
|
||||||
|
XMLUnknown* node = _document->NewUnknown(text);
|
||||||
|
return InsertEndChild(node) ? node : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// <ele></ele>
|
// <ele></ele>
|
||||||
// <ele>foo<b>bar</b></ele>
|
// <ele>foo<b>bar</b></ele>
|
||||||
@@ -2101,7 +2134,7 @@ XMLDocument::~XMLDocument()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void XMLDocument::MarkInUse(XMLNode* node)
|
void XMLDocument::MarkInUse(const XMLNode* const node)
|
||||||
{
|
{
|
||||||
TIXMLASSERT(node);
|
TIXMLASSERT(node);
|
||||||
TIXMLASSERT(node->_parent == 0);
|
TIXMLASSERT(node->_parent == 0);
|
||||||
@@ -2635,8 +2668,6 @@ void XMLPrinter::OpenElement( const char* name, bool compactMode )
|
|||||||
|
|
||||||
if ( _textDepth < 0 && !_firstElement && !compactMode ) {
|
if ( _textDepth < 0 && !_firstElement && !compactMode ) {
|
||||||
Putc( '\n' );
|
Putc( '\n' );
|
||||||
}
|
|
||||||
if ( !compactMode ) {
|
|
||||||
PrintSpace( _depth );
|
PrintSpace( _depth );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
31
tinyxml2.h
31
tinyxml2.h
@@ -98,12 +98,12 @@ distribution.
|
|||||||
/* Versioning, past 1.0.14:
|
/* Versioning, past 1.0.14:
|
||||||
http://semver.org/
|
http://semver.org/
|
||||||
*/
|
*/
|
||||||
static const int TIXML2_MAJOR_VERSION = 7;
|
static const int TIXML2_MAJOR_VERSION = 8;
|
||||||
static const int TIXML2_MINOR_VERSION = 1;
|
static const int TIXML2_MINOR_VERSION = 0;
|
||||||
static const int TIXML2_PATCH_VERSION = 0;
|
static const int TIXML2_PATCH_VERSION = 0;
|
||||||
|
|
||||||
#define TINYXML2_MAJOR_VERSION 7
|
#define TINYXML2_MAJOR_VERSION 8
|
||||||
#define TINYXML2_MINOR_VERSION 1
|
#define TINYXML2_MINOR_VERSION 0
|
||||||
#define TINYXML2_PATCH_VERSION 0
|
#define TINYXML2_PATCH_VERSION 0
|
||||||
|
|
||||||
// A fixed element depth limit is problematic. There needs to be a
|
// A fixed element depth limit is problematic. There needs to be a
|
||||||
@@ -562,7 +562,7 @@ public:
|
|||||||
TIXMLASSERT( p );
|
TIXMLASSERT( p );
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
static char* SkipWhiteSpace( char* p, int* curLineNumPtr ) {
|
static char* SkipWhiteSpace( char* const p, int* curLineNumPtr ) {
|
||||||
return const_cast<char*>( SkipWhiteSpace( const_cast<const char*>(p), curLineNumPtr ) );
|
return const_cast<char*>( SkipWhiteSpace( const_cast<const char*>(p), curLineNumPtr ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -600,7 +600,7 @@ public:
|
|||||||
return strncmp( p, q, nChar ) == 0;
|
return strncmp( p, q, nChar ) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline static bool IsUTF8Continuation( char p ) {
|
inline static bool IsUTF8Continuation( const char p ) {
|
||||||
return ( p & 0x80 ) != 0;
|
return ( p & 0x80 ) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1640,7 +1640,22 @@ public:
|
|||||||
/// See QueryIntText()
|
/// See QueryIntText()
|
||||||
double DoubleText(double defaultValue = 0) const;
|
double DoubleText(double defaultValue = 0) const;
|
||||||
/// See QueryIntText()
|
/// See QueryIntText()
|
||||||
float FloatText(float defaultValue = 0) const;
|
float FloatText(float defaultValue = 0) const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Convenience method to create a new XMLElement and add it as last (right)
|
||||||
|
child of this node. Returns the created and inserted element.
|
||||||
|
*/
|
||||||
|
XMLElement* InsertNewChildElement(const char* name);
|
||||||
|
/// See InsertNewChildElement()
|
||||||
|
XMLComment* InsertNewComment(const char* comment);
|
||||||
|
/// See InsertNewChildElement()
|
||||||
|
XMLText* InsertNewText(const char* text);
|
||||||
|
/// See InsertNewChildElement()
|
||||||
|
XMLDeclaration* InsertNewDeclaration(const char* text);
|
||||||
|
/// See InsertNewChildElement()
|
||||||
|
XMLUnknown* InsertNewUnknown(const char* text);
|
||||||
|
|
||||||
|
|
||||||
// internal:
|
// internal:
|
||||||
enum ElementClosingType {
|
enum ElementClosingType {
|
||||||
@@ -1894,7 +1909,7 @@ public:
|
|||||||
char* Identify( char* p, XMLNode** node );
|
char* Identify( char* p, XMLNode** node );
|
||||||
|
|
||||||
// internal
|
// internal
|
||||||
void MarkInUse(XMLNode*);
|
void MarkInUse(const XMLNode* const);
|
||||||
|
|
||||||
virtual XMLNode* ShallowClone( XMLDocument* /*document*/ ) const {
|
virtual XMLNode* ShallowClone( XMLDocument* /*document*/ ) const {
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -37,60 +37,60 @@
|
|||||||
<PropertyGroup Label="Globals">
|
<PropertyGroup Label="Globals">
|
||||||
<ProjectGuid>{E8FB2712-8666-4662-A5B8-2B5B0FB1A260}</ProjectGuid>
|
<ProjectGuid>{E8FB2712-8666-4662-A5B8-2B5B0FB1A260}</ProjectGuid>
|
||||||
<RootNamespace>test</RootNamespace>
|
<RootNamespace>test</RootNamespace>
|
||||||
<WindowsTargetPlatformVersion>10.0.16299.0</WindowsTargetPlatformVersion>
|
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-Lib|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-Lib|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
<PlatformToolset>v141</PlatformToolset>
|
<PlatformToolset>v142</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-Lib|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-Lib|x64'" Label="Configuration">
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
<PlatformToolset>v141</PlatformToolset>
|
<PlatformToolset>v142</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-Dll|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-Dll|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
<PlatformToolset>v141</PlatformToolset>
|
<PlatformToolset>v142</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-Dll|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-Dll|x64'" Label="Configuration">
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
<PlatformToolset>v141</PlatformToolset>
|
<PlatformToolset>v142</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release-Lib|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release-Lib|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
<UseDebugLibraries>false</UseDebugLibraries>
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
<PlatformToolset>v141</PlatformToolset>
|
<PlatformToolset>v142</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release-Lib|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release-Lib|x64'" Label="Configuration">
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
<UseDebugLibraries>false</UseDebugLibraries>
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
<PlatformToolset>v141</PlatformToolset>
|
<PlatformToolset>v142</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release-Dll|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release-Dll|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
<UseDebugLibraries>false</UseDebugLibraries>
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
<PlatformToolset>v141</PlatformToolset>
|
<PlatformToolset>v142</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release-Dll|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release-Dll|x64'" Label="Configuration">
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
<UseDebugLibraries>false</UseDebugLibraries>
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
<PlatformToolset>v141</PlatformToolset>
|
<PlatformToolset>v142</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
|||||||
@@ -38,60 +38,60 @@
|
|||||||
<ProjectGuid>{D1C528B6-AA02-4D29-9D61-DC08E317A70D}</ProjectGuid>
|
<ProjectGuid>{D1C528B6-AA02-4D29-9D61-DC08E317A70D}</ProjectGuid>
|
||||||
<Keyword>Win32Proj</Keyword>
|
<Keyword>Win32Proj</Keyword>
|
||||||
<RootNamespace>tinyxml2</RootNamespace>
|
<RootNamespace>tinyxml2</RootNamespace>
|
||||||
<WindowsTargetPlatformVersion>10.0.16299.0</WindowsTargetPlatformVersion>
|
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-Lib|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-Lib|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
<PlatformToolset>v141</PlatformToolset>
|
<PlatformToolset>v142</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-Dll|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-Dll|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
<PlatformToolset>v141</PlatformToolset>
|
<PlatformToolset>v142</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-Lib|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-Lib|x64'" Label="Configuration">
|
||||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
<PlatformToolset>v141</PlatformToolset>
|
<PlatformToolset>v142</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-Dll|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-Dll|x64'" Label="Configuration">
|
||||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
<PlatformToolset>v141</PlatformToolset>
|
<PlatformToolset>v142</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release-Lib|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release-Lib|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
<UseDebugLibraries>false</UseDebugLibraries>
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
<PlatformToolset>v141</PlatformToolset>
|
<PlatformToolset>v142</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release-Dll|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release-Dll|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
<UseDebugLibraries>false</UseDebugLibraries>
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
<PlatformToolset>v141</PlatformToolset>
|
<PlatformToolset>v142</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release-Lib|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release-Lib|x64'" Label="Configuration">
|
||||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
<UseDebugLibraries>false</UseDebugLibraries>
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
<PlatformToolset>v141</PlatformToolset>
|
<PlatformToolset>v142</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release-Dll|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release-Dll|x64'" Label="Configuration">
|
||||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
<UseDebugLibraries>false</UseDebugLibraries>
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
<PlatformToolset>v141</PlatformToolset>
|
<PlatformToolset>v142</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
|
|||||||
109
xmltest.cpp
109
xmltest.cpp
@@ -968,8 +968,8 @@ int main( int argc, const char ** argv )
|
|||||||
printer.PushAttribute("attrib-int", int(1));
|
printer.PushAttribute("attrib-int", int(1));
|
||||||
printer.PushAttribute("attrib-unsigned", unsigned(2));
|
printer.PushAttribute("attrib-unsigned", unsigned(2));
|
||||||
printer.PushAttribute("attrib-int64", int64_t(3));
|
printer.PushAttribute("attrib-int64", int64_t(3));
|
||||||
printer.PushAttribute("attrib-uint64", uint64_t(37));
|
printer.PushAttribute("attrib-uint64", uint64_t(37));
|
||||||
printer.PushAttribute("attrib-bool", true);
|
printer.PushAttribute("attrib-bool", true);
|
||||||
printer.PushAttribute("attrib-double", 4.0);
|
printer.PushAttribute("attrib-double", 4.0);
|
||||||
printer.CloseElement();
|
printer.CloseElement();
|
||||||
fclose(printerfp);
|
fclose(printerfp);
|
||||||
@@ -989,14 +989,111 @@ int main( int argc, const char ** argv )
|
|||||||
XMLTest("attrib-unsigned", unsigned(2), attrib->UnsignedValue(), true);
|
XMLTest("attrib-unsigned", unsigned(2), attrib->UnsignedValue(), true);
|
||||||
attrib = cdoc.FirstChildElement("foo")->FindAttribute("attrib-int64");
|
attrib = cdoc.FirstChildElement("foo")->FindAttribute("attrib-int64");
|
||||||
XMLTest("attrib-int64", int64_t(3), attrib->Int64Value(), true);
|
XMLTest("attrib-int64", int64_t(3), attrib->Int64Value(), true);
|
||||||
attrib = cdoc.FirstChildElement("foo")->FindAttribute("attrib-uint64");
|
attrib = cdoc.FirstChildElement("foo")->FindAttribute("attrib-uint64");
|
||||||
XMLTest("attrib-uint64", uint64_t(37), attrib->Unsigned64Value(), true);
|
XMLTest("attrib-uint64", uint64_t(37), attrib->Unsigned64Value(), true);
|
||||||
attrib = cdoc.FirstChildElement("foo")->FindAttribute("attrib-bool");
|
attrib = cdoc.FirstChildElement("foo")->FindAttribute("attrib-bool");
|
||||||
XMLTest("attrib-bool", true, attrib->BoolValue(), true);
|
XMLTest("attrib-bool", true, attrib->BoolValue(), true);
|
||||||
attrib = cdoc.FirstChildElement("foo")->FindAttribute("attrib-double");
|
attrib = cdoc.FirstChildElement("foo")->FindAttribute("attrib-double");
|
||||||
XMLTest("attrib-double", 4.0, attrib->DoubleValue(), true);
|
XMLTest("attrib-double", 4.0, attrib->DoubleValue(), true);
|
||||||
}
|
}
|
||||||
|
// Add API_testcatse :PushDeclaration();PushText();PushComment()
|
||||||
|
{
|
||||||
|
FILE* fp1 = fopen("resources/out/printer_1.xml", "w");
|
||||||
|
XMLPrinter printer(fp1);
|
||||||
|
|
||||||
|
printer.PushDeclaration("version = '1.0' enconding = 'utf-8'");
|
||||||
|
|
||||||
|
printer.OpenElement("foo");
|
||||||
|
printer.PushAttribute("attrib-text", "text");
|
||||||
|
|
||||||
|
printer.OpenElement("text");
|
||||||
|
printer.PushText("Tinyxml2");
|
||||||
|
printer.CloseElement();
|
||||||
|
|
||||||
|
printer.OpenElement("int");
|
||||||
|
printer.PushText(int(11));
|
||||||
|
printer.CloseElement();
|
||||||
|
|
||||||
|
printer.OpenElement("unsigned");
|
||||||
|
printer.PushText(unsigned(12));
|
||||||
|
printer.CloseElement();
|
||||||
|
|
||||||
|
printer.OpenElement("int64_t");
|
||||||
|
printer.PushText(int64_t(13));
|
||||||
|
printer.CloseElement();
|
||||||
|
|
||||||
|
printer.OpenElement("uint64_t");
|
||||||
|
printer.PushText(uint64_t(14));
|
||||||
|
printer.CloseElement();
|
||||||
|
|
||||||
|
printer.OpenElement("bool");
|
||||||
|
printer.PushText(true);
|
||||||
|
printer.CloseElement();
|
||||||
|
|
||||||
|
printer.OpenElement("float");
|
||||||
|
printer.PushText("1.56");
|
||||||
|
printer.CloseElement();
|
||||||
|
|
||||||
|
printer.OpenElement("double");
|
||||||
|
printer.PushText("12.12");
|
||||||
|
printer.CloseElement();
|
||||||
|
|
||||||
|
printer.OpenElement("comment");
|
||||||
|
printer.PushComment("this is Tinyxml2");
|
||||||
|
printer.CloseElement();
|
||||||
|
|
||||||
|
printer.CloseElement();
|
||||||
|
fclose(fp1);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
XMLDocument doc;
|
||||||
|
doc.LoadFile("resources/out/printer_1.xml");
|
||||||
|
XMLTest("XMLPrinter Stream mode: load", XML_SUCCESS, doc.ErrorID(), true);
|
||||||
|
|
||||||
|
const XMLDocument& cdoc = doc;
|
||||||
|
|
||||||
|
const XMLElement* root = cdoc.FirstChildElement("foo");
|
||||||
|
|
||||||
|
const char* text_value;
|
||||||
|
text_value = root->FirstChildElement("text")->GetText();
|
||||||
|
XMLTest("PushText( const char* text, bool cdata=false ) test", "Tinyxml2", text_value);
|
||||||
|
|
||||||
|
int int_value;
|
||||||
|
int_value = root->FirstChildElement("int")->IntText();
|
||||||
|
XMLTest("PushText( int value ) test", 11, int_value);
|
||||||
|
|
||||||
|
unsigned unsigned_value;
|
||||||
|
unsigned_value = root->FirstChildElement("unsigned")->UnsignedText();
|
||||||
|
XMLTest("PushText( unsigned value ) test", (unsigned)12, unsigned_value);
|
||||||
|
|
||||||
|
int64_t int64_t_value;
|
||||||
|
int64_t_value = root->FirstChildElement("int64_t")->Int64Text();
|
||||||
|
XMLTest("PushText( int64_t value ) test", (int64_t) 13, int64_t_value);
|
||||||
|
|
||||||
|
uint64_t uint64_t_value;
|
||||||
|
uint64_t_value = root->FirstChildElement("uint64_t")->Unsigned64Text();
|
||||||
|
XMLTest("PushText( uint64_t value ) test", (uint64_t) 14, uint64_t_value);
|
||||||
|
|
||||||
|
float float_value;
|
||||||
|
float_value = root->FirstChildElement("float")->FloatText();
|
||||||
|
XMLTest("PushText( float value ) test", 1.56f, float_value);
|
||||||
|
|
||||||
|
double double_value;
|
||||||
|
double_value = root->FirstChildElement("double")->DoubleText();
|
||||||
|
XMLTest("PushText( double value ) test", 12.12, double_value);
|
||||||
|
|
||||||
|
bool bool_value;
|
||||||
|
bool_value = root->FirstChildElement("bool")->BoolText();
|
||||||
|
XMLTest("PushText( bool value ) test", true, bool_value);
|
||||||
|
|
||||||
|
const XMLComment* comment = root->FirstChildElement("comment")->FirstChild()->ToComment();
|
||||||
|
const char* comment_value = comment->Value();
|
||||||
|
XMLTest("PushComment() test", "this is Tinyxml2", comment_value);
|
||||||
|
|
||||||
|
const XMLDeclaration* declaration = cdoc.FirstChild()->ToDeclaration();
|
||||||
|
const char* declaration_value = declaration->Value();
|
||||||
|
XMLTest("PushDeclaration() test", "version = '1.0' enconding = 'utf-8'", declaration_value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1290,7 +1387,7 @@ int main( int argc, const char ** argv )
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
// trying to repro ]1874301]. If it doesn't go into an infinite loop, all is well.
|
// trying to repro [1874301]. If it doesn't go into an infinite loop, all is well.
|
||||||
unsigned char buf[] = "<?xml version=\"1.0\" encoding=\"utf-8\"?><feed><![CDATA[Test XMLblablablalblbl";
|
unsigned char buf[] = "<?xml version=\"1.0\" encoding=\"utf-8\"?><feed><![CDATA[Test XMLblablablalblbl";
|
||||||
buf[60] = 239;
|
buf[60] = 239;
|
||||||
buf[61] = 0;
|
buf[61] = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user