Merge pull request #761 from untereiner/master

Add COMPONENT support at cmake install stage
diff --git a/readme.md b/readme.md
index d9bf501..7dad55d 100644
--- a/readme.md
+++ b/readme.md
@@ -264,7 +264,7 @@
 
 Simply compile and run. There is a visual studio 2017 project included, a simple Makefile,
 an Xcode project, a Code::Blocks project, and a cmake CMakeLists.txt included to help you.
-The top of tinyxml.h even has a simple g++ command line if you are are Unix/Linuk/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.
 
 Versioning
@@ -278,7 +278,7 @@
 Documentation
 -------------
 
-The documentation is build with Doxygen, using the 'dox'
+The documentation is built with Doxygen, using the 'dox'
 configuration file.
 
 License
diff --git a/tinyxml2.cpp b/tinyxml2.cpp
index 1c74279..6b79917 100755
--- a/tinyxml2.cpp
+++ b/tinyxml2.cpp
@@ -101,9 +101,9 @@
 #endif

 

 

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

+static const char LINE_FEED				= static_cast<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

+static const char CARRIAGE_RETURN		= static_cast<char>(0x0d);			// CR gets filtered out

 static const char CR = CARRIAGE_RETURN;

 static const char SINGLE_QUOTE			= '\'';

 static const char DOUBLE_QUOTE			= '\"';

@@ -430,22 +430,22 @@
     switch (*length) {

         case 4:

             --output;

-            *output = (char)((input | BYTE_MARK) & BYTE_MASK);

+            *output = static_cast<char>((input | BYTE_MARK) & BYTE_MASK);

             input >>= 6;

             //fall through

         case 3:

             --output;

-            *output = (char)((input | BYTE_MARK) & BYTE_MASK);

+            *output = static_cast<char>((input | BYTE_MARK) & BYTE_MASK);

             input >>= 6;

             //fall through

         case 2:

             --output;

-            *output = (char)((input | BYTE_MARK) & BYTE_MASK);

+            *output = static_cast<char>((input | BYTE_MARK) & BYTE_MASK);

             input >>= 6;

             //fall through

         case 1:

             --output;

-            *output = (char)(input | FIRST_BYTE_MARK[*length]);

+            *output = static_cast<char>(input | FIRST_BYTE_MARK[*length]);

             break;

         default:

             TIXMLASSERT( false );

@@ -582,12 +582,17 @@
 }

 

 

-void XMLUtil::ToStr(int64_t v, char* buffer, int bufferSize)

+void XMLUtil::ToStr( int64_t v, char* buffer, int bufferSize )

 {

 	// horrible syntax trick to make the compiler happy about %lld

-	TIXML_SNPRINTF(buffer, bufferSize, "%lld", (long long)v);

+	TIXML_SNPRINTF(buffer, bufferSize, "%lld", static_cast<long long>(v));

 }

 

+void XMLUtil::ToStr( uint64_t v, char* buffer, int bufferSize )

+{

+    // horrible syntax trick to make the compiler happy about %llu

+    TIXML_SNPRINTF(buffer, bufferSize, "%llu", (long long)v);

+}

 

 bool XMLUtil::ToInt( const char* str, int* value )

 {

@@ -612,13 +617,20 @@
         *value = (ival==0) ? false : true;

         return true;

     }

-    if ( StringEqual( str, "true" ) ) {

-        *value = true;

-        return true;

+    static const char* TRUE[] = { "true", "True", "TRUE", 0 };

+    static const char* FALSE[] = { "false", "False", "FALSE", 0 };

+

+    for (int i = 0; TRUE[i]; ++i) {

+        if (StringEqual(str, TRUE[i])) {

+            *value = true;

+            return true;

+        }

     }

-    else if ( StringEqual( str, "false" ) ) {

-        *value = false;

-        return true;

+    for (int i = 0; FALSE[i]; ++i) {

+        if (StringEqual(str, FALSE[i])) {

+            *value = false;

+            return true;

+        }

     }

     return false;

 }

@@ -646,13 +658,23 @@
 {

 	long long v = 0;	// horrible syntax trick to make the compiler happy about %lld

 	if (TIXML_SSCANF(str, "%lld", &v) == 1) {

-		*value = (int64_t)v;

+		*value = static_cast<int64_t>(v);

 		return true;

 	}

 	return false;

 }

 

 

+bool XMLUtil::ToUnsigned64(const char* str, uint64_t* value) {

+    unsigned long long v = 0;	// horrible syntax trick to make the compiler happy about %llu

+    if(TIXML_SSCANF(str, "%llu", &v) == 1) {

+        *value = (uint64_t)v;

+        return true;

+    }

+    return false;

+}

+

+

 char* XMLDocument::Identify( char* p, XMLNode** node )

 {

     TIXMLASSERT( node );

@@ -1414,6 +1436,15 @@
 }

 

 

+XMLError XMLAttribute::QueryUnsigned64Value(uint64_t* value) const

+{

+    if(XMLUtil::ToUnsigned64(Value(), value)) {

+        return XML_SUCCESS;

+    }

+    return XML_WRONG_ATTRIBUTE_TYPE;

+}

+

+

 XMLError XMLAttribute::QueryBoolValue( bool* value ) const

 {

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

@@ -1470,6 +1501,12 @@
 	_value.SetStr(buf);

 }

 

+void XMLAttribute::SetAttribute(uint64_t v)

+{

+    char buf[BUF_SIZE];

+    XMLUtil::ToStr(v, buf, BUF_SIZE);

+    _value.SetStr(buf);

+}

 

 

 void XMLAttribute::SetAttribute( bool v )

@@ -1556,6 +1593,13 @@
 	return i;

 }

 

+uint64_t XMLElement::Unsigned64Attribute(const char* name, uint64_t defaultValue) const

+{

+	uint64_t i = defaultValue;

+	QueryUnsigned64Attribute(name, &i);

+	return i;

+}

+

 bool XMLElement::BoolAttribute(const char* name, bool defaultValue) const

 {

 	bool b = defaultValue;

@@ -1620,6 +1664,12 @@
 	SetText(buf);

 }

 

+void XMLElement::SetText(uint64_t v) {

+    char buf[BUF_SIZE];

+    XMLUtil::ToStr(v, buf, BUF_SIZE);

+    SetText(buf);

+}

+

 

 void XMLElement::SetText( bool v )

 {

@@ -1684,6 +1734,19 @@
 }

 

 

+XMLError XMLElement::QueryUnsigned64Text(uint64_t* ival) const

+{

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

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

+        if(XMLUtil::ToUnsigned64(t, ival)) {

+            return XML_SUCCESS;

+        }

+        return XML_CAN_NOT_CONVERT_TEXT;

+    }

+    return XML_NO_TEXT_NODE;

+}

+

+

 XMLError XMLElement::QueryBoolText( bool* bval ) const

 {

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

@@ -1743,6 +1806,13 @@
 	return i;

 }

 

+uint64_t XMLElement::Unsigned64Text(uint64_t defaultValue) const

+{

+	uint64_t i = defaultValue;

+	QueryUnsigned64Text(&i);

+	return i;

+}

+

 bool XMLElement::BoolText(bool defaultValue) const

 {

 	bool b = defaultValue;

@@ -2194,7 +2264,7 @@
 struct LongFitsIntoSizeTMinusOne {

     static bool Fits( unsigned long value )

     {

-        return value < (size_t)-1;

+        return value < static_cast<size_t>(-1);

     }

 };

 

@@ -2290,7 +2360,7 @@
         SetError( XML_ERROR_EMPTY_DOCUMENT, 0, 0 );

         return _errorID;

     }

-    if ( len == (size_t)(-1) ) {

+    if ( len == static_cast<size_t>(-1) ) {

         len = strlen( p );

     }

     TIXMLASSERT( _charBuffer == 0 );

@@ -2424,13 +2494,13 @@
     }

     for( int i=0; i<NUM_ENTITIES; ++i ) {

         const char entityValue = entities[i].value;

-        const unsigned char flagIndex = (unsigned char)entityValue;

+        const unsigned char flagIndex = static_cast<unsigned char>(entityValue);

         TIXMLASSERT( flagIndex < ENTITY_RANGE );

         _entityFlag[flagIndex] = true;

     }

-    _restrictedEntityFlag[(unsigned char)'&'] = true;

-    _restrictedEntityFlag[(unsigned char)'<'] = true;

-    _restrictedEntityFlag[(unsigned char)'>'] = true;	// not required, but consistency is nice

+    _restrictedEntityFlag[static_cast<unsigned char>('&')] = true;

+    _restrictedEntityFlag[static_cast<unsigned char>('<')] = true;

+    _restrictedEntityFlag[static_cast<unsigned char>('>')] = true;	// not required, but consistency is nice

     _buffer.Push( 0 );

 }

 

@@ -2505,10 +2575,10 @@
                 // Check for entities. If one is found, flush

                 // the stream up until the entity, write the

                 // entity, and keep looking.

-                if ( flag[(unsigned char)(*q)] ) {

+                if ( flag[static_cast<unsigned char>(*q)] ) {

                     while ( p < q ) {

                         const size_t delta = q - p;

-                        const int toPrint = ( INT_MAX < delta ) ? INT_MAX : (int)delta;

+                        const int toPrint = ( INT_MAX < delta ) ? INT_MAX : static_cast<int>(delta);

                         Write( p, toPrint );

                         p += toPrint;

                     }

@@ -2536,7 +2606,7 @@
         // string if an entity wasn't found.

         if ( p < q ) {

             const size_t delta = q - p;

-            const int toPrint = ( INT_MAX < delta ) ? INT_MAX : (int)delta;

+            const int toPrint = ( INT_MAX < delta ) ? INT_MAX : static_cast<int>(delta);

             Write( p, toPrint );

         }

     }

@@ -2614,6 +2684,14 @@
 }

 

 

+void XMLPrinter::PushAttribute(const char* name, uint64_t v)

+{

+	char buf[BUF_SIZE];

+	XMLUtil::ToStr(v, buf, BUF_SIZE);

+	PushAttribute(name, buf);

+}

+

+

 void XMLPrinter::PushAttribute( const char* name, bool v )

 {

     char buf[BUF_SIZE];

@@ -2683,6 +2761,7 @@
     }

 }

 

+

 void XMLPrinter::PushText( int64_t value )

 {

     char buf[BUF_SIZE];

@@ -2690,6 +2769,15 @@
     PushText( buf, false );

 }

 

+

+void XMLPrinter::PushText( uint64_t value )

+{

+	char buf[BUF_SIZE];

+	XMLUtil::ToStr(value, buf, BUF_SIZE);

+	PushText(buf, false);

+}

+

+

 void XMLPrinter::PushText( int value )

 {

     char buf[BUF_SIZE];

diff --git a/tinyxml2.h b/tinyxml2.h
index c7d4070..956eb4a 100755
--- a/tinyxml2.h
+++ b/tinyxml2.h
@@ -617,6 +617,7 @@
     static void ToStr( float v, char* buffer, int bufferSize );

     static void ToStr( double v, char* buffer, int bufferSize );

 	static void ToStr(int64_t v, char* buffer, int bufferSize);

+    static void ToStr(uint64_t v, char* buffer, int bufferSize);

 

     // converts strings to primitive types

     static bool	ToInt( const char* str, int* value );

@@ -625,7 +626,7 @@
     static bool	ToFloat( const char* str, float* value );

     static bool ToDouble( const char* str, double* value );

 	static bool ToInt64(const char* str, int64_t* value);

-

+    static bool ToUnsigned64(const char* str, uint64_t* value);

 	// Changes what is serialized for a boolean value.

 	// Default to "true" and "false". Shouldn't be changed

 	// unless you have a special testing or compatibility need.

@@ -1164,6 +1165,12 @@
 		return i;

 	}

 

+    uint64_t Unsigned64Value() const {

+        uint64_t i = 0;

+        QueryUnsigned64Value(&i);

+        return i;

+    }

+

     /// Query as an unsigned integer. See IntValue()

     unsigned UnsignedValue() const			{

         unsigned i=0;

@@ -1198,6 +1205,8 @@
     XMLError QueryUnsignedValue( unsigned int* value ) const;

 	/// See QueryIntValue

 	XMLError QueryInt64Value(int64_t* value) const;

+    /// See QueryIntValue

+    XMLError QueryUnsigned64Value(uint64_t* value) const;

 	/// See QueryIntValue

     XMLError QueryBoolValue( bool* value ) const;

     /// See QueryIntValue

@@ -1213,7 +1222,9 @@
     void SetAttribute( unsigned value );

 	/// Set the attribute to value.

 	void SetAttribute(int64_t value);

-	/// Set the attribute to value.

+    /// Set the attribute to value.

+    void SetAttribute(uint64_t value);

+    /// Set the attribute to value.

     void SetAttribute( bool value );

     /// Set the attribute to value.

     void SetAttribute( double value );

@@ -1301,6 +1312,8 @@
 	unsigned UnsignedAttribute(const char* name, unsigned defaultValue = 0) const;

 	/// See IntAttribute()

 	int64_t Int64Attribute(const char* name, int64_t defaultValue = 0) const;

+    /// See IntAttribute()

+    uint64_t Unsigned64Attribute(const char* name, uint64_t defaultValue = 0) const;

 	/// See IntAttribute()

 	bool BoolAttribute(const char* name, bool defaultValue = false) const;

     /// See IntAttribute()

@@ -1347,6 +1360,15 @@
 		return a->QueryInt64Value(value);

 	}

 

+    /// See QueryIntAttribute()

+    XMLError QueryUnsigned64Attribute(const char* name, uint64_t* value) const {

+        const XMLAttribute* a = FindAttribute(name);

+        if(!a) {

+            return XML_NO_ATTRIBUTE;

+        }

+        return a->QueryUnsigned64Value(value);

+    }

+

 	/// See QueryIntAttribute()

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

         const XMLAttribute* a = FindAttribute( name );

@@ -1413,7 +1435,11 @@
 		return QueryInt64Attribute(name, value);

 	}

 

-	XMLError QueryAttribute( const char* name, bool* value ) const {

+    XMLError QueryAttribute(const char* name, uint64_t* value) const {

+        return QueryUnsigned64Attribute(name, value);

+    }

+

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

 		return QueryBoolAttribute( name, value );

 	}

 

@@ -1447,7 +1473,13 @@
 		a->SetAttribute(value);

 	}

 

-	/// Sets the named attribute to value.

+    /// Sets the named attribute to value.

+    void SetAttribute(const char* name, uint64_t value) {

+        XMLAttribute* a = FindOrCreateAttribute(name);

+        a->SetAttribute(value);

+    }

+    

+    /// Sets the named attribute to value.

     void SetAttribute( const char* name, bool value )			{

         XMLAttribute* a = FindOrCreateAttribute( name );

         a->SetAttribute( value );

@@ -1546,6 +1578,8 @@
     void SetText( unsigned value );

 	/// Convenience method for setting text inside an element. See SetText() for important limitations.

 	void SetText(int64_t value);

+    /// Convenience method for setting text inside an element. See SetText() for important limitations.

+    void SetText(uint64_t value);

 	/// Convenience method for setting text inside an element. See SetText() for important limitations.

     void SetText( bool value );

     /// Convenience method for setting text inside an element. See SetText() for important limitations.

@@ -1585,6 +1619,8 @@
 	/// See QueryIntText()

 	XMLError QueryInt64Text(int64_t* uval) const;

 	/// See QueryIntText()

+	XMLError QueryUnsigned64Text(uint64_t* uval) const;

+	/// See QueryIntText()

     XMLError QueryBoolText( bool* bval ) const;

     /// See QueryIntText()

     XMLError QueryDoubleText( double* dval ) const;

@@ -1597,6 +1633,8 @@
 	unsigned UnsignedText(unsigned defaultValue = 0) const;

 	/// See QueryIntText()

 	int64_t Int64Text(int64_t defaultValue = 0) const;

+    /// See QueryIntText()

+    uint64_t Unsigned64Text(uint64_t defaultValue = 0) const;

 	/// See QueryIntText()

 	bool BoolText(bool defaultValue = false) const;

 	/// See QueryIntText()

@@ -1684,7 +1722,7 @@
     	specified, TinyXML-2 will assume 'xml' points to a

     	null terminated string.

     */

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

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

 

     /**

     	Load an XML file from disk.

@@ -2194,7 +2232,8 @@
     void PushAttribute( const char* name, const char* value );

     void PushAttribute( const char* name, int value );

     void PushAttribute( const char* name, unsigned value );

-	void PushAttribute(const char* name, int64_t value);

+	void PushAttribute( const char* name, int64_t value );

+	void PushAttribute( const char* name, uint64_t value );

 	void PushAttribute( const char* name, bool value );

     void PushAttribute( const char* name, double value );

     /// If streaming, close the Element.

@@ -2206,8 +2245,10 @@
     void PushText( int value );

     /// Add a text node from an unsigned.

     void PushText( unsigned value );

-	/// Add a text node from an unsigned.

-	void PushText(int64_t value);

+	/// Add a text node from a signed 64bit integer.

+	void PushText( int64_t value );

+	/// Add a text node from an unsigned 64bit integer.

+	void PushText( uint64_t value );

 	/// Add a text node from a bool.

     void PushText( bool value );

     /// Add a text node from a float.

@@ -2253,10 +2294,10 @@
     	If in print to memory mode, reset the buffer to the

     	beginning.

     */

-    void ClearBuffer() {

+    void ClearBuffer( bool resetToFirstElement = true ) {

         _buffer.Clear();

         _buffer.Push(0);

-		_firstElement = true;

+		_firstElement = resetToFirstElement;

     }

 

 protected:

diff --git a/xmltest.cpp b/xmltest.cpp
old mode 100644
new mode 100755
index a0aaee7..5a07547
--- a/xmltest.cpp
+++ b/xmltest.cpp
@@ -461,9 +461,9 @@
 		// Build:

 		//		<element>

 		//			<!--comment-->

+		//			<sub attrib="0" />

 		//			<sub attrib="1" />

-		//			<sub attrib="2" />

-		//			<sub attrib="3" >& Text!</sub>

+		//			<sub attrib="2" >& Text!</sub>

 		//		<element>

 

 		XMLDocument* doc = new XMLDocument();

@@ -804,6 +804,7 @@
 	// ---------- Attributes ---------

 	{

 		static const int64_t BIG = -123456789012345678;

+        static const uint64_t BIG_POS = 123456789012345678;

 		XMLDocument doc;

 		XMLElement* element = doc.NewElement("element");

 		doc.InsertFirstChild(element);

@@ -864,7 +865,23 @@
 			}

 			XMLTest("Attribute: int64_t", BIG, element->Int64Attribute("attrib"), true);

 		}

-		{

+        {

+            element->SetAttribute("attrib", BIG_POS);

+            {

+                uint64_t v = 0;

+                XMLError queryResult = element->QueryUnsigned64Attribute("attrib", &v);

+                XMLTest("Attribute: uint64_t", XML_SUCCESS, queryResult, true);

+                XMLTest("Attribute: uint64_t", BIG_POS, v, true);

+            }

+            {

+                uint64_t v = 0;

+                int queryResult = element->QueryAttribute("attrib", &v);

+                XMLTest("Attribute: uint64_t", (int)XML_SUCCESS, queryResult, true);

+                XMLTest("Attribute: uint64_t", BIG_POS, v, true);

+            }

+            XMLTest("Attribute: uint64_t", BIG_POS, element->Unsigned64Attribute("attrib"), true);

+        }

+        {

 			element->SetAttribute("attrib", true);

 			{

 				bool v = false;

@@ -931,7 +948,14 @@
 			XMLTest("Element: int64_t", XML_SUCCESS, queryResult, true);

 			XMLTest("Element: int64_t", BIG, v, true);

 		}

-	}

+        {

+            element->SetText(BIG_POS);

+            uint64_t v = 0;

+            XMLError queryResult = element->QueryUnsigned64Text(&v);

+            XMLTest("Element: uint64_t", XML_SUCCESS, queryResult, true);

+            XMLTest("Element: uint64_t", BIG_POS, v, true);

+        }

+    }

 

 	// ---------- XMLPrinter stream mode ------

 	{

@@ -944,7 +968,8 @@
 			printer.PushAttribute("attrib-int", int(1));

 			printer.PushAttribute("attrib-unsigned", unsigned(2));

 			printer.PushAttribute("attrib-int64", int64_t(3));

-			printer.PushAttribute("attrib-bool", true);

+            printer.PushAttribute("attrib-uint64", uint64_t(37));

+            printer.PushAttribute("attrib-bool", true);

 			printer.PushAttribute("attrib-double", 4.0);

 			printer.CloseElement();

 			fclose(printerfp);

@@ -964,7 +989,9 @@
 			XMLTest("attrib-unsigned", unsigned(2), attrib->UnsignedValue(), true);

 			attrib = cdoc.FirstChildElement("foo")->FindAttribute("attrib-int64");

 			XMLTest("attrib-int64", int64_t(3), attrib->Int64Value(), true);

-			attrib = cdoc.FirstChildElement("foo")->FindAttribute("attrib-bool");

+            attrib = cdoc.FirstChildElement("foo")->FindAttribute("attrib-uint64");

+            XMLTest("attrib-uint64", uint64_t(37), attrib->Unsigned64Value(), true);

+            attrib = cdoc.FirstChildElement("foo")->FindAttribute("attrib-bool");

 			XMLTest("attrib-bool", true, attrib->BoolValue(), true);

 			attrib = cdoc.FirstChildElement("foo")->FindAttribute("attrib-double");

 			XMLTest("attrib-double", 4.0, attrib->DoubleValue(), true);

@@ -1523,6 +1550,70 @@
 		XMLTest( "Ill formed XML", true, doc.Error() );

 	}

 

+    {

+        //API:IntText(),UnsignedText(),Int64Text(),DoubleText(),BoolText() and FloatText() test

+        const char* xml = "<point> <IntText>-24</IntText> <UnsignedText>42</UnsignedText> \

+						   <Int64Text>38</Int64Text> <BoolText>true</BoolText> <DoubleText>2.35</DoubleText> </point>";

+        XMLDocument doc;

+        doc.Parse(xml);

+

+        const XMLElement* pointElement = doc.RootElement();

+        int test1 = pointElement->FirstChildElement("IntText")->IntText();

+        XMLTest("IntText() test", -24, test1);

+

+        unsigned test2 = pointElement->FirstChildElement("UnsignedText")->UnsignedText();

+        XMLTest("UnsignedText() test", static_cast<unsigned>(42), test2);

+

+        int64_t test3 = pointElement->FirstChildElement("Int64Text")->Int64Text();

+        XMLTest("Int64Text() test", static_cast<int64_t>(38), test3);

+

+        double test4 = pointElement->FirstChildElement("DoubleText")->DoubleText();

+        XMLTest("DoubleText() test", 2.35, test4);

+

+        float test5 = pointElement->FirstChildElement("DoubleText")->FloatText();

+        XMLTest("FloatText()) test", 2.35f, test5);

+

+        bool test6 = pointElement->FirstChildElement("BoolText")->BoolText();

+        XMLTest("FloatText()) test", true, test6);

+    }

+

+	{

+		//API:ShallowEqual() test

+		const char* xml = "<playlist id = 'playlist'>"

+						    "<property name = 'track_name'>voice</property>"

+						  "</playlist>";

+		XMLDocument doc;

+		doc.Parse( xml );

+		const XMLNode* PlaylistNode = doc.RootElement();

+		const XMLNode* PropertyNode = PlaylistNode->FirstChildElement();

+		bool result;

+		result = PlaylistNode->ShallowEqual(PropertyNode);

+		XMLTest("ShallowEqual() test",false,result);

+		result = PlaylistNode->ShallowEqual(PlaylistNode);

+		XMLTest("ShallowEqual() test",true,result);

+	}

+

+	{

+		//API: previousSiblingElement() and NextSiblingElement() test

+		const char* xml = "<playlist id = 'playlist'>"

+						    "<property name = 'track_name'>voice</property>"

+						    "<entry out = '946' producer = '2_playlist1' in = '0'/>"

+							"<blank length = '1'/>"

+						  "</playlist>";

+		XMLDocument doc;

+		doc.Parse( xml );

+		XMLElement* ElementPlaylist = doc.FirstChildElement("playlist");

+		XMLTest("previousSiblingElement() test",true,ElementPlaylist != 0);

+		const XMLElement* pre = ElementPlaylist->PreviousSiblingElement();

+		XMLTest("previousSiblingElement() test",true,pre == 0);

+		const XMLElement* ElementBlank = ElementPlaylist->FirstChildElement("entry")->NextSiblingElement("blank");

+		XMLTest("NextSiblingElement() test",true,ElementBlank != 0);

+		const XMLElement* next = ElementBlank->NextSiblingElement();

+		XMLTest("NextSiblingElement() test",true,next == 0);

+		const XMLElement* ElementEntry = ElementBlank->PreviousSiblingElement("entry");

+		XMLTest("PreviousSiblingElement test",true,ElementEntry != 0);

+	}

+

 	// QueryXYZText

 	{

 		const char* xml = "<point> <x>1.2</x> <y>1</y> <z>38</z> <valid>true</valid> </point>";

@@ -1702,12 +1793,12 @@
             doc.Print( &printer );

 

             XMLTest( "BOM preservation (compare)", xml_bom_preservation, printer.CStr(), false, true );

-			doc.SaveFile( "resources/bomtest.xml" );

+			doc.SaveFile( "resources/out/bomtest.xml" );

 			XMLTest( "Save bomtest.xml", false, doc.Error() );

         }

 		{

 			XMLDocument doc;

-			doc.LoadFile( "resources/bomtest.xml" );

+			doc.LoadFile( "resources/out/bomtest.xml" );

 			XMLTest( "Load bomtest.xml", false, doc.Error() );

 			XMLTest( "BOM preservation (load)", true, doc.HasBOM(), false );