Merge pull request #85 from kainjow/master

Fixed some minor issues in the read me
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a0e4865..1caf802 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -10,7 +10,7 @@
 ################################

 # set lib version here

 

-set(GENERIC_LIB_VERSION "1.0.8")
+set(GENERIC_LIB_VERSION "1.0.9")
 set(GENERIC_LIB_SOVERSION "1")
 

 

diff --git a/dox b/dox
index 080a278..104eb6d 100755
--- a/dox
+++ b/dox
@@ -32,7 +32,7 @@
 # This could be handy for archiving the generated documentation or

 # if some version control system is used.

 

-PROJECT_NUMBER = 1.0.8
+PROJECT_NUMBER = 1.0.9
 

 # 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

diff --git a/tinyxml2.cpp b/tinyxml2.cpp
index 2fd52a5..61e9b58 100755
--- a/tinyxml2.cpp
+++ b/tinyxml2.cpp
@@ -30,8 +30,6 @@
 #   include <cstddef>

 #endif

 

-using namespace std;

-

 static const char LINE_FEED				= (char)0x0a;			// all line endings are normalized to LF

 static const char LF = LINE_FEED;

 static const char CARRIAGE_RETURN		= (char)0x0d;			// CR gets filtered out

@@ -669,6 +667,7 @@
         addThis->_next = 0;

     }

     addThis->_parent = this;

+    addThis->_memPool->SetTracked();

     return addThis;

 }

 

@@ -693,6 +692,7 @@
         addThis->_next = 0;

     }

     addThis->_parent = this;

+    addThis->_memPool->SetTracked();

     return addThis;

 }

 

@@ -713,6 +713,7 @@
     afterThis->_next->_prev = addThis;

     afterThis->_next = addThis;

     addThis->_parent = this;

+    addThis->_memPool->SetTracked();

     return addThis;

 }

 

@@ -814,6 +815,7 @@
             if ( parentEnd ) {

                 *parentEnd = static_cast<XMLElement*>(node)->_value;

             }

+			node->_memPool->SetTracked();	// created and then immediately deleted.

             DELETE_NODE( node );

             return p;

         }

@@ -1074,7 +1076,7 @@
 }

 

 

-int XMLAttribute::QueryIntValue( int* value ) const

+XMLError XMLAttribute::QueryIntValue( int* value ) const

 {

     if ( XMLUtil::ToInt( Value(), value )) {

         return XML_NO_ERROR;

@@ -1083,7 +1085,7 @@
 }

 

 

-int XMLAttribute::QueryUnsignedValue( unsigned int* value ) const

+XMLError XMLAttribute::QueryUnsignedValue( unsigned int* value ) const

 {

     if ( XMLUtil::ToUnsigned( Value(), value )) {

         return XML_NO_ERROR;

@@ -1092,7 +1094,7 @@
 }

 

 

-int XMLAttribute::QueryBoolValue( bool* value ) const

+XMLError XMLAttribute::QueryBoolValue( bool* value ) const

 {

     if ( XMLUtil::ToBool( Value(), value )) {

         return XML_NO_ERROR;

@@ -1101,7 +1103,7 @@
 }

 

 

-int XMLAttribute::QueryFloatValue( float* value ) const

+XMLError XMLAttribute::QueryFloatValue( float* value ) const

 {

     if ( XMLUtil::ToFloat( Value(), value )) {

         return XML_NO_ERROR;

@@ -1110,7 +1112,7 @@
 }

 

 

-int XMLAttribute::QueryDoubleValue( double* value ) const

+XMLError XMLAttribute::QueryDoubleValue( double* value ) const

 {

     if ( XMLUtil::ToDouble( Value(), value )) {

         return XML_NO_ERROR;

@@ -1227,7 +1229,7 @@
 }

 

 

-int XMLElement::QueryIntText( int* _value ) const

+XMLError XMLElement::QueryIntText( int* _value ) const

 {

     if ( FirstChild() && FirstChild()->ToText() ) {

         const char* t = FirstChild()->ToText()->Value();

@@ -1240,7 +1242,7 @@
 }

 

 

-int XMLElement::QueryUnsignedText( unsigned* _value ) const

+XMLError XMLElement::QueryUnsignedText( unsigned* _value ) const

 {

     if ( FirstChild() && FirstChild()->ToText() ) {

         const char* t = FirstChild()->ToText()->Value();

@@ -1253,7 +1255,7 @@
 }

 

 

-int XMLElement::QueryBoolText( bool* _value ) const

+XMLError XMLElement::QueryBoolText( bool* _value ) const

 {

     if ( FirstChild() && FirstChild()->ToText() ) {

         const char* t = FirstChild()->ToText()->Value();

@@ -1266,7 +1268,7 @@
 }

 

 

-int XMLElement::QueryDoubleText( double* _value ) const

+XMLError XMLElement::QueryDoubleText( double* _value ) const

 {

     if ( FirstChild() && FirstChild()->ToText() ) {

         const char* t = FirstChild()->ToText()->Value();

@@ -1279,7 +1281,7 @@
 }

 

 

-int XMLElement::QueryFloatText( float* _value ) const

+XMLError XMLElement::QueryFloatText( float* _value ) const

 {

     if ( FirstChild() && FirstChild()->ToText() ) {

         const char* t = FirstChild()->ToText()->Value();

@@ -1314,6 +1316,7 @@
             _rootAttribute = attrib;

         }

         attrib->SetName( name );

+        attrib->_memPool->SetTracked(); // always created and linked.

     }

     return attrib;

 }

@@ -1355,6 +1358,7 @@
         if ( XMLUtil::IsAlpha( *p ) ) {

             XMLAttribute* attrib = new (_document->_attributePool.Alloc() ) XMLAttribute();

             attrib->_memPool = &_document->_attributePool;

+			attrib->_memPool->SetTracked();

 

             p = attrib->ParseDeep( p, _document->ProcessEntities() );

             if ( !p || Attribute( attrib->Name() ) ) {

@@ -1486,7 +1490,7 @@
     XMLNode( 0 ),

     _writeBOM( false ),

     _processEntities( processEntities ),

-    _errorID( 0 ),

+    _errorID( XML_NO_ERROR ),

     _whitespace( whitespace ),

     _errorStr1( 0 ),

     _errorStr2( 0 ),

@@ -1508,10 +1512,14 @@
     attributePool.Trace( "attribute" );

 #endif

 

-    TIXMLASSERT( _textPool.CurrentAllocs() == 0 );

-    TIXMLASSERT( _elementPool.CurrentAllocs() == 0 );

-    TIXMLASSERT( _commentPool.CurrentAllocs() == 0 );

-    TIXMLASSERT( _attributePool.CurrentAllocs() == 0 );

+#ifdef DEBUG

+	if ( Error() == false ) {

+		TIXMLASSERT( _elementPool.CurrentAllocs()   == _elementPool.Untracked() );

+		TIXMLASSERT( _attributePool.CurrentAllocs() == _attributePool.Untracked() );

+		TIXMLASSERT( _textPool.CurrentAllocs()      == _textPool.Untracked() );

+		TIXMLASSERT( _commentPool.CurrentAllocs()   == _commentPool.Untracked() );

+	}

+#endif

 }

 

 

@@ -1571,7 +1579,7 @@
 }

 

 

-int XMLDocument::LoadFile( const char* filename )

+XMLError XMLDocument::LoadFile( const char* filename )

 {

     DeleteChildren();

     InitDocument();

@@ -1593,7 +1601,7 @@
 }

 

 

-int XMLDocument::LoadFile( FILE* fp )

+XMLError XMLDocument::LoadFile( FILE* fp )

 {

     DeleteChildren();

     InitDocument();

@@ -1628,7 +1636,7 @@
 }

 

 

-int XMLDocument::SaveFile( const char* filename, bool compact )

+XMLError XMLDocument::SaveFile( const char* filename, bool compact )

 {

     FILE* fp = 0;

 #if defined(_MSC_VER) && (_MSC_VER >= 1400 )

@@ -1647,7 +1655,7 @@
 }

 

 

-int XMLDocument::SaveFile( FILE* fp, bool compact )

+XMLError XMLDocument::SaveFile( FILE* fp, bool compact )

 {

     XMLPrinter stream( fp, compact );

     Print( &stream );

@@ -1655,7 +1663,7 @@
 }

 

 

-int XMLDocument::Parse( const char* p, size_t len )

+XMLError XMLDocument::Parse( const char* p, size_t len )

 {

     DeleteChildren();

     InitDocument();

@@ -1693,7 +1701,7 @@
 }

 

 

-void XMLDocument::SetError( int error, const char* str1, const char* str2 )

+void XMLDocument::SetError( XMLError error, const char* str1, const char* str2 )

 {

     _errorID = error;

     _errorStr1 = str1;

@@ -2087,4 +2095,5 @@
     return true;

 }

 

-}

+}   // namespace tinyxml2

+

diff --git a/tinyxml2.h b/tinyxml2.h
index 071dbbe..55f57a3 100755
--- a/tinyxml2.h
+++ b/tinyxml2.h
@@ -24,7 +24,7 @@
 #ifndef TINYXML2_INCLUDED

 #define TINYXML2_INCLUDED

 

-#ifdef ANDROID_NDK

+#if defined(ANDROID_NDK) || defined(__BORLANDC__)

 #   include <ctype.h>

 #   include <limits.h>

 #   include <stdio.h>

@@ -45,7 +45,7 @@
 */

 /*

 	gcc:

-        g++ -Wall tinyxml2.cpp xmltest.cpp -o gccxmltest.exe

+        g++ -Wall -DDEBUG tinyxml2.cpp xmltest.cpp -o gccxmltest.exe

     

     Formatting, Artistic Style:

         AStyle.exe --style=1tbs --indent-switches --break-closing-brackets --indent-preprocessor tinyxml2.cpp tinyxml2.h

@@ -100,7 +100,7 @@
 

 static const int TIXML2_MAJOR_VERSION = 1;

 static const int TIXML2_MINOR_VERSION = 0;

-static const int TIXML2_PATCH_VERSION = 8;

+static const int TIXML2_PATCH_VERSION = 9;

 

 namespace tinyxml2

 {

@@ -285,6 +285,7 @@
     virtual int ItemSize() const = 0;

     virtual void* Alloc() = 0;

     virtual void Free( void* ) = 0;

+    virtual void SetTracked() = 0;

 };

 

 

@@ -295,7 +296,7 @@
 class MemPoolT : public MemPool

 {

 public:

-    MemPoolT() : _root(0), _currentAllocs(0), _nAllocs(0), _maxAllocs(0)	{}

+    MemPoolT() : _root(0), _currentAllocs(0), _nAllocs(0), _maxAllocs(0), _nUntracked(0)	{}

     ~MemPoolT() {

         // Delete the blocks.

         for( int i=0; i<_blockPtrs.Size(); ++i ) {

@@ -330,6 +331,7 @@
             _maxAllocs = _currentAllocs;

         }

         _nAllocs++;

+        _nUntracked++;

         return result;

     }

     virtual void Free( void* mem ) {

@@ -349,6 +351,14 @@
                 name, _maxAllocs, _maxAllocs*SIZE/1024, _currentAllocs, SIZE, _nAllocs, _blockPtrs.Size() );

     }

 

+    void SetTracked() {

+        _nUntracked--;

+    }

+

+    int Untracked() const {

+        return _nUntracked;

+    }

+

     enum { COUNT = 1024/SIZE }; // Some compilers do not accept to use COUNT in private part if COUNT is private

 

 private:

@@ -365,6 +375,7 @@
     int _currentAllocs;

     int _nAllocs;

     int _maxAllocs;

+    int _nUntracked;

 };

 

 

@@ -439,19 +450,19 @@
     // Anything in the high order range of UTF-8 is assumed to not be whitespace. This isn't

     // correct, but simple, and usually works.

     static const char* SkipWhiteSpace( const char* p )	{

-        while( !IsUTF8Continuation(*p) && std::isspace( *reinterpret_cast<const unsigned char*>(p) ) ) {

+        while( !IsUTF8Continuation(*p) && isspace( *reinterpret_cast<const unsigned char*>(p) ) ) {

             ++p;

         }

         return p;

     }

     static char* SkipWhiteSpace( char* p )				{

-        while( !IsUTF8Continuation(*p) && std::isspace( *reinterpret_cast<unsigned char*>(p) ) )		{

+        while( !IsUTF8Continuation(*p) && isspace( *reinterpret_cast<unsigned char*>(p) ) )		{

             ++p;

         }

         return p;

     }

     static bool IsWhiteSpace( char p )					{

-        return !IsUTF8Continuation(p) && std::isspace( static_cast<unsigned char>(p) );

+        return !IsUTF8Continuation(p) && isspace( static_cast<unsigned char>(p) );

     }

 

     inline static bool StringEqual( const char* p, const char* q, int nChar=INT_MAX )  {

@@ -473,10 +484,10 @@
         return p & 0x80;

     }

     inline static int IsAlphaNum( unsigned char anyByte )	{

-        return ( anyByte < 128 ) ? std::isalnum( anyByte ) : 1;

+        return ( anyByte < 128 ) ? isalnum( anyByte ) : 1;

     }

     inline static int IsAlpha( unsigned char anyByte )		{

-        return ( anyByte < 128 ) ? std::isalpha( anyByte ) : 1;

+        return ( anyByte < 128 ) ? isalpha( anyByte ) : 1;

     }

 

     static const char* ReadBOM( const char* p, bool* hasBOM );

@@ -541,23 +552,29 @@
         return _document;

     }

 

+    /// Safely cast to an Element, or null.

     virtual XMLElement*		ToElement()		{

-        return 0;    ///< Safely cast to an Element, or null.

+        return 0;    

     }

+    /// Safely cast to Text, or null.

     virtual XMLText*		ToText()		{

-        return 0;    ///< Safely cast to Text, or null.

+        return 0;    

     }

+    /// Safely cast to a Comment, or null.

     virtual XMLComment*		ToComment()		{

-        return 0;    ///< Safely cast to a Comment, or null.

+        return 0;    

     }

+    /// Safely cast to a Document, or null.

     virtual XMLDocument*	ToDocument()	{

-        return 0;    ///< Safely cast to a Document, or null.

+        return 0;    

     }

+    /// Safely cast to a Declaration, or null.

     virtual XMLDeclaration*	ToDeclaration()	{

-        return 0;    ///< Safely cast to a Declaration, or null.

+        return 0;    

     }

+    /// Safely cast to an Unknown, or null.

     virtual XMLUnknown*		ToUnknown()		{

-        return 0;    ///< Safely cast to an Unknown, or null.

+        return 0;    

     }

 

     virtual const XMLElement*		ToElement() const		{

@@ -920,7 +937,7 @@
 };

 

 

-enum {

+enum XMLError {

     XML_NO_ERROR = 0,

     XML_SUCCESS = 0,

 

@@ -958,14 +975,17 @@
 {

     friend class XMLElement;

 public:

+    /// The name of the attribute.

     const char* Name() const {

-        return _name.GetStr();    ///< The name of the attribute.

+        return _name.GetStr();    

     }

+    /// The value of the attribute.

     const char* Value() const {

-        return _value.GetStr();    ///< The value of the attribute.

+        return _value.GetStr();    

     }

+    /// The next attribute in the list.

     const XMLAttribute* Next() const {

-        return _next;    ///< The next attribute in the list.

+        return _next;    

     }

 

     /** IntAttribute interprets the attribute as an integer, and returns the value.

@@ -1006,15 +1026,15 @@
     	in the provided paremeter. The function will return XML_NO_ERROR on success,

     	and XML_WRONG_ATTRIBUTE_TYPE if the conversion is not successful.

     */

-    int QueryIntValue( int* value ) const;

+    XMLError QueryIntValue( int* value ) const;

     /// See QueryIntAttribute

-    int QueryUnsignedValue( unsigned int* value ) const;

+    XMLError QueryUnsignedValue( unsigned int* value ) const;

     /// See QueryIntAttribute

-    int QueryBoolValue( bool* value ) const;

+    XMLError QueryBoolValue( bool* value ) const;

     /// See QueryIntAttribute

-    int QueryDoubleValue( double* value ) const;

+    XMLError QueryDoubleValue( double* value ) const;

     /// See QueryIntAttribute

-    int QueryFloatValue( float* value ) const;

+    XMLError QueryFloatValue( float* value ) const;

 

     /// Set the attribute to a string value.

     void SetAttribute( const char* value );

@@ -1147,7 +1167,7 @@
     	QueryIntAttribute( "foo", &value );		// if "foo" isn't found, value will still be 10

     	@endverbatim

     */

-    int QueryIntAttribute( const char* name, int* value ) const				{

+    XMLError QueryIntAttribute( const char* name, int* value ) const				{

         const XMLAttribute* a = FindAttribute( name );

         if ( !a ) {

             return XML_NO_ATTRIBUTE;

@@ -1155,7 +1175,7 @@
         return a->QueryIntValue( value );

     }

     /// See QueryIntAttribute()

-    int QueryUnsignedAttribute( const char* name, unsigned int* value ) const	{

+    XMLError QueryUnsignedAttribute( const char* name, unsigned int* value ) const	{

         const XMLAttribute* a = FindAttribute( name );

         if ( !a ) {

             return XML_NO_ATTRIBUTE;

@@ -1163,7 +1183,7 @@
         return a->QueryUnsignedValue( value );

     }

     /// See QueryIntAttribute()

-    int QueryBoolAttribute( const char* name, bool* value ) const				{

+    XMLError QueryBoolAttribute( const char* name, bool* value ) const				{

         const XMLAttribute* a = FindAttribute( name );

         if ( !a ) {

             return XML_NO_ATTRIBUTE;

@@ -1171,7 +1191,7 @@
         return a->QueryBoolValue( value );

     }

     /// See QueryIntAttribute()

-    int QueryDoubleAttribute( const char* name, double* value ) const			{

+    XMLError QueryDoubleAttribute( const char* name, double* value ) const			{

         const XMLAttribute* a = FindAttribute( name );

         if ( !a ) {

             return XML_NO_ATTRIBUTE;

@@ -1179,7 +1199,7 @@
         return a->QueryDoubleValue( value );

     }

     /// See QueryIntAttribute()

-    int QueryFloatAttribute( const char* name, float* value ) const			{

+    XMLError QueryFloatAttribute( const char* name, float* value ) const			{

         const XMLAttribute* a = FindAttribute( name );

         if ( !a ) {

             return XML_NO_ATTRIBUTE;

@@ -1281,15 +1301,15 @@
     			 to the requested type, and XML_NO_TEXT_NODE if there is no child text to query.

 

     */

-    int QueryIntText( int* _value ) const;

+    XMLError QueryIntText( int* _value ) const;

     /// See QueryIntText()

-    int QueryUnsignedText( unsigned* _value ) const;

+    XMLError QueryUnsignedText( unsigned* _value ) const;

     /// See QueryIntText()

-    int QueryBoolText( bool* _value ) const;

+    XMLError QueryBoolText( bool* _value ) const;

     /// See QueryIntText()

-    int QueryDoubleText( double* _value ) const;

+    XMLError QueryDoubleText( double* _value ) const;

     /// See QueryIntText()

-    int QueryFloatText( float* _value ) const;

+    XMLError QueryFloatText( float* _value ) const;

 

     // internal:

     enum {

@@ -1359,14 +1379,14 @@
     	specified, TinyXML will assume 'xml' points to a

     	null terminated string.

     */

-    int Parse( const char* xml, size_t nBytes=(size_t)(-1) );

+    XMLError Parse( const char* xml, size_t nBytes=(size_t)(-1) );

 

     /**

     	Load an XML file from disk.

     	Returns XML_NO_ERROR (0) on success, or

     	an errorID.

     */

-    int LoadFile( const char* filename );

+    XMLError LoadFile( const char* filename );

 

     /**

     	Load an XML file from disk. You are responsible

@@ -1375,14 +1395,14 @@
     	Returns XML_NO_ERROR (0) on success, or

     	an errorID.

     */

-    int LoadFile( std::FILE* );

+    XMLError LoadFile( FILE* );

 

     /**

     	Save the XML file to disk.

     	Returns XML_NO_ERROR (0) on success, or

     	an errorID.

     */

-    int SaveFile( const char* filename, bool compact = false );

+    XMLError SaveFile( const char* filename, bool compact = false );

 

     /**

     	Save the XML file to disk. You are responsible

@@ -1391,7 +1411,7 @@
     	Returns XML_NO_ERROR (0) on success, or

     	an errorID.

     */

-    int SaveFile( std::FILE* fp, bool compact = false );

+    XMLError SaveFile( FILE* fp, bool compact = false );

 

     bool ProcessEntities() const		{

         return _processEntities;

@@ -1484,14 +1504,14 @@
         node->_parent->DeleteChild( node );

     }

 

-    void SetError( int error, const char* str1, const char* str2 );

+    void SetError( XMLError error, const char* str1, const char* str2 );

 

     /// Return true if there was an error parsing the document.

     bool Error() const {

         return _errorID != XML_NO_ERROR;

     }

     /// Return the errorID.

-    int  ErrorID() const {

+    XMLError  ErrorID() const {

         return _errorID;

     }

     /// Return a possibly helpful diagnostic location or string.

@@ -1520,13 +1540,13 @@
     void operator=( const XMLDocument& );	// not supported

     void InitDocument();

 

-    bool _writeBOM;

-    bool _processEntities;

-    int  _errorID;

-    Whitespace _whitespace;

+    bool        _writeBOM;

+    bool        _processEntities;

+    XMLError    _errorID;

+    Whitespace  _whitespace;

     const char* _errorStr1;

     const char* _errorStr2;

-    char* _charBuffer;

+    char*       _charBuffer;

 

     MemPoolT< sizeof(XMLElement) >	 _elementPool;

     MemPoolT< sizeof(XMLAttribute) > _attributePool;

@@ -1790,7 +1810,7 @@
     	If 'compact' is set to true, then output is created

     	with only required whitespace and newlines.

     */

-    XMLPrinter( std::FILE* file=0, bool compact = false );

+    XMLPrinter( FILE* file=0, bool compact = false );

     ~XMLPrinter()	{}

 

     /** If streaming, write the BOM and declaration. */

@@ -1864,7 +1884,7 @@
 

     bool _elementJustOpened;

     bool _firstElement;

-    std::FILE* _fp;

+    FILE* _fp;

     int _depth;

     int _textDepth;

     bool _processEntities;

diff --git a/tinyxml2.sln b/tinyxml2.sln
deleted file mode 100644
index af8daa5..0000000
--- a/tinyxml2.sln
+++ /dev/null
@@ -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

diff --git a/tinyxml2/tinyxml2.sln b/tinyxml2/tinyxml2.sln
new file mode 100755
index 0000000..24d5ce6
--- /dev/null
+++ b/tinyxml2/tinyxml2.sln
@@ -0,0 +1,20 @@
+

+Microsoft Visual Studio Solution File, Format Version 11.00

+# Visual C++ Express 2010

+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tinyxml2", "tinyxml2.vcxproj", "{D1C528B6-AA02-4D29-9D61-DC08E317A70D}"

+EndProject

+Global

+	GlobalSection(SolutionConfigurationPlatforms) = preSolution

+		Debug|Win32 = Debug|Win32

+		Release|Win32 = Release|Win32

+	EndGlobalSection

+	GlobalSection(ProjectConfigurationPlatforms) = postSolution

+		{D1C528B6-AA02-4D29-9D61-DC08E317A70D}.Debug|Win32.ActiveCfg = Debug|Win32

+		{D1C528B6-AA02-4D29-9D61-DC08E317A70D}.Debug|Win32.Build.0 = Debug|Win32

+		{D1C528B6-AA02-4D29-9D61-DC08E317A70D}.Release|Win32.ActiveCfg = Release|Win32

+		{D1C528B6-AA02-4D29-9D61-DC08E317A70D}.Release|Win32.Build.0 = Release|Win32

+	EndGlobalSection

+	GlobalSection(SolutionProperties) = preSolution

+		HideSolutionNode = FALSE

+	EndGlobalSection

+EndGlobal

diff --git a/tinyxml2/tinyxml2.vcxproj b/tinyxml2/tinyxml2.vcxproj
old mode 100644
new mode 100755
index 9c97411..d13b5c6
--- a/tinyxml2/tinyxml2.vcxproj
+++ b/tinyxml2/tinyxml2.vcxproj
@@ -5,24 +5,15 @@
       <Configuration>Debug</Configuration>

       <Platform>Win32</Platform>

     </ProjectConfiguration>

-    <ProjectConfiguration Include="Debug|x64">

-      <Configuration>Debug</Configuration>

-      <Platform>x64</Platform>

-    </ProjectConfiguration>

     <ProjectConfiguration Include="Release|Win32">

       <Configuration>Release</Configuration>

       <Platform>Win32</Platform>

     </ProjectConfiguration>

-    <ProjectConfiguration Include="Release|x64">

-      <Configuration>Release</Configuration>

-      <Platform>x64</Platform>

-    </ProjectConfiguration>

   </ItemGroup>

   <PropertyGroup Label="Globals">

-    <ProjectGuid>{16A1D446-5415-444E-A7B4-F35B7DA7EE8C}</ProjectGuid>

+    <ProjectGuid>{D1C528B6-AA02-4D29-9D61-DC08E317A70D}</ProjectGuid>

     <Keyword>Win32Proj</Keyword>

     <RootNamespace>tinyxml2</RootNamespace>

-    <VCTargetsPath Condition="'$(VCTargetsPath11)' != '' and '$(VSVersion)' == '' and $(VisualStudioVersion) == ''">$(VCTargetsPath11)</VCTargetsPath>

   </PropertyGroup>

   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />

   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">

@@ -30,77 +21,35 @@
     <UseDebugLibraries>true</UseDebugLibraries>

     <CharacterSet>Unicode</CharacterSet>

   </PropertyGroup>

-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">

-    <ConfigurationType>Application</ConfigurationType>

-    <UseDebugLibraries>true</UseDebugLibraries>

-    <CharacterSet>Unicode</CharacterSet>

-  </PropertyGroup>

   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">

     <ConfigurationType>Application</ConfigurationType>

     <UseDebugLibraries>false</UseDebugLibraries>

     <WholeProgramOptimization>true</WholeProgramOptimization>

     <CharacterSet>Unicode</CharacterSet>

   </PropertyGroup>

-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">

-    <ConfigurationType>Application</ConfigurationType>

-    <UseDebugLibraries>false</UseDebugLibraries>

-    <WholeProgramOptimization>true</WholeProgramOptimization>

-    <CharacterSet>Unicode</CharacterSet>

-  </PropertyGroup>

   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />

   <ImportGroup Label="ExtensionSettings">

   </ImportGroup>

   <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">

     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />

   </ImportGroup>

-  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">

-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />

-  </ImportGroup>

   <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">

     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />

   </ImportGroup>

-  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">

-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />

-  </ImportGroup>

   <PropertyGroup Label="UserMacros" />

   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">

     <LinkIncremental>true</LinkIncremental>

-    <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>

-    <IntDir>$(Platform)\$(Configuration)\</IntDir>

-  </PropertyGroup>

-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">

-    <LinkIncremental>true</LinkIncremental>

   </PropertyGroup>

   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">

     <LinkIncremental>false</LinkIncremental>

-    <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>

-    <IntDir>$(Platform)\$(Configuration)\</IntDir>

-  </PropertyGroup>

-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">

-    <LinkIncremental>false</LinkIncremental>

   </PropertyGroup>

   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">

     <ClCompile>

       <PrecompiledHeader>

       </PrecompiledHeader>

-      <WarningLevel>Level4</WarningLevel>

-      <Optimization>Disabled</Optimization>

-      <PreprocessorDefinitions>;_CONSOLE;WIN32;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>

-      <ExceptionHandling>false</ExceptionHandling>

-    </ClCompile>

-    <Link>

-      <SubSystem>Console</SubSystem>

-      <GenerateDebugInformation>true</GenerateDebugInformation>

-    </Link>

-  </ItemDefinitionGroup>

-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">

-    <ClCompile>

-      <PrecompiledHeader>

-      </PrecompiledHeader>

-      <WarningLevel>Level4</WarningLevel>

+      <WarningLevel>Level3</WarningLevel>

       <Optimization>Disabled</Optimization>

       <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>

-      <ExceptionHandling>false</ExceptionHandling>

     </ClCompile>

     <Link>

       <SubSystem>Console</SubSystem>

@@ -115,26 +64,7 @@
       <Optimization>MaxSpeed</Optimization>

       <FunctionLevelLinking>true</FunctionLevelLinking>

       <IntrinsicFunctions>true</IntrinsicFunctions>

-      <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>

-      <StringPooling>true</StringPooling>

-    </ClCompile>

-    <Link>

-      <SubSystem>Console</SubSystem>

-      <GenerateDebugInformation>true</GenerateDebugInformation>

-      <EnableCOMDATFolding>true</EnableCOMDATFolding>

-      <OptimizeReferences>true</OptimizeReferences>

-    </Link>

-  </ItemDefinitionGroup>

-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">

-    <ClCompile>

-      <WarningLevel>Level3</WarningLevel>

-      <PrecompiledHeader>

-      </PrecompiledHeader>

-      <Optimization>MaxSpeed</Optimization>

-      <FunctionLevelLinking>true</FunctionLevelLinking>

-      <IntrinsicFunctions>true</IntrinsicFunctions>

       <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>

-      <StringPooling>true</StringPooling>

     </ClCompile>

     <Link>

       <SubSystem>Console</SubSystem>

@@ -145,15 +75,11 @@
   </ItemDefinitionGroup>

   <ItemGroup>

     <ClCompile Include="..\tinyxml2.cpp" />

-    <ClCompile Include="..\xmltest.cpp">

-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">_CRT_SECURE_NO_WARNINGS;_CONSOLE;WIN32;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>

-    </ClCompile>

+    <ClCompile Include="..\xmltest.cpp" />

   </ItemGroup>

   <ItemGroup>

     <ClInclude Include="..\tinyxml2.h" />

-  </ItemGroup>

-  <ItemGroup>

-    <None Include="..\readme.md" />

+    <ClInclude Include="..\xmltest.h" />

   </ItemGroup>

   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />

   <ImportGroup Label="ExtensionTargets">

diff --git a/tinyxml2/tinyxml2.vcxproj.filters b/tinyxml2/tinyxml2.vcxproj.filters
old mode 100644
new mode 100755
index a249a28..89f9d69
--- a/tinyxml2/tinyxml2.vcxproj.filters
+++ b/tinyxml2/tinyxml2.vcxproj.filters
@@ -1,27 +1,11 @@
 <?xml version="1.0" encoding="utf-8"?>

 <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

   <ItemGroup>

-    <Filter Include="Source Files">

-      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>

-      <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>

-    </Filter>

+    <ClCompile Include="..\tinyxml2.cpp" />

+    <ClCompile Include="..\xmltest.cpp" />

   </ItemGroup>

   <ItemGroup>

-    <ClCompile Include="..\xmltest.cpp">

-      <Filter>Source Files</Filter>

-    </ClCompile>

-    <ClCompile Include="..\tinyxml2.cpp">

-      <Filter>Source Files</Filter>

-    </ClCompile>

-  </ItemGroup>

-  <ItemGroup>

-    <ClInclude Include="..\tinyxml2.h">

-      <Filter>Source Files</Filter>

-    </ClInclude>

-  </ItemGroup>

-  <ItemGroup>

-    <None Include="..\readme.md">

-      <Filter>Source Files</Filter>

-    </None>

+    <ClInclude Include="..\tinyxml2.h" />

+    <ClInclude Include="..\xmltest.h" />

   </ItemGroup>

 </Project>
\ No newline at end of file
diff --git a/xmltest.cpp b/xmltest.cpp
index 34088ad..42ecd80 100644
--- a/xmltest.cpp
+++ b/xmltest.cpp
@@ -1,5 +1,8 @@
-#include "tinyxml2.h"

+#if defined( _MSC_VER )

+	#define _CRT_SECURE_NO_WARNINGS		// This test file is not intended to be secure.

+#endif

 

+#include "tinyxml2.h"

 #include <cstdlib>

 #include <cstring>

 #include <ctime>

@@ -334,7 +337,7 @@
 

 		XMLDocument doc;

 		doc.Parse( error );

-		XMLTest( "Bad XML", doc.ErrorID(), (int)XML_ERROR_PARSING_ATTRIBUTE );

+		XMLTest( "Bad XML", doc.ErrorID(), XML_ERROR_PARSING_ATTRIBUTE );

 	}

 

 	{

@@ -633,7 +636,7 @@
 		XMLDocument doc;

 		doc.Parse( doctype );

 

-		XMLTest( "Parsing repeated attributes.", (int)XML_ERROR_PARSING_ATTRIBUTE, doc.ErrorID() );	// is an  error to tinyxml (didn't use to be, but caused issues)

+		XMLTest( "Parsing repeated attributes.", XML_ERROR_PARSING_ATTRIBUTE, doc.ErrorID() );	// is an  error to tinyxml (didn't use to be, but caused issues)

 		doc.PrintError();

 	}

 

@@ -651,7 +654,7 @@
 		const char* str = "    ";

 		XMLDocument doc;

 		doc.Parse( str );

-		XMLTest( "Empty document error", (int)XML_ERROR_EMPTY_DOCUMENT, doc.ErrorID() );

+		XMLTest( "Empty document error", XML_ERROR_EMPTY_DOCUMENT, doc.ErrorID() );

 	}

 

 	{

@@ -678,7 +681,7 @@
 		xml.Parse("<x> ");

 		XMLTest("Missing end tag with trailing whitespace", xml.Error(), true);

 		xml.Parse("<x></y>");

-		XMLTest("Mismatched tags", xml.ErrorID(), (int)XML_ERROR_MISMATCHED_ELEMENT);

+		XMLTest("Mismatched tags", xml.ErrorID(), XML_ERROR_MISMATCHED_ELEMENT);

 	}

 

 

@@ -943,6 +946,19 @@
 		}

 	}

 

+#if 0

+	{

+		// Passes if assert doesn't fire.

+		XMLDocument xmlDoc;

+

+	    xmlDoc.NewDeclaration();

+	    xmlDoc.NewComment("Configuration file");

+

+	    XMLElement *root = xmlDoc.NewElement("settings");

+	    root->SetAttribute("version", 2);

+	}

+#endif

+

 	{

 		const char* xml = "<element>    </element>";

 		XMLDocument doc( true, COLLAPSE_WHITESPACE );

@@ -962,6 +978,28 @@
 	}

 #endif

 

+	{

+		// 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 );

+	}

+

+

 	// ----------- Performance tracking --------------

 	{

 #if defined( _MSC_VER )