Index: NonGTP/OSceneLoader/include/OgreOSMScene.h
===================================================================
--- NonGTP/OSceneLoader/include/OgreOSMScene.h	(revision 965)
+++ NonGTP/OSceneLoader/include/OgreOSMScene.h	(revision 965)
@@ -0,0 +1,95 @@
+/**********************************************************************
+ *<
+	oExporter plugin Private Beta (see License.txt)
+
+	FILE: ogreAnimationCompiler.h
+
+	DESCRIPTION: OE_XMLScene reader (oe_scene) include header	
+
+	IMPLEMENTED BY: Lioric
+
+	HISTORY: 
+
+		Original implementation by Lasse Tassing (Channex)
+		2005 ITE ApS, Lasse Tassing
+
+ *>	Copyright (c) 2005, All Rights Reserved.
+ **********************************************************************/
+
+
+#ifndef __OGRE_XML_SCENE__
+#define __OGRE_XML_SCENE__
+
+
+#include "Ogre.h"
+#include "OgreSharedPtr.h"
+#include "..\TinyXML\tinyxml.h"
+
+#include "IOSMSceneCallbacks.h"
+
+class TiXmlDocumentPtr : public Ogre::SharedPtr<TiXmlDocument> {
+public:
+	TiXmlDocumentPtr() : Ogre::SharedPtr<TiXmlDocument>() {}	
+	explicit TiXmlDocumentPtr(TiXmlDocument* rep) : Ogre::SharedPtr<TiXmlDocument>(rep) {}
+	
+};
+
+class OSMScene
+{
+public:
+
+	typedef std::vector<Ogre::Camera*>	CameraList;
+	typedef std::vector<Ogre::Light*>	LightList;
+	typedef std::vector<Ogre::Entity*>	EntityList;
+
+	OSMScene(Ogre::SceneManager* pSceneMgr = 0, Ogre::RenderWindow* win = 0);
+	~OSMScene(void);
+
+	// Initialise
+	bool	initialise(const char *pszXMLFile, OSMSceneCallbacks* pCallbacks = NULL);
+
+	// Declare all resources used in the scene
+	void	declareResources(void);
+
+	// Create scene, optionally attaching it to a parent node
+	bool	createScene(Ogre::SceneNode *pParent = NULL);
+
+	// Get list of cameras in this scene
+	CameraList&	getCameraList(void);
+
+	// Get list of lights in this scene
+	LightList&	getLightList(void);
+
+	// Get list of lights in this scene
+	EntityList&	getEntityList(void);
+
+	// Get created scene manager
+	Ogre::SceneManager* getSceneManager(void) { return mSceneMgr; }
+
+private:
+	// Create node from information
+	Ogre::SceneNode* createNode(TiXmlElement* pElem, Ogre::SceneNode *pSceneRoot);
+
+	// Creation helpers
+	void	setSceneProperties(TiXmlElement* sceneProp);
+	void	createEntities(TiXmlElement* pEntityNode, Ogre::SceneNode *pSceneRoot);
+	void	createLights(TiXmlElement* pLightNode, Ogre::SceneNode *pSceneRoot);
+	void	createCameras(TiXmlElement* pCameraNode, Ogre::SceneNode *pSceneRoot);
+
+	// Created objects
+	CameraList	mCameras;
+	LightList	mLights;
+	EntityList	mEntities;
+
+	// Callback interface
+	OSMSceneCallbacks* mCallbacks;
+
+	// Scene manager
+	Ogre::SceneManager* mSceneMgr;
+	Ogre::RenderWindow* mWindow;
+
+	// Scene XML document
+	TiXmlDocumentPtr mXMLDoc;
+};
+
+#endif
Index: NonGTP/OSceneLoader/include/IOSMSceneCallbacks.h
===================================================================
--- NonGTP/OSceneLoader/include/IOSMSceneCallbacks.h	(revision 965)
+++ NonGTP/OSceneLoader/include/IOSMSceneCallbacks.h	(revision 965)
@@ -0,0 +1,43 @@
+/**********************************************************************
+ *<
+	oExporter plugin Private Beta (see License.txt)
+
+	FILE: ogreAnimationCompiler.h
+
+	DESCRIPTION: OE_XMLScene callbacks interface	
+
+	IMPLEMENTED BY: Lioric
+
+	HISTORY: 
+
+		Original implementation by Lasse Tassing (Channex)
+		2005 ITE ApS, Lasse Tassing
+
+ *>	Copyright (c) 2005, All Rights Reserved.
+ **********************************************************************/
+
+
+#ifndef __XML_SCENE_CALLBACKS__
+#define __XML_SCENE_CALLBACKS__
+
+// Callback interface. Use this if you want to set special properties on the 
+// objects during creation (and/or read custom attribute values).
+class OSMSceneCallbacks
+{
+public:
+	virtual ~OSMSceneCallbacks() {};
+
+	// Called when a node has been created
+	virtual void OnNodeCreate(Ogre::SceneNode *pNode, TiXmlElement* pNodeDesc) {};
+
+	// Called when an entity has been created
+	virtual void OnEntityCreate(Ogre::Entity *pEntity, TiXmlElement* pEntityDesc) {};
+
+	// Called when a camera has been created
+	virtual void OnCameraCreate(Ogre::Camera *pCamera, TiXmlElement* pCameraDesc) {};
+
+	// Called when a light has been created
+	virtual void OnLightCreate(Ogre::Light *pLight, TiXmlElement* pLightDesc) {};
+};
+
+#endif
Index: NonGTP/OSceneLoader/TinyXML/tinyxmlerror.cpp
===================================================================
--- NonGTP/OSceneLoader/TinyXML/tinyxmlerror.cpp	(revision 965)
+++ NonGTP/OSceneLoader/TinyXML/tinyxmlerror.cpp	(revision 965)
@@ -0,0 +1,50 @@
+/*
+www.sourceforge.net/projects/tinyxml
+Original code (2.0 and earlier )copyright (c) 2000-2002 Lee Thomason (www.grinninglizard.com)
+
+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 "tinyxml.h"
+
+// The goal of the seperate error file is to make the first
+// step towards localization. tinyxml (currently) only supports
+// latin-1, but at least the error messages could now be translated.
+//
+// It also cleans up the code a bit.
+//
+
+const char* TiXmlBase::errorString[ TIXML_ERROR_STRING_COUNT ] =
+{
+	"No error",
+	"Error",
+	"Failed to open file",
+	"Memory allocation failed.",
+	"Error parsing Element.",
+	"Failed to read Element name",
+	"Error reading Element value.",
+	"Error reading Attributes.",
+	"Error: empty tag.",
+	"Error reading end tag.",
+	"Error parsing Unknown.",
+	"Error parsing Comment.",
+	"Error parsing Declaration.",
+	"Error document empty."
+};
Index: NonGTP/OSceneLoader/TinyXML/tinystr.h
===================================================================
--- NonGTP/OSceneLoader/TinyXML/tinystr.h	(revision 965)
+++ NonGTP/OSceneLoader/TinyXML/tinystr.h	(revision 965)
@@ -0,0 +1,228 @@
+/*
+www.sourceforge.net/projects/tinyxml
+Original file by Yves Berquin.
+
+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 "tinyxml.h"
+
+
+#ifndef TIXML_USE_STL
+
+#ifndef TIXML_STRING_INCLUDED
+#define TIXML_STRING_INCLUDED
+
+#pragma warning( disable : 4514 )
+
+#include <assert.h>
+
+/*
+   TiXmlString is an emulation of the std::string template.
+   Its purpose is to allow compiling TinyXML on compilers with no or poor STL support.
+   Only the member functions relevant to the TinyXML project have been implemented.
+   The buffer allocation is made by a simplistic power of 2 like mechanism : if we increase
+   a string and there's no more room, we allocate a buffer twice as big as we need.
+*/
+class TiXmlString
+{
+  public :
+    // TiXmlString constructor, based on a string
+    TiXmlString (const char * instring);
+
+    // TiXmlString empty constructor
+    TiXmlString ()
+    {
+        allocated = 0;
+        cstring = NULL;
+    }
+
+    // TiXmlString copy constructor
+    TiXmlString (const TiXmlString& copy);
+
+    // TiXmlString destructor
+    ~ TiXmlString ()
+    {
+        empty_it ();
+    }
+
+    // Convert a TiXmlString into a classical char *
+    const char * c_str () const
+    {
+        if (allocated)
+            return cstring;
+        return "";
+    }
+
+    // Return the length of a TiXmlString
+    unsigned length () const;
+
+    // TiXmlString = operator
+    void operator = (const char * content);
+
+    // = operator
+    void operator = (const TiXmlString & copy);
+
+    // += operator. Maps to append
+    TiXmlString& operator += (const char * suffix)
+    {
+        append (suffix);
+		return *this;
+    }
+
+    // += operator. Maps to append
+    TiXmlString& operator += (char single)
+    {
+        append (single);
+		return *this;
+    }
+
+    // += operator. Maps to append
+    TiXmlString& operator += (TiXmlString & suffix)
+    {
+        append (suffix);
+		return *this;
+    }
+    bool operator == (const TiXmlString & compare) const;
+    bool operator < (const TiXmlString & compare) const;
+    bool operator > (const TiXmlString & compare) const;
+
+    // Checks if a TiXmlString is empty
+    bool empty () const
+    {
+        return length () ? false : true;
+    }
+
+    // Checks if a TiXmlString contains only whitespace (same rules as isspace)
+	// Not actually used in tinyxml. Conflicts with a C macro, "isblank",
+	// which is a problem. Commenting out. -lee
+//    bool isblank () const;
+
+    // single char extraction
+    const char& at (unsigned index) const
+    {
+        assert( index < length ());
+        return cstring [index];
+    }
+
+    // find a char in a string. Return TiXmlString::notfound if not found
+    unsigned find (char lookup) const
+    {
+        return find (lookup, 0);
+    }
+
+    // find a char in a string from an offset. Return TiXmlString::notfound if not found
+    unsigned find (char tofind, unsigned offset) const;
+
+    /*	Function to reserve a big amount of data when we know we'll need it. Be aware that this
+		function clears the content of the TiXmlString if any exists.
+    */
+    void reserve (unsigned size)
+    {
+        empty_it ();
+        if (size)
+        {
+            allocated = size;
+            cstring = new char [size];
+            cstring [0] = 0;
+        }
+    }
+
+    // [] operator 
+    char& operator [] (unsigned index) const
+    {
+        assert( index < length ());
+        return cstring [index];
+    }
+
+    // Error value for find primitive 
+    enum {	notfound = 0xffffffff,
+            npos = notfound };
+
+    void append (const char *str, int len );
+
+  protected :
+
+    // The base string
+    char * cstring;
+    // Number of chars allocated
+    unsigned allocated;
+
+    // New size computation. It is simplistic right now : it returns twice the amount
+    // we need
+    unsigned assign_new_size (unsigned minimum_to_allocate)
+    {
+        return minimum_to_allocate * 2;
+    }
+
+    // Internal function that clears the content of a TiXmlString
+    void empty_it ()
+    {
+        if (cstring)
+            delete [] cstring;
+        cstring = NULL;
+        allocated = 0;
+    }
+
+    void append (const char *suffix );
+
+    // append function for another TiXmlString
+    void append (const TiXmlString & suffix)
+    {
+        append (suffix . c_str ());
+    }
+
+    // append for a single char. This could be improved a lot if needed
+    void append (char single)
+    {
+        char smallstr [2];
+        smallstr [0] = single;
+        smallstr [1] = 0;
+        append (smallstr);
+    }
+
+} ;
+
+/* 
+   TiXmlOutStream is an emulation of std::ostream. It is based on TiXmlString.
+   Only the operators that we need for TinyXML have been developped.
+*/
+class TiXmlOutStream : public TiXmlString
+{
+public :
+    TiXmlOutStream () : TiXmlString () {}
+
+    // TiXmlOutStream << operator. Maps to TiXmlString::append
+    TiXmlOutStream & operator << (const char * in)
+    {
+        append (in);
+        return (* this);
+    }
+
+    // TiXmlOutStream << operator. Maps to TiXmlString::append
+    TiXmlOutStream & operator << (const TiXmlString & in)
+    {
+        append (in . c_str ());
+        return (* this);
+    }
+} ;
+
+#endif	// TIXML_STRING_INCLUDED
+#endif	// TIXML_USE_STL
Index: NonGTP/OSceneLoader/TinyXML/tinyxmlparser.cpp
===================================================================
--- NonGTP/OSceneLoader/TinyXML/tinyxmlparser.cpp	(revision 965)
+++ NonGTP/OSceneLoader/TinyXML/tinyxmlparser.cpp	(revision 965)
@@ -0,0 +1,939 @@
+/*
+www.sourceforge.net/projects/tinyxml
+Original code (2.0 and earlier )copyright (c) 2000-2002 Lee Thomason (www.grinninglizard.com)
+
+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 "tinyxml.h"
+#include <ctype.h>
+
+//#define DEBUG_PARSER
+
+// Note tha "PutString" hardcodes the same list. This
+// is less flexible than it appears. Changing the entries
+// or order will break putstring.	
+TiXmlBase::Entity TiXmlBase::entity[ NUM_ENTITY ] = 
+{
+	{ "&amp;",  5, '&' },
+	{ "&lt;",   4, '<' },
+	{ "&gt;",   4, '>' },
+	{ "&quot;", 6, '\"' },
+	{ "&apos;", 6, '\'' }
+};
+
+
+const char* TiXmlBase::SkipWhiteSpace( const char* p )
+{
+	if ( !p || !*p )
+	{
+		return 0;
+	}
+	while ( p && *p )
+	{
+		if ( isspace( *p ) || *p == '\n' || *p =='\r' )		// Still using old rules for white space.
+			++p;
+		else
+			break;
+	}
+
+	return p;
+}
+
+#ifdef TIXML_USE_STL
+/*static*/ bool TiXmlBase::StreamWhiteSpace( TIXML_ISTREAM * in, TIXML_STRING * tag )
+{
+	for( ;; )
+	{
+		if ( !in->good() ) return false;
+
+		int c = in->peek();
+		if ( !IsWhiteSpace( c ) )
+			return true;
+		*tag += in->get();
+	}
+}
+
+/*static*/ bool TiXmlBase::StreamTo( TIXML_ISTREAM * in, int character, TIXML_STRING * tag )
+{
+	while ( in->good() )
+	{
+		int c = in->peek();
+		if ( c == character )
+			return true;
+
+		in->get();
+		*tag += c;
+	}
+	return false;
+}
+#endif
+
+const char* TiXmlBase::ReadName( const char* p, TIXML_STRING * name )
+{
+	*name = "";
+	assert( p );
+
+	// Names start with letters or underscores.
+	// After that, they can be letters, underscores, numbers,
+	// hyphens, or colons. (Colons are valid ony for namespaces,
+	// but tinyxml can't tell namespaces from names.)
+	if (    p && *p 
+		 && ( isalpha( (unsigned char) *p ) || *p == '_' ) )
+	{
+		while(		p && *p
+				&&	(		isalnum( (unsigned char ) *p ) 
+						 || *p == '_'
+						 || *p == '-'
+						 || *p == ':' ) )
+		{
+			(*name) += *p;
+			++p;
+		}
+		return p;
+	}
+	return 0;
+}
+
+const char* TiXmlBase::GetEntity( const char* p, char* value )
+{
+	// Presume an entity, and pull it out.
+    TIXML_STRING ent;
+	int i;
+
+	// Ignore the &#x entities.
+	if (    strncmp( "&#x", p, 3 ) == 0 
+	     && *(p+3) 
+		 && *(p+4) )
+	{
+		*value = 0;
+		
+		if ( isalpha( *(p+3) ) ) *value += ( tolower( *(p+3) ) - 'a' + 10 ) * 16;
+		else				     *value += ( *(p+3) - '0' ) * 16;
+
+		if ( isalpha( *(p+4) ) ) *value += ( tolower( *(p+4) ) - 'a' + 10 );
+		else				     *value += ( *(p+4) - '0' );
+
+		return p+6;
+	}
+
+	// Now try to match it.
+	for( i=0; i<NUM_ENTITY; ++i )
+	{
+		if ( strncmp( entity[i].str, p, entity[i].strLength ) == 0 )
+		{
+			assert( strlen( entity[i].str ) == entity[i].strLength );
+			*value = entity[i].chr;
+			return ( p + entity[i].strLength );
+		}
+	}
+
+	// So it wasn't an entity, its unrecognized, or something like that.
+	*value = *p;	// Don't put back the last one, since we return it!
+	return p+1;
+}
+
+
+bool TiXmlBase::StringEqual( const char* p,
+							 const char* tag,
+							 bool ignoreCase )
+{
+	assert( p );
+	if ( !p || !*p )
+	{
+		assert( 0 );
+		return false;
+	}
+
+    if ( tolower( *p ) == tolower( *tag ) )
+	{
+		const char* q = p;
+
+		if (ignoreCase)
+		{
+			while ( *q && *tag && *q == *tag )
+			{
+				++q;
+				++tag;
+			}
+
+			if ( *tag == 0 )		// Have we found the end of the tag, and everything equal?
+			{
+				return true;
+			}
+		}
+		else
+		{
+			while ( *q && *tag && tolower( *q ) == tolower( *tag ) )
+			{
+				++q;
+				++tag;
+			}
+
+			if ( *tag == 0 )
+			{
+				return true;
+			}
+		}
+	}
+	return false;
+}
+
+const char* TiXmlBase::ReadText(	const char* p, 
+									TIXML_STRING * text, 
+									bool trimWhiteSpace, 
+									const char* endTag, 
+									bool caseInsensitive )
+{
+    *text = "";
+	if (    !trimWhiteSpace			// certain tags always keep whitespace
+		 || !condenseWhiteSpace )	// if true, whitespace is always kept
+	{
+		// Keep all the white space.
+		while (	   p && *p
+				&& !StringEqual( p, endTag, caseInsensitive )
+			  )
+		{
+			char c;
+			p = GetChar( p, &c );
+            (* text) += c;
+		}
+	}
+	else
+	{
+		bool whitespace = false;
+
+		// Remove leading white space:
+		p = SkipWhiteSpace( p );
+		while (	   p && *p
+				&& !StringEqual( p, endTag, caseInsensitive ) )
+		{
+			if ( *p == '\r' || *p == '\n' )
+			{
+				whitespace = true;
+				++p;
+			}
+			else if ( isspace( *p ) )
+			{
+				whitespace = true;
+				++p;
+			}
+			else
+			{
+				// If we've found whitespace, add it before the
+				// new character. Any whitespace just becomes a space.
+				if ( whitespace )
+				{
+               (* text) += ' ';
+					whitespace = false;
+				}
+				char c;
+				p = GetChar( p, &c );
+            (* text) += c;
+			}
+		}
+	}
+	return p + strlen( endTag );
+}
+
+#ifdef TIXML_USE_STL
+
+void TiXmlDocument::StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag )
+{
+	// The basic issue with a document is that we don't know what we're
+	// streaming. Read something presumed to be a tag (and hope), then
+	// identify it, and call the appropriate stream method on the tag.
+	//
+	// This "pre-streaming" will never read the closing ">" so the
+	// sub-tag can orient itself.
+
+	if ( !StreamTo( in, '<', tag ) ) 
+	{
+		SetError( TIXML_ERROR_PARSING_EMPTY );
+		return;
+	}
+
+	while ( in->good() )
+	{
+		size_t tagIndex = tag->length();
+		while ( in->good() && in->peek() != '>' )
+		{
+			int c = in->get();
+			(*tag) += (char) c;
+		}
+
+		if ( in->good() )
+		{
+			// We now have something we presume to be a node of 
+			// some sort. Identify it, and call the node to
+			// continue streaming.
+			TiXmlNode* node = Identify( tag->c_str() + tagIndex );
+
+			if ( node )
+			{
+				node->StreamIn( in, tag );
+				bool isElement = node->ToElement() != 0;
+				delete node;
+				node = 0;
+
+				// If this is the root element, we're done. Parsing will be
+				// done by the >> operator.
+				if ( isElement )
+				{
+					return;
+				}
+			}
+			else
+			{
+				SetError( TIXML_ERROR );
+				return;
+			}
+		}
+	}
+	// We should have returned sooner.
+	SetError( TIXML_ERROR );
+}
+
+#endif
+
+const char* TiXmlDocument::Parse( const char* p )
+{
+	// Parse away, at the document level. Since a document
+	// contains nothing but other tags, most of what happens
+	// here is skipping white space.
+	//
+	// In this variant (as opposed to stream and Parse) we
+	// read everything we can.
+
+
+	if ( !p || !*p )
+	{
+		SetError( TIXML_ERROR_DOCUMENT_EMPTY );
+		return false;
+	}
+
+    p = SkipWhiteSpace( p );
+	if ( !p )
+	{
+		SetError( TIXML_ERROR_DOCUMENT_EMPTY );
+		return false;
+	}
+
+	while ( p && *p )
+	{
+		TiXmlNode* node = Identify( p );
+		if ( node )
+		{
+			p = node->Parse( p );
+			LinkEndChild( node );
+		}
+		else
+		{
+			break;
+		}
+		p = SkipWhiteSpace( p );
+	}
+	// All is well.
+	return p;
+}
+
+
+TiXmlNode* TiXmlNode::Identify( const char* p )
+{
+	TiXmlNode* returnNode = 0;
+
+	p = SkipWhiteSpace( p );
+	if( !p || !*p || *p != '<' )
+	{
+		return 0;
+	}
+
+	TiXmlDocument* doc = GetDocument();
+	p = SkipWhiteSpace( p );
+
+	if ( !p || !*p )
+	{
+		return 0;
+	}
+
+	// What is this thing? 
+	// - Elements start with a letter or underscore, but xml is reserved.
+	// - Comments: <!--
+	// - Decleration: <?xml
+	// - Everthing else is unknown to tinyxml.
+	//
+
+	const char* xmlHeader = { "<?xml" };
+	const char* commentHeader = { "<!--" };
+
+	if ( StringEqual( p, xmlHeader, true ) )
+	{
+		#ifdef DEBUG_PARSER
+			TIXML_LOG( "XML parsing Declaration\n" );
+		#endif
+		returnNode = new TiXmlDeclaration();
+	}
+	else if (    isalpha( *(p+1) )
+			  || *(p+1) == '_' )
+	{
+		#ifdef DEBUG_PARSER
+			TIXML_LOG( "XML parsing Element\n" );
+		#endif
+		returnNode = new TiXmlElement( "" );
+	}
+	else if ( StringEqual( p, commentHeader, false ) )
+	{
+		#ifdef DEBUG_PARSER
+			TIXML_LOG( "XML parsing Comment\n" );
+		#endif
+		returnNode = new TiXmlComment();
+	}
+	else
+	{
+		#ifdef DEBUG_PARSER
+			TIXML_LOG( "XML parsing Unknown\n" );
+		#endif
+		returnNode = new TiXmlUnknown();
+	}
+
+	if ( returnNode )
+	{
+		// Set the parent, so it can report errors
+		returnNode->parent = this;
+		//p = returnNode->Parse( p );
+	}
+	else
+	{
+		if ( doc )
+			doc->SetError( TIXML_ERROR_OUT_OF_MEMORY );
+	}
+	return returnNode;
+}
+
+#ifdef TIXML_USE_STL
+
+void TiXmlElement::StreamIn (TIXML_ISTREAM * in, TIXML_STRING * tag)
+{
+	// We're called with some amount of pre-parsing. That is, some of "this"
+	// element is in "tag". Go ahead and stream to the closing ">"
+	while( in->good() )
+	{
+		int c = in->get();
+		(*tag) += (char) c ;
+		
+		if ( c == '>' )
+			break;
+	}
+
+	if ( tag->length() < 3 ) return;
+
+	// Okay...if we are a "/>" tag, then we're done. We've read a complete tag.
+	// If not, identify and stream.
+
+	if (    tag->at( tag->length() - 1 ) == '>' 
+		 && tag->at( tag->length() - 2 ) == '/' )
+	{
+		// All good!
+		return;
+	}
+	else if ( tag->at( tag->length() - 1 ) == '>' )
+	{
+		// There is more. Could be:
+		//		text
+		//		closing tag
+		//		another node.
+		for ( ;; )
+		{
+			StreamWhiteSpace( in, tag );
+
+			// Do we have text?
+			if ( in->peek() != '<' )
+			{
+				// Yep, text.
+				TiXmlText text( "" );
+				text.StreamIn( in, tag );
+
+				// What follows text is a closing tag or another node.
+				// Go around again and figure it out.
+				continue;
+			}
+
+			// We now have either a closing tag...or another node.
+			// We should be at a "<", regardless.
+			if ( !in->good() ) return;
+			assert( in->peek() == '<' );
+			size_t tagIndex = tag->length();
+
+			bool closingTag = false;
+			bool firstCharFound = false;
+
+			for( ;; )
+			{
+				if ( !in->good() )
+					return;
+
+				int c = in->peek();
+				
+				if ( c == '>' )
+					break;
+
+				*tag += c;
+				in->get();
+
+				if ( !firstCharFound && c != '<' && !IsWhiteSpace( c ) )
+				{
+					firstCharFound = true;
+					if ( c == '/' )
+						closingTag = true;
+				}
+			}
+			// If it was a closing tag, then read in the closing '>' to clean up the input stream.
+			// If it was not, the streaming will be done by the tag.
+			if ( closingTag )
+			{
+				int c = in->get();
+				assert( c == '>' );
+				*tag += c;
+
+				// We are done, once we've found our closing tag.
+				return;
+			}
+			else
+			{
+				// If not a closing tag, id it, and stream.
+				const char* tagloc = tag->c_str() + tagIndex;
+				TiXmlNode* node = Identify( tagloc );
+				if ( !node )
+					return;
+				node->StreamIn( in, tag );
+				delete node;
+				node = 0;
+
+				// No return: go around from the beginning: text, closing tag, or node.
+			}
+		}
+	}
+}
+#endif
+
+const char* TiXmlElement::Parse( const char* p )
+{
+	p = SkipWhiteSpace( p );
+	TiXmlDocument* document = GetDocument();
+
+	if ( !p || !*p || *p != '<' )
+	{
+		if ( document ) document->SetError( TIXML_ERROR_PARSING_ELEMENT );
+		return false;
+	}
+
+	p = SkipWhiteSpace( p+1 );
+
+	// Read the name.
+    p = ReadName( p, &value );
+	if ( !p || !*p )
+	{
+		if ( document )	document->SetError( TIXML_ERROR_FAILED_TO_READ_ELEMENT_NAME );
+		return false;
+	}
+
+    TIXML_STRING endTag ("</");
+	endTag += value;
+	endTag += ">";
+
+	// Check for and read attributes. Also look for an empty
+	// tag or an end tag.
+	while ( p && *p )
+	{
+		p = SkipWhiteSpace( p );
+		if ( !p || !*p )
+		{
+			if ( document ) document->SetError( TIXML_ERROR_READING_ATTRIBUTES );
+			return 0;
+		}
+		if ( *p == '/' )
+		{
+			++p;
+			// Empty tag.
+			if ( *p  != '>' )
+			{
+				if ( document ) document->SetError( TIXML_ERROR_PARSING_EMPTY );		
+				return 0;
+			}
+			return (p+1);
+		}
+		else if ( *p == '>' )
+		{
+			// Done with attributes (if there were any.)
+			// Read the value -- which can include other
+			// elements -- read the end tag, and return.
+			++p;
+			p = ReadValue( p );		// Note this is an Element method, and will set the error if one happens.
+			if ( !p || !*p )
+				return 0;
+
+			// We should find the end tag now
+			if ( StringEqual( p, endTag.c_str(), false ) )
+			{
+				p += endTag.length();
+				return p;
+			}
+			else
+			{
+				if ( document ) document->SetError( TIXML_ERROR_READING_END_TAG );
+				return 0;
+			}
+		}
+		else
+		{
+			// Try to read an element:
+			TiXmlAttribute attrib;
+			attrib.SetDocument( document );
+			p = attrib.Parse( p );
+
+			if ( !p || !*p )
+			{
+				if ( document ) document->SetError( TIXML_ERROR_PARSING_ELEMENT );
+				return 0;
+			}
+			SetAttribute( attrib.Name(), attrib.Value() );
+		}
+	}
+	return p;
+}
+
+
+const char* TiXmlElement::ReadValue( const char* p )
+{
+	TiXmlDocument* document = GetDocument();
+
+	// Read in text and elements in any order.
+	p = SkipWhiteSpace( p );
+	while ( p && *p )
+	{
+		if ( *p != '<' )
+		{
+			// Take what we have, make a text element.
+			TiXmlText* textNode = new TiXmlText( "" );
+
+			if ( !textNode )
+			{
+				if ( document ) document->SetError( TIXML_ERROR_OUT_OF_MEMORY );
+				    return 0;
+			}
+
+			p = textNode->Parse( p );
+
+			if ( !textNode->Blank() )
+				LinkEndChild( textNode );
+			else
+				delete textNode;
+		} 
+		else 
+		{
+			// We hit a '<'
+			// Have we hit a new element or an end tag?
+			if ( StringEqual( p, "</", false ) )
+			{
+				return p;
+			}
+			else
+			{
+				TiXmlNode* node = Identify( p );
+				if ( node )
+				{
+					p = node->Parse( p );
+					LinkEndChild( node );
+				}				
+				else
+				{
+					return 0;
+				}
+			}
+		}
+		p = SkipWhiteSpace( p );
+	}
+
+	if ( !p )
+	{
+		if ( document ) document->SetError( TIXML_ERROR_READING_ELEMENT_VALUE );
+	}	
+	return p;
+}
+
+
+#ifdef TIXML_USE_STL
+void TiXmlUnknown::StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag )
+{
+	while ( in->good() )
+	{
+		int c = in->get();	
+		(*tag) += c;
+
+		if ( c == '>' )
+		{
+			// All is well.
+			return;		
+		}
+	}
+}
+#endif
+
+
+const char* TiXmlUnknown::Parse( const char* p )
+{
+	TiXmlDocument* document = GetDocument();
+	p = SkipWhiteSpace( p );
+	if ( !p || !*p || *p != '<' )
+	{
+		if ( document ) document->SetError( TIXML_ERROR_PARSING_UNKNOWN );
+		return 0;
+	}
+	++p;
+    value = "";
+
+	while ( p && *p && *p != '>' )
+	{
+		value += *p;
+		++p;
+	}
+
+	if ( !p )
+	{
+		if ( document )	document->SetError( TIXML_ERROR_PARSING_UNKNOWN );
+	}
+	if ( *p == '>' )
+		return p+1;
+	return p;
+}
+
+#ifdef TIXML_USE_STL
+void TiXmlComment::StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag )
+{
+	while ( in->good() )
+	{
+		int c = in->get();	
+		(*tag) += c;
+
+		if ( c == '>' 
+			 && tag->at( tag->length() - 2 ) == '-'
+			 && tag->at( tag->length() - 3 ) == '-' )
+		{
+			// All is well.
+			return;		
+		}
+	}
+}
+#endif
+
+
+const char* TiXmlComment::Parse( const char* p )
+{
+	TiXmlDocument* document = GetDocument();
+	value = "";
+
+	p = SkipWhiteSpace( p );
+	const char* startTag = "<!--";
+	const char* endTag   = "-->";
+
+	if ( !StringEqual( p, startTag, false ) )
+	{
+		document->SetError( TIXML_ERROR_PARSING_COMMENT );
+		return 0;
+	}
+	p += strlen( startTag );
+	p = ReadText( p, &value, false, endTag, false );
+	return p;
+}
+
+
+const char* TiXmlAttribute::Parse( const char* p )
+{
+	p = SkipWhiteSpace( p );
+	if ( !p || !*p ) return 0;
+
+	// Read the name, the '=' and the value.
+	p = ReadName( p, &name );
+	if ( !p || !*p )
+	{
+		if ( document ) document->SetError( TIXML_ERROR_READING_ATTRIBUTES );
+		return 0;
+	}
+	p = SkipWhiteSpace( p );
+	if ( !p || !*p || *p != '=' )
+	{
+		if ( document ) document->SetError( TIXML_ERROR_READING_ATTRIBUTES );
+		return 0;
+	}
+
+	++p;	// skip '='
+	p = SkipWhiteSpace( p );
+	if ( !p || !*p )
+	{
+		if ( document ) document->SetError( TIXML_ERROR_READING_ATTRIBUTES );
+		return 0;
+	}
+	
+	const char* end;
+
+	if ( *p == '\'' )
+	{
+		++p;
+		end = "\'";
+		p = ReadText( p, &value, false, end, false );
+	}
+	else if ( *p == '"' )
+	{
+		++p;
+		end = "\"";
+		p = ReadText( p, &value, false, end, false );
+	}
+	else
+	{
+		// All attribute values should be in single or double quotes.
+		// But this is such a common error that the parser will try
+		// its best, even without them.
+		value = "";
+		while (    p && *p										// existence
+				&& !isspace( *p ) && *p != '\n' && *p != '\r'	// whitespace
+				&& *p != '/' && *p != '>' )						// tag end
+		{
+			value += *p;
+			++p;
+		}
+	}
+	return p;
+}
+
+#ifdef TIXML_USE_STL
+void TiXmlText::StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag )
+{
+	while ( in->good() )
+	{
+		int c = in->peek();	
+		if ( c == '<' )
+			return;
+
+		(*tag) += c;
+		in->get();
+	}
+}
+#endif
+
+const char* TiXmlText::Parse( const char* p )
+{
+	value = "";
+
+	//TiXmlDocument* doc = GetDocument();
+	bool ignoreWhite = true;
+//	if ( doc && !doc->IgnoreWhiteSpace() ) ignoreWhite = false;
+
+	const char* end = "<";
+	p = ReadText( p, &value, ignoreWhite, end, false );
+	if ( p )
+		return p-1;	// don't truncate the '<'
+	return 0;
+}
+
+#ifdef TIXML_USE_STL
+void TiXmlDeclaration::StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag )
+{
+	while ( in->good() )
+	{
+		int c = in->get();
+		(*tag) += c;
+
+		if ( c == '>' )
+		{
+			// All is well.
+			return;
+		}
+	}
+}
+#endif
+
+const char* TiXmlDeclaration::Parse( const char* p )
+{
+	p = SkipWhiteSpace( p );
+	// Find the beginning, find the end, and look for
+	// the stuff in-between.
+	TiXmlDocument* document = GetDocument();
+	if ( !p || !*p || !StringEqual( p, "<?xml", true ) )
+	{
+		if ( document ) document->SetError( TIXML_ERROR_PARSING_DECLARATION );
+		return 0;
+	}
+
+	p += 5;
+//	const char* start = p+5;
+//	const char* end  = strstr( start, "?>" );
+
+	version = "";
+	encoding = "";
+	standalone = "";
+
+	while ( p && *p )
+	{
+		if ( *p == '>' )
+		{
+			++p;
+			return p;
+		}
+
+		p = SkipWhiteSpace( p );
+		if ( StringEqual( p, "version", true ) )
+		{
+//			p += 7;
+			TiXmlAttribute attrib;
+			p = attrib.Parse( p );		
+			version = attrib.Value();
+		}
+		else if ( StringEqual( p, "encoding", true ) )
+		{
+//			p += 8;
+			TiXmlAttribute attrib;
+			p = attrib.Parse( p );		
+			encoding = attrib.Value();
+		}
+		else if ( StringEqual( p, "standalone", true ) )
+		{
+//			p += 10;
+			TiXmlAttribute attrib;
+			p = attrib.Parse( p );		
+			standalone = attrib.Value();
+		}
+		else
+		{
+			// Read over whatever it is.
+			while( p && *p && *p != '>' && !isspace( *p ) )
+				++p;
+		}
+	}
+	return 0;
+}
+
+bool TiXmlText::Blank() const
+{
+	for ( unsigned i=0; i<value.length(); i++ )
+		if ( !isspace( value[i] ) )
+			return false;
+	return true;
+}
+
Index: NonGTP/OSceneLoader/TinyXML/tinyxml.cpp
===================================================================
--- NonGTP/OSceneLoader/TinyXML/tinyxml.cpp	(revision 965)
+++ NonGTP/OSceneLoader/TinyXML/tinyxml.cpp	(revision 965)
@@ -0,0 +1,1108 @@
+/*
+www.sourceforge.net/projects/tinyxml
+Original code (2.0 and earlier )copyright (c) 2000-2002 Lee Thomason (www.grinninglizard.com)
+
+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 <ctype.h>
+#include "tinyxml.h"
+
+bool TiXmlBase::condenseWhiteSpace = true;
+
+void TiXmlBase::PutString( const TIXML_STRING& str, TIXML_OSTREAM* stream )
+{
+	TIXML_STRING buffer;
+	PutString( str, &buffer );
+	(*stream) << buffer;
+}
+
+void TiXmlBase::PutString( const TIXML_STRING& str, TIXML_STRING* outString )
+{
+	int i=0;
+
+	while( i<(int)str.length() )
+	{
+		int c = str[i];
+
+		if (    c == '&' 
+		     && i < ( (int)str.length() - 2 )
+			 && str[i+1] == '#'
+			 && str[i+2] == 'x' )
+		{
+			// Hexadecimal character reference.
+			// Pass through unchanged.
+			// &#xA9;	-- copyright symbol, for example.
+			while ( i<(int)str.length() )
+			{
+				outString->append( str.c_str() + i, 1 );
+				++i;
+				if ( str[i] == ';' )
+					break;
+			}
+		}
+		else if ( c == '&' )
+		{
+			outString->append( entity[0].str, entity[0].strLength );
+			++i;
+		}
+		else if ( c == '<' )
+		{
+			outString->append( entity[1].str, entity[1].strLength );
+			++i;
+		}
+		else if ( c == '>' )
+		{
+			outString->append( entity[2].str, entity[2].strLength );
+			++i;
+		}
+		else if ( c == '\"' )
+		{
+			outString->append( entity[3].str, entity[3].strLength );
+			++i;
+		}
+		else if ( c == '\'' )
+		{
+			outString->append( entity[4].str, entity[4].strLength );
+			++i;
+		}
+		else if ( c < 32 || c > 126 )
+		{
+			// Easy pass at non-alpha/numeric/symbol
+			// 127 is the delete key. Below 32 is symbolic.
+			char buf[ 32 ];
+			sprintf( buf, "&#x%02X;", (unsigned) ( c & 0xff ) );
+			outString->append( buf, strlen( buf ) );
+			++i;
+		}
+		else
+		{
+			char realc = (char) c;
+			outString->append( &realc, 1 );
+			++i;
+		}
+	}
+}
+
+
+TiXmlNode::TiXmlNode( NodeType _type )
+{
+	parent = 0;
+	type = _type;
+	firstChild = 0;
+	lastChild = 0;
+	prev = 0;
+	next = 0;
+	userData = 0;
+}
+
+
+TiXmlNode::~TiXmlNode()
+{
+	TiXmlNode* node = firstChild;
+	TiXmlNode* temp = 0;
+
+	while ( node )
+	{
+		temp = node;
+		node = node->next;
+		delete temp;
+	}	
+}
+
+
+void TiXmlNode::Clear()
+{
+	TiXmlNode* node = firstChild;
+	TiXmlNode* temp = 0;
+
+	while ( node )
+	{
+		temp = node;
+		node = node->next;
+		delete temp;
+	}	
+
+	firstChild = 0;
+	lastChild = 0;
+}
+
+
+TiXmlNode* TiXmlNode::LinkEndChild( TiXmlNode* node )
+{
+	node->parent = this;
+
+	node->prev = lastChild;
+	node->next = 0;
+
+	if ( lastChild )
+		lastChild->next = node;
+	else
+		firstChild = node;			// it was an empty list.
+
+	lastChild = node;
+	return node;
+}
+
+
+TiXmlNode* TiXmlNode::InsertEndChild( const TiXmlNode& addThis )
+{
+	TiXmlNode* node = addThis.Clone();
+	if ( !node )
+		return 0;
+
+	return LinkEndChild( node );
+}
+
+
+TiXmlNode* TiXmlNode::InsertBeforeChild( TiXmlNode* beforeThis, const TiXmlNode& addThis )
+{	
+	if ( !beforeThis || beforeThis->parent != this )
+		return 0;
+
+	TiXmlNode* node = addThis.Clone();
+	if ( !node )
+		return 0;
+	node->parent = this;
+
+	node->next = beforeThis;
+	node->prev = beforeThis->prev;
+	if ( beforeThis->prev )
+	{
+		beforeThis->prev->next = node;
+	}
+	else
+	{
+		assert( firstChild == beforeThis );
+		firstChild = node;
+	}
+	beforeThis->prev = node;
+	return node;
+}
+
+
+TiXmlNode* TiXmlNode::InsertAfterChild( TiXmlNode* afterThis, const TiXmlNode& addThis )
+{
+	if ( !afterThis || afterThis->parent != this )
+		return 0;
+
+	TiXmlNode* node = addThis.Clone();
+	if ( !node )
+		return 0;
+	node->parent = this;
+
+	node->prev = afterThis;
+	node->next = afterThis->next;
+	if ( afterThis->next )
+	{
+		afterThis->next->prev = node;
+	}
+	else
+	{
+		assert( lastChild == afterThis );
+		lastChild = node;
+	}
+	afterThis->next = node;
+	return node;
+}
+
+
+TiXmlNode* TiXmlNode::ReplaceChild( TiXmlNode* replaceThis, const TiXmlNode& withThis )
+{
+	if ( replaceThis->parent != this )
+		return 0;
+
+	TiXmlNode* node = withThis.Clone();
+	if ( !node )
+		return 0;
+
+	node->next = replaceThis->next;
+	node->prev = replaceThis->prev;
+
+	if ( replaceThis->next )
+		replaceThis->next->prev = node;
+	else
+		lastChild = node;
+
+	if ( replaceThis->prev )
+		replaceThis->prev->next = node;
+	else
+		firstChild = node;
+
+	delete replaceThis;
+	node->parent = this;
+	return node;
+}
+
+
+bool TiXmlNode::RemoveChild( TiXmlNode* removeThis )
+{
+	if ( removeThis->parent != this )
+	{	
+		assert( 0 );
+		return false;
+	}
+
+	if ( removeThis->next )
+		removeThis->next->prev = removeThis->prev;
+	else
+		lastChild = removeThis->prev;
+
+	if ( removeThis->prev )
+		removeThis->prev->next = removeThis->next;
+	else
+		firstChild = removeThis->next;
+
+	delete removeThis;
+	return true;
+}
+
+TiXmlNode* TiXmlNode::FirstChild( const char * value ) const
+{
+	TiXmlNode* node;
+	for ( node = firstChild; node; node = node->next )
+	{
+		if ( node->SValue() == TIXML_STRING( value ))
+			return node;
+	}
+	return 0;
+}
+
+TiXmlNode* TiXmlNode::LastChild( const char * value ) const
+{
+	TiXmlNode* node;
+	for ( node = lastChild; node; node = node->prev )
+	{
+		if ( node->SValue() == TIXML_STRING (value))
+			return node;
+	}
+	return 0;
+}
+
+TiXmlNode* TiXmlNode::IterateChildren( TiXmlNode* previous ) const
+{
+	if ( !previous )
+	{
+		return FirstChild();
+	}
+	else
+	{
+		assert( previous->parent == this );
+		return previous->NextSibling();
+	}
+}
+
+TiXmlNode* TiXmlNode::IterateChildren( const char * val, TiXmlNode* previous ) const
+{
+	if ( !previous )
+	{
+		return FirstChild( val );
+	}
+	else
+	{
+		assert( previous->parent == this );
+		return previous->NextSibling( val );
+	}
+}
+
+TiXmlNode* TiXmlNode::NextSibling( const char * value ) const
+{
+	TiXmlNode* node;
+	for ( node = next; node; node = node->next )
+	{
+		if ( node->SValue() == TIXML_STRING (value))
+			return node;
+	}
+	return 0;
+}
+
+
+TiXmlNode* TiXmlNode::PreviousSibling( const char * value ) const
+{
+	TiXmlNode* node;
+	for ( node = prev; node; node = node->prev )
+	{
+		if ( node->SValue() == TIXML_STRING (value))
+			return node;
+	}
+	return 0;
+}
+
+void TiXmlElement::RemoveAttribute( const char * name )
+{
+	TiXmlAttribute* node = attributeSet.Find( name );
+	if ( node )
+	{
+		attributeSet.Remove( node );
+		delete node;
+	}
+}
+
+TiXmlElement* TiXmlNode::FirstChildElement() const
+{
+	TiXmlNode* node;
+
+	for (	node = FirstChild();
+	node;
+	node = node->NextSibling() )
+	{
+		if ( node->ToElement() )
+			return node->ToElement();
+	}
+	return 0;
+}
+
+TiXmlElement* TiXmlNode::FirstChildElement( const char * value ) const
+{
+	TiXmlNode* node;
+
+	for (	node = FirstChild( value );
+	node;
+	node = node->NextSibling( value ) )
+	{
+		if ( node->ToElement() )
+			return node->ToElement();
+	}
+	return 0;
+}
+
+
+TiXmlElement* TiXmlNode::NextSiblingElement() const
+{
+	TiXmlNode* node;
+
+	for (	node = NextSibling();
+	node;
+	node = node->NextSibling() )
+	{
+		if ( node->ToElement() )
+			return node->ToElement();
+	}
+	return 0;
+}
+
+TiXmlElement* TiXmlNode::NextSiblingElement( const char * value ) const
+{
+	TiXmlNode* node;
+
+	for (	node = NextSibling( value );
+	node;
+	node = node->NextSibling( value ) )
+	{
+		if ( node->ToElement() )
+			return node->ToElement();
+	}
+	return 0;
+}
+
+
+
+TiXmlDocument* TiXmlNode::GetDocument() const
+{
+	const TiXmlNode* node;
+
+	for( node = this; node; node = node->parent )
+	{
+		if ( node->ToDocument() )
+			return node->ToDocument();
+	}
+	return 0;
+}
+
+
+TiXmlElement::TiXmlElement (const char * _value)
+: TiXmlNode( TiXmlNode::ELEMENT )
+{
+	firstChild = lastChild = 0;
+	value = _value;
+}
+
+TiXmlElement::~TiXmlElement()
+{
+	while( attributeSet.First() )
+	{
+		TiXmlAttribute* node = attributeSet.First();
+		attributeSet.Remove( node );
+		delete node;
+	}
+}
+
+// BEGIN OGRE CHANGES
+// USE STL ALONE
+#ifndef TIXML_USE_STL
+const char * TiXmlElement::Attribute( const char * name ) const
+{
+	TiXmlAttribute* node = attributeSet.Find( name );
+
+	if ( node )
+		return node->Value();
+
+	return 0;
+}
+
+
+const char * TiXmlElement::Attribute( const char * name, int* i ) const
+{
+	const char * s = Attribute( name );
+	if ( i )
+	{
+		if ( s )
+			*i = atoi( s );
+		else
+			*i = 0;
+	}
+	return s;
+}
+
+
+void TiXmlElement::SetAttribute( const char * name, int val )
+{	
+	char buf[64];
+	sprintf( buf, "%d", val );
+	SetAttribute( name, buf );
+}
+
+
+void TiXmlElement::SetAttribute( const char * name, const char * value )
+{
+	TiXmlAttribute* node = attributeSet.Find( name );
+	if ( node )
+	{
+		node->SetValue( value );
+		return;
+	}
+
+	TiXmlAttribute* attrib = new TiXmlAttribute( name, value );
+	if ( attrib )
+	{
+		attributeSet.Add( attrib );
+	}
+	else
+	{
+		TiXmlDocument* document = GetDocument();
+		if ( document ) document->SetError( TIXML_ERROR_OUT_OF_MEMORY );
+	}
+}
+
+#endif
+
+#ifdef TIXML_USE_STL
+
+const char * TiXmlElement::Attribute( const std::string& name ) const
+{
+	TiXmlAttribute* node = attributeSet.Find( name.c_str() );
+
+	if ( node )
+		return node->Value();
+
+	return 0;
+}
+
+
+const char * TiXmlElement::Attribute( const std::string& name, int* i ) const
+{
+	const char * s = Attribute( name );
+	if ( i )
+	{
+		if ( s )
+			*i = atoi( s );
+		else
+			*i = 0;
+	}
+	return s;
+}
+
+
+void TiXmlElement::SetAttribute( const std::string& name, int val )
+{	
+	char buf[64];
+	sprintf( buf, "%d", val );
+	SetAttribute( name, buf );
+}
+
+
+void TiXmlElement::SetAttribute( const std::string& name, const std::string& value )
+{
+	TiXmlAttribute* node = attributeSet.Find( name.c_str() );
+	if ( node )
+	{
+		node->SetValue( value );
+		return;
+	}
+
+	TiXmlAttribute* attrib = new TiXmlAttribute( name, value );
+	if ( attrib )
+	{
+		attributeSet.Add( attrib );
+	}
+	else
+	{
+		TiXmlDocument* document = GetDocument();
+		if ( document ) document->SetError( TIXML_ERROR_OUT_OF_MEMORY );
+	}
+}
+
+#endif
+// END OGRE CHANGES
+void TiXmlElement::Print( FILE* cfile, int depth ) const
+{
+	int i;
+	for ( i=0; i<depth; i++ )
+	{
+		fprintf( cfile, "    " );
+	}
+
+	fprintf( cfile, "<%s", value.c_str() );
+
+	TiXmlAttribute* attrib;
+	for ( attrib = attributeSet.First(); attrib; attrib = attrib->Next() )
+	{
+		fprintf( cfile, " " );
+		attrib->Print( cfile, depth );
+	}
+
+	// There are 3 different formatting approaches:
+	// 1) An element without children is printed as a <foo /> node
+	// 2) An element with only a text child is printed as <foo> text </foo>
+	// 3) An element with children is printed on multiple lines.
+	TiXmlNode* node;
+	if ( !firstChild )
+	{
+		fprintf( cfile, " />" );
+	}
+	else if ( firstChild == lastChild && firstChild->ToText() )
+	{
+		fprintf( cfile, ">" );
+		firstChild->Print( cfile, depth + 1 );
+		fprintf( cfile, "</%s>", value.c_str() );
+	}
+	else
+	{
+		fprintf( cfile, ">" );
+
+		for ( node = firstChild; node; node=node->NextSibling() )
+		{
+			if ( !node->ToText() )
+			{
+				fprintf( cfile, "\n" );
+			}
+			node->Print( cfile, depth+1 );
+		}
+		fprintf( cfile, "\n" );
+		for( i=0; i<depth; ++i )
+		fprintf( cfile, "    " );
+		fprintf( cfile, "</%s>", value.c_str() );
+	}
+}
+
+void TiXmlElement::StreamOut( TIXML_OSTREAM * stream ) const
+{
+	(*stream) << "<" << value;
+
+	TiXmlAttribute* attrib;
+	for ( attrib = attributeSet.First(); attrib; attrib = attrib->Next() )
+	{	
+		(*stream) << " ";
+		attrib->StreamOut( stream );
+	}
+
+	// If this node has children, give it a closing tag. Else
+	// make it an empty tag.
+	TiXmlNode* node;
+	if ( firstChild )
+	{ 		
+		(*stream) << ">";
+
+		for ( node = firstChild; node; node=node->NextSibling() )
+		{
+			node->StreamOut( stream );
+		}
+		(*stream) << "</" << value << ">";
+	}
+	else
+	{
+		(*stream) << " />";
+	}
+}
+
+TiXmlNode* TiXmlElement::Clone() const
+{
+	TiXmlElement* clone = new TiXmlElement( Value() );
+	if ( !clone )
+		return 0;
+
+	CopyToClone( clone );
+
+	// Clone the attributes, then clone the children.
+	TiXmlAttribute* attribute = 0;
+	for(	attribute = attributeSet.First();
+	attribute;
+	attribute = attribute->Next() )
+	{
+		clone->SetAttribute( attribute->Name(), attribute->Value() );
+	}
+
+	TiXmlNode* node = 0;
+	for ( node = firstChild; node; node = node->NextSibling() )
+	{
+		clone->LinkEndChild( node->Clone() );
+	}
+	return clone;
+}
+
+
+TiXmlDocument::TiXmlDocument() : TiXmlNode( TiXmlNode::DOCUMENT )
+{
+	error = false;
+	//	ignoreWhiteSpace = true;
+}
+
+TiXmlDocument::TiXmlDocument( const char * documentName ) : TiXmlNode( TiXmlNode::DOCUMENT )
+{
+	//	ignoreWhiteSpace = true;
+	value = documentName;
+	error = false;
+}
+
+bool TiXmlDocument::LoadFile()
+{
+	if ( LoadFile( value.c_str() ) )
+		return true;
+
+	return false;
+}
+
+
+bool TiXmlDocument::SaveFile() const
+{
+	if ( SaveFile( value.c_str() ) )
+		return true;
+
+	return false;
+}
+
+bool TiXmlDocument::LoadFile( const char* filename )
+{
+	// Delete the existing data:
+	Clear();
+
+	// There was a really terrifying little bug here. The code:
+	//		value = filename
+	// in the STL case, cause the assignment method of the std::string to
+	// be called. What is strange, is that the std::string had the same
+	// address as it's c_str() method, and so bad things happen. Looks
+	// like a bug in the Microsoft STL implementation.
+	// See STL_STRING_BUG above.
+	// Fixed with the StringToBuffer class.
+	value = filename;
+
+	FILE* file = fopen( value.c_str (), "r" );
+
+	if ( file )
+	{
+		// Get the file size, so we can pre-allocate the string. HUGE speed impact.
+		long length = 0;
+		fseek( file, 0, SEEK_END );
+		length = ftell( file );
+		fseek( file, 0, SEEK_SET );
+
+		// Strange case, but good to handle up front.
+		if ( length == 0 )
+		{
+			fclose( file );
+			return false;
+		}
+
+		// If we have a file, assume it is all one big XML file, and read it in.
+		// The document parser may decide the document ends sooner than the entire file, however.
+		TIXML_STRING data;
+		data.reserve( length );
+
+		const int BUF_SIZE = 2048;
+		char buf[BUF_SIZE];
+
+		while( fgets( buf, BUF_SIZE, file ) )
+		{
+			data += buf;
+		}
+		fclose( file );
+
+		Parse( data.c_str() );
+		if (  !Error() )
+		{
+			return true;
+		}
+	}
+	SetError( TIXML_ERROR_OPENING_FILE );
+	return false;
+}
+
+bool TiXmlDocument::SaveFile( const char * filename ) const
+{
+	// The old c stuff lives on...
+	FILE* fp = fopen( filename, "w" );
+	if ( fp )
+	{
+		Print( fp, 0 );
+		fclose( fp );
+		return true;
+	}
+	return false;
+}
+
+
+TiXmlNode* TiXmlDocument::Clone() const
+{
+	TiXmlDocument* clone = new TiXmlDocument();
+	if ( !clone )
+		return 0;
+
+	CopyToClone( clone );
+	clone->error = error;
+	clone->errorDesc = errorDesc.c_str ();
+
+	TiXmlNode* node = 0;
+	for ( node = firstChild; node; node = node->NextSibling() )
+	{
+		clone->LinkEndChild( node->Clone() );
+	}
+	return clone;
+}
+
+
+void TiXmlDocument::Print( FILE* cfile, int depth ) const
+{
+	TiXmlNode* node;
+	for ( node=FirstChild(); node; node=node->NextSibling() )
+	{
+		node->Print( cfile, depth );
+		fprintf( cfile, "\n" );
+	}
+}
+
+void TiXmlDocument::StreamOut( TIXML_OSTREAM * out ) const
+{
+	TiXmlNode* node;
+	for ( node=FirstChild(); node; node=node->NextSibling() )
+	{
+		node->StreamOut( out );
+
+		// Special rule for streams: stop after the root element.
+		// The stream in code will only read one element, so don't
+		// write more than one.
+		if ( node->ToElement() )
+			break;
+	}
+}
+
+TiXmlAttribute* TiXmlAttribute::Next() const
+{
+	// We are using knowledge of the sentinel. The sentinel
+	// have a value or name.
+	if ( next->value.empty() && next->name.empty() )
+		return 0;
+	return next;
+}
+
+
+TiXmlAttribute* TiXmlAttribute::Previous() const
+{
+	// We are using knowledge of the sentinel. The sentinel
+	// have a value or name.
+	if ( prev->value.empty() && prev->name.empty() )
+		return 0;
+	return prev;
+}
+
+
+void TiXmlAttribute::Print( FILE* cfile, int /*depth*/ ) const
+{
+	TIXML_STRING n, v;
+
+	PutString( Name(), &n );
+	PutString( Value(), &v );
+
+	if (value.find ('\"') == TIXML_STRING::npos)
+		fprintf (cfile, "%s=\"%s\"", n.c_str(), v.c_str() );
+	else
+		fprintf (cfile, "%s='%s'", n.c_str(), v.c_str() );
+}
+
+
+void TiXmlAttribute::StreamOut( TIXML_OSTREAM * stream ) const
+{
+	if (value.find( '\"' ) != TIXML_STRING::npos)
+	{
+		PutString( name, stream );
+		(*stream) << "=" << "'";
+		PutString( value, stream );
+		(*stream) << "'";
+	}
+	else
+	{
+		PutString( name, stream );
+		(*stream) << "=" << "\"";
+		PutString( value, stream );
+		(*stream) << "\"";
+	}
+}
+
+void TiXmlAttribute::SetIntValue( int value )
+{
+	char buf [64];
+	sprintf (buf, "%d", value);
+	SetValue (buf);
+}
+
+void TiXmlAttribute::SetDoubleValue( double value )
+{
+	char buf [64];
+	sprintf (buf, "%lf", value);
+	SetValue (buf);
+}
+
+const int TiXmlAttribute::IntValue() const
+{
+	return atoi (value.c_str ());
+}
+
+const double  TiXmlAttribute::DoubleValue() const
+{
+	return atof (value.c_str ());
+}
+
+void TiXmlComment::Print( FILE* cfile, int depth ) const
+{
+	for ( int i=0; i<depth; i++ )
+	{
+		fputs( "    ", cfile );
+	}
+	fprintf( cfile, "<!--%s-->", value.c_str() );
+}
+
+void TiXmlComment::StreamOut( TIXML_OSTREAM * stream ) const
+{
+	(*stream) << "<!--";
+	PutString( value, stream );
+	(*stream) << "-->";
+}
+
+TiXmlNode* TiXmlComment::Clone() const
+{
+	TiXmlComment* clone = new TiXmlComment();
+
+	if ( !clone )
+		return 0;
+
+	CopyToClone( clone );
+	return clone;
+}
+
+
+void TiXmlText::Print( FILE* cfile, int /*depth*/ ) const
+{
+	TIXML_STRING buffer;
+	PutString( value, &buffer );
+	fprintf( cfile, "%s", buffer.c_str() );
+}
+
+
+void TiXmlText::StreamOut( TIXML_OSTREAM * stream ) const
+{
+	PutString( value, stream );
+}
+
+
+TiXmlNode* TiXmlText::Clone() const
+{	
+	TiXmlText* clone = 0;
+	clone = new TiXmlText( "" );
+
+	if ( !clone )
+		return 0;
+
+	CopyToClone( clone );
+	return clone;
+}
+
+
+TiXmlDeclaration::TiXmlDeclaration( const char * _version,
+	const char * _encoding,
+	const char * _standalone )
+: TiXmlNode( TiXmlNode::DECLARATION )
+{
+	version = _version;
+	encoding = _encoding;
+	standalone = _standalone;
+}
+
+
+void TiXmlDeclaration::Print( FILE* cfile, int /*depth*/ ) const
+{
+	fprintf (cfile, "<?xml ");
+
+	if ( !version.empty() )
+		fprintf (cfile, "version=\"%s\" ", version.c_str ());
+	if ( !encoding.empty() )
+		fprintf (cfile, "encoding=\"%s\" ", encoding.c_str ());
+	if ( !standalone.empty() )
+		fprintf (cfile, "standalone=\"%s\" ", standalone.c_str ());
+	fprintf (cfile, "?>");
+}
+
+void TiXmlDeclaration::StreamOut( TIXML_OSTREAM * stream ) const
+{
+	(*stream) << "<?xml ";
+
+	if ( !version.empty() )
+	{
+		(*stream) << "version=\"";
+		PutString( version, stream );
+		(*stream) << "\" ";
+	}
+	if ( !encoding.empty() )
+	{
+		(*stream) << "encoding=\"";
+		PutString( encoding, stream );
+		(*stream ) << "\" ";
+	}
+	if ( !standalone.empty() )
+	{
+		(*stream) << "standalone=\"";
+		PutString( standalone, stream );
+		(*stream) << "\" ";
+	}
+	(*stream) << "?>";
+}
+
+TiXmlNode* TiXmlDeclaration::Clone() const
+{	
+	TiXmlDeclaration* clone = new TiXmlDeclaration();
+
+	if ( !clone )
+		return 0;
+
+	CopyToClone( clone );
+	clone->version = version;
+	clone->encoding = encoding;
+	clone->standalone = standalone;
+	return clone;
+}
+
+
+void TiXmlUnknown::Print( FILE* cfile, int depth ) const
+{
+	for ( int i=0; i<depth; i++ )
+		fprintf( cfile, "    " );
+	fprintf( cfile, "%s", value.c_str() );
+}
+
+void TiXmlUnknown::StreamOut( TIXML_OSTREAM * stream ) const
+{
+	(*stream) << "<" << value << ">";		// Don't use entities hear! It is unknown.
+}
+
+TiXmlNode* TiXmlUnknown::Clone() const
+{
+	TiXmlUnknown* clone = new TiXmlUnknown();
+
+	if ( !clone )
+		return 0;
+
+	CopyToClone( clone );
+	return clone;
+}
+
+
+TiXmlAttributeSet::TiXmlAttributeSet()
+{
+	sentinel.next = &sentinel;
+	sentinel.prev = &sentinel;
+}
+
+
+TiXmlAttributeSet::~TiXmlAttributeSet()
+{
+	assert( sentinel.next == &sentinel );
+	assert( sentinel.prev == &sentinel );
+}
+
+
+void TiXmlAttributeSet::Add( TiXmlAttribute* addMe )
+{
+	assert( !Find( addMe->Name() ) );	// Shouldn't be multiply adding to the set.
+
+	addMe->next = &sentinel;
+	addMe->prev = sentinel.prev;
+
+	sentinel.prev->next = addMe;
+	sentinel.prev      = addMe;
+}
+
+void TiXmlAttributeSet::Remove( TiXmlAttribute* removeMe )
+{
+	TiXmlAttribute* node;
+
+	for( node = sentinel.next; node != &sentinel; node = node->next )
+	{
+		if ( node == removeMe )
+		{
+			node->prev->next = node->next;
+			node->next->prev = node->prev;
+			node->next = 0;
+			node->prev = 0;
+			return;
+		}
+	}
+	assert( 0 );		// we tried to remove a non-linked attribute.
+}
+
+TiXmlAttribute*	TiXmlAttributeSet::Find( const char * name ) const
+{
+	TiXmlAttribute* node;
+
+	for( node = sentinel.next; node != &sentinel; node = node->next )
+	{
+		if ( node->name == name )
+			return node;
+	}
+	return 0;
+}
+
+
+#ifdef TIXML_USE_STL	
+TIXML_ISTREAM & operator >> (TIXML_ISTREAM & in, TiXmlNode & base)
+{
+	TIXML_STRING tag;
+	tag.reserve( 8 * 1000 );
+	base.StreamIn( &in, &tag );
+
+	base.Parse( tag.c_str() );
+	return in;
+}
+#endif
+
+
+TIXML_OSTREAM & operator<< (TIXML_OSTREAM & out, const TiXmlNode & base)
+{
+	base.StreamOut (& out);
+	return out;
+}
+
Index: NonGTP/OSceneLoader/TinyXML/tinyxml.h
===================================================================
--- NonGTP/OSceneLoader/TinyXML/tinyxml.h	(revision 965)
+++ NonGTP/OSceneLoader/TinyXML/tinyxml.h	(revision 965)
@@ -0,0 +1,958 @@
+/*
+www.sourceforge.net/projects/tinyxml
+Original code (2.0 and earlier )copyright (c) 2000-2002 Lee Thomason (www.grinninglizard.com)
+
+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.
+*/
+
+
+#ifndef TINYXML_INCLUDED
+#define TINYXML_INCLUDED
+
+#define TIXML_USE_STL
+
+#ifdef _MSC_VER
+#pragma warning( disable : 4530 )
+#pragma warning( disable : 4786 )
+#endif
+
+#include <ctype.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <assert.h>
+
+// Help out windows:
+#if defined( _DEBUG ) && !defined( DEBUG )
+#define DEBUG
+#endif
+
+#if defined( DEBUG ) && defined( _MSC_VER )
+#define NOMINMAX
+#include <windows.h>
+#define TIXML_LOG OutputDebugString
+#else
+#define TIXML_LOG printf
+#endif
+
+
+#ifdef TIXML_USE_STL
+	#include <string>
+    #include <iostream>
+	#define TIXML_STRING	std::string
+	#define TIXML_ISTREAM	std::istream
+	#define TIXML_OSTREAM	std::ostream
+#else
+	#include "tinystr.h"
+	#define TIXML_STRING	TiXmlString
+	#define TIXML_OSTREAM	TiXmlOutStream
+#endif
+
+class TiXmlDocument;
+class TiXmlElement;
+class TiXmlComment;
+class TiXmlUnknown;
+class TiXmlAttribute;
+class TiXmlText;
+class TiXmlDeclaration;
+
+
+/** TiXmlBase is a base class for every class in TinyXml.
+	It does little except to establish that TinyXml classes
+	can be printed and provide some utility functions.
+
+	In XML, the document and elements can contain
+	other elements and other types of nodes.
+
+	@verbatim
+	A Document can contain:	Element	(container or leaf)
+							Comment (leaf)
+							Unknown (leaf)
+							Declaration( leaf )
+
+	An Element can contain:	Element (container or leaf)
+							Text	(leaf)
+							Attributes (not on tree)
+							Comment (leaf)
+							Unknown (leaf)
+
+	A Decleration contains: Attributes (not on tree)
+	@endverbatim
+*/
+class TiXmlBase
+{
+	friend class TiXmlNode;
+	friend class TiXmlElement;
+	friend class TiXmlDocument;
+
+public:
+	TiXmlBase()								{}
+	virtual ~TiXmlBase()					{}
+
+	/**	All TinyXml classes can print themselves to a filestream.
+		This is a formatted print, and will insert tabs and newlines.
+		
+		(For an unformatted stream, use the << operator.)
+	*/
+	virtual void Print( FILE* cfile, int depth ) const = 0;
+
+	/**	The world does not agree on whether white space should be kept or
+		not. In order to make everyone happy, these global, static functions
+		are provided to set whether or not TinyXml will condense all white space
+		into a single space or not. The default is to condense. Note changing these
+		values is not thread safe.
+	*/
+	static void SetCondenseWhiteSpace( bool condense )		{ condenseWhiteSpace = condense; }
+
+	/// Return the current white space setting.
+	static bool IsWhiteSpaceCondensed()						{ return condenseWhiteSpace; }
+
+protected:
+
+	static const char*	SkipWhiteSpace( const char* );
+	inline static bool	IsWhiteSpace( int c )		{ return ( isspace( c ) || c == '\n' || c == '\r' ); }
+
+	virtual void StreamOut (TIXML_OSTREAM *) const = 0;
+
+	#ifdef TIXML_USE_STL
+	    static bool	StreamWhiteSpace( TIXML_ISTREAM * in, TIXML_STRING * tag );
+	    static bool StreamTo( TIXML_ISTREAM * in, int character, TIXML_STRING * tag );
+	#endif
+
+	/*	Reads an XML name into the string provided. Returns
+		a pointer just past the last character of the name,
+		or 0 if the function has an error.
+	*/
+	static const char* ReadName( const char* p, TIXML_STRING* name );
+
+	/*	Reads text. Returns a pointer past the given end tag.
+		Wickedly complex options, but it keeps the (sensitive) code in one place.
+	*/
+	static const char* ReadText(	const char* in,				// where to start
+									TIXML_STRING* text,			// the string read
+									bool ignoreWhiteSpace,		// whether to keep the white space
+									const char* endTag,			// what ends this text
+									bool ignoreCase );			// whether to ignore case in the end tag
+	virtual const char* Parse( const char* p ) = 0;
+
+	// If an entity has been found, transform it into a character.
+	static const char* GetEntity( const char* in, char* value );
+
+	// Get a character, while interpreting entities.
+	inline static const char* GetChar( const char* p, char* value )
+	{
+		assert( p );
+		if ( *p == '&' )
+		{
+			return GetEntity( p, value );
+		}
+		else
+		{
+			*value = *p;
+			return p+1;
+		}
+	}
+
+	// Puts a string to a stream, expanding entities as it goes.
+	// Note this should not contian the '<', '>', etc, or they will be transformed into entities!
+	static void PutString( const TIXML_STRING& str, TIXML_OSTREAM* out );
+
+	static void PutString( const TIXML_STRING& str, TIXML_STRING* out );
+
+	// Return true if the next characters in the stream are any of the endTag sequences.
+	bool static StringEqual(	const char* p,
+								const char* endTag,
+								bool ignoreCase );
+
+
+	enum
+	{
+		TIXML_NO_ERROR = 0,
+		TIXML_ERROR,
+		TIXML_ERROR_OPENING_FILE,
+		TIXML_ERROR_OUT_OF_MEMORY,
+		TIXML_ERROR_PARSING_ELEMENT,
+		TIXML_ERROR_FAILED_TO_READ_ELEMENT_NAME,
+		TIXML_ERROR_READING_ELEMENT_VALUE,
+		TIXML_ERROR_READING_ATTRIBUTES,
+		TIXML_ERROR_PARSING_EMPTY,
+		TIXML_ERROR_READING_END_TAG,
+		TIXML_ERROR_PARSING_UNKNOWN,
+		TIXML_ERROR_PARSING_COMMENT,
+		TIXML_ERROR_PARSING_DECLARATION,
+		TIXML_ERROR_DOCUMENT_EMPTY,
+
+		TIXML_ERROR_STRING_COUNT
+	};
+	static const char* errorString[ TIXML_ERROR_STRING_COUNT ];
+
+private:
+	struct Entity
+	{
+		const char*     str;
+		unsigned int	strLength;
+		char		    chr;
+	};
+	enum
+	{
+		NUM_ENTITY = 5,
+		MAX_ENTITY_LENGTH = 6
+
+	};
+	static Entity entity[ NUM_ENTITY ];
+	static bool condenseWhiteSpace;
+};
+
+
+/** The parent class for everything in the Document Object Model.
+	(Except for attributes, which are contained in elements.)
+	Nodes have siblings, a parent, and children. A node can be
+	in a document, or stand on its own. The type of a TiXmlNode
+	can be queried, and it can be cast to its more defined type.
+*/
+class TiXmlNode : public TiXmlBase
+{
+	friend class TiXmlDocument;
+	friend class TiXmlElement;
+
+public:
+	#ifdef TIXML_USE_STL	
+
+	    /** An input stream operator, for every class. Tolerant of newlines and
+		    formatting, but doesn't expect them.
+	    */
+	    friend std::istream& operator >> (std::istream& in, TiXmlNode& base);
+
+	    /** An output stream operator, for every class. Note that this outputs
+		    without any newlines or formatting, as opposed to Print(), which
+		    includes tabs and new lines.
+
+		    The operator<< and operator>> are not completely symmetric. Writing
+		    a node to a stream is very well defined. You'll get a nice stream
+		    of output, without any extra whitespace or newlines.
+		    
+		    But reading is not as well defined. (As it always is.) If you create
+		    a TiXmlElement (for example) and read that from an input stream,
+		    the text needs to define an element or junk will result. This is
+		    true of all input streams, but it's worth keeping in mind.
+
+		    A TiXmlDocument will read nodes until it reads a root element.
+	    */	
+	    friend std::ostream & operator<< (std::ostream& out, const TiXmlNode& base);
+
+	#else
+	    // Used internally, not part of the public API.
+	    friend TIXML_OSTREAM& operator<< (TIXML_OSTREAM& out, const TiXmlNode& base);
+	#endif
+
+	/** The types of XML nodes supported by TinyXml. (All the
+			unsupported types are picked up by UNKNOWN.)
+	*/
+	enum NodeType
+	{
+		DOCUMENT,
+		ELEMENT,
+		COMMENT,
+		UNKNOWN,
+		TEXT,
+		DECLARATION,
+		TYPECOUNT
+	};
+
+	virtual ~TiXmlNode();
+
+	/** The meaning of 'value' changes for the specific type of
+		TiXmlNode.
+		@verbatim
+		Document:	filename of the xml file
+		Element:	name of the element
+		Comment:	the comment text
+		Unknown:	the tag contents
+		Text:		the text string
+		@endverbatim
+
+		The subclasses will wrap this function.
+	*/
+	const char * Value () const { return value.c_str (); }
+
+	/** Changes the value of the node. Defined as:
+		@verbatim
+		Document:	filename of the xml file
+		Element:	name of the element
+		Comment:	the comment text
+		Unknown:	the tag contents
+		Text:		the text string
+		@endverbatim
+	*/
+	void SetValue (const char * _value) { value = _value;}
+
+    #ifdef TIXML_USE_STL
+	/// STL std::string form.
+	void SetValue( const std::string& value )    
+	{	  
+		SetValue( value.c_str() );    	
+	}	
+	#endif
+
+	/// Delete all the children of this node. Does not affect 'this'.
+	void Clear();
+
+	/// One step up the DOM.
+	TiXmlNode* Parent() const					{ return parent; }
+
+	TiXmlNode* FirstChild()	const	{ return firstChild; }		///< The first child of this node. Will be null if there are no children.
+	TiXmlNode* FirstChild( const char * value ) const;			///< The first child of this node with the matching 'value'. Will be null if none found.
+
+	TiXmlNode* LastChild() const	{ return lastChild; }		/// The last child of this node. Will be null if there are no children.
+	TiXmlNode* LastChild( const char * value ) const;			/// The last child of this node matching 'value'. Will be null if there are no children.
+
+    #ifdef TIXML_USE_STL
+	TiXmlNode* FirstChild( const std::string& value ) const	{	return FirstChild (value.c_str ());	}	///< STL std::string form.
+	TiXmlNode* LastChild( const std::string& value ) const	{	return LastChild (value.c_str ());	}	///< STL std::string form.
+	#endif
+
+	/** An alternate way to walk the children of a node.
+		One way to iterate over nodes is:
+		@verbatim
+			for( child = parent->FirstChild(); child; child = child->NextSibling() )
+		@endverbatim
+
+		IterateChildren does the same thing with the syntax:
+		@verbatim
+			child = 0;
+			while( child = parent->IterateChildren( child ) )
+		@endverbatim
+
+		IterateChildren takes the previous child as input and finds
+		the next one. If the previous child is null, it returns the
+		first. IterateChildren will return null when done.
+	*/
+	TiXmlNode* IterateChildren( TiXmlNode* previous ) const;
+
+	/// This flavor of IterateChildren searches for children with a particular 'value'
+	TiXmlNode* IterateChildren( const char * value, TiXmlNode* previous ) const;
+
+    #ifdef TIXML_USE_STL
+	TiXmlNode* IterateChildren( const std::string& value, TiXmlNode* previous ) const	{	return IterateChildren (value.c_str (), previous);	}	///< STL std::string form.
+	#endif
+
+	/** Add a new node related to this. Adds a child past the LastChild.
+		Returns a pointer to the new object or NULL if an error occured.
+	*/
+	TiXmlNode* InsertEndChild( const TiXmlNode& addThis );
+
+	/** Add a new node related to this. Adds a child before the specified child.
+		Returns a pointer to the new object or NULL if an error occured.
+	*/
+	TiXmlNode* InsertBeforeChild( TiXmlNode* beforeThis, const TiXmlNode& addThis );
+
+	/** Add a new node related to this. Adds a child after the specified child.
+		Returns a pointer to the new object or NULL if an error occured.
+	*/
+	TiXmlNode* InsertAfterChild(  TiXmlNode* afterThis, const TiXmlNode& addThis );
+
+	/** Replace a child of this node.
+		Returns a pointer to the new object or NULL if an error occured.
+	*/
+	TiXmlNode* ReplaceChild( TiXmlNode* replaceThis, const TiXmlNode& withThis );
+
+	/// Delete a child of this node.
+	bool RemoveChild( TiXmlNode* removeThis );
+
+	/// Navigate to a sibling node.
+	TiXmlNode* PreviousSibling() const			{ return prev; }
+
+	/// Navigate to a sibling node.
+	TiXmlNode* PreviousSibling( const char * ) const;
+
+    #ifdef TIXML_USE_STL
+	TiXmlNode* PreviousSibling( const std::string& value ) const	{	return PreviousSibling (value.c_str ());	}	///< STL std::string form.
+	TiXmlNode* NextSibling( const std::string& value) const	{	return NextSibling (value.c_str ());	}	///< STL std::string form.
+	#endif
+
+	/// Navigate to a sibling node.
+	TiXmlNode* NextSibling() const				{ return next; }
+
+	/// Navigate to a sibling node with the given 'value'.
+	TiXmlNode* NextSibling( const char * ) const;
+
+	/** Convenience function to get through elements.
+		Calls NextSibling and ToElement. Will skip all non-Element
+		nodes. Returns 0 if there is not another element.
+	*/
+	TiXmlElement* NextSiblingElement() const;
+
+	/** Convenience function to get through elements.
+		Calls NextSibling and ToElement. Will skip all non-Element
+		nodes. Returns 0 if there is not another element.
+	*/
+	TiXmlElement* NextSiblingElement( const char * ) const;
+
+    #ifdef TIXML_USE_STL
+	TiXmlElement* NextSiblingElement( const std::string& value) const	{	return NextSiblingElement (value.c_str ());	}	///< STL std::string form.
+	#endif
+
+	/// Convenience function to get through elements.
+	TiXmlElement* FirstChildElement()	const;
+
+	/// Convenience function to get through elements.
+	TiXmlElement* FirstChildElement( const char * value ) const;
+
+    #ifdef TIXML_USE_STL
+	TiXmlElement* FirstChildElement( const std::string& value ) const	{	return FirstChildElement (value.c_str ());	}	///< STL std::string form.
+	#endif
+
+	/// Query the type (as an enumerated value, above) of this node.
+	virtual int Type() const	{ return type; }
+
+	/** Return a pointer to the Document this node lives in.
+		Returns null if not in a document.
+	*/
+	TiXmlDocument* GetDocument() const;
+
+	/// Returns true if this node has no children.
+	bool NoChildren() const						{ return !firstChild; }
+
+	TiXmlDocument* ToDocument()	const		{ return ( this && type == DOCUMENT ) ? (TiXmlDocument*) this : 0; } ///< Cast to a more defined type. Will return null not of the requested type.
+	TiXmlElement*  ToElement() const		{ return ( this && type == ELEMENT  ) ? (TiXmlElement*)  this : 0; } ///< Cast to a more defined type. Will return null not of the requested type.
+	TiXmlComment*  ToComment() const		{ return ( this && type == COMMENT  ) ? (TiXmlComment*)  this : 0; } ///< Cast to a more defined type. Will return null not of the requested type.
+	TiXmlUnknown*  ToUnknown() const		{ return ( this && type == UNKNOWN  ) ? (TiXmlUnknown*)  this : 0; } ///< Cast to a more defined type. Will return null not of the requested type.
+	TiXmlText*	   ToText()    const		{ return ( this && type == TEXT     ) ? (TiXmlText*)     this : 0; } ///< Cast to a more defined type. Will return null not of the requested type.
+	TiXmlDeclaration* ToDeclaration() const	{ return ( this && type == DECLARATION ) ? (TiXmlDeclaration*) this : 0; } ///< Cast to a more defined type. Will return null not of the requested type.
+
+	virtual TiXmlNode* Clone() const = 0;
+
+	void  SetUserData( void* user )			{ userData = user; }
+	void* GetUserData()						{ return userData; }
+
+protected:
+	TiXmlNode( NodeType type );
+
+	#ifdef TIXML_USE_STL
+	    // The real work of the input operator.
+	    virtual void StreamIn( TIXML_ISTREAM* in, TIXML_STRING* tag ) = 0;
+	#endif
+
+	// The node is passed in by ownership. This object will delete it.
+	TiXmlNode* LinkEndChild( TiXmlNode* addThis );
+
+	// Figure out what is at *p, and parse it. Returns null if it is not an xml node.
+	TiXmlNode* Identify( const char* start );
+	void CopyToClone( TiXmlNode* target ) const	{ target->SetValue (value.c_str() );
+												  target->userData = userData; }
+
+	// Internal Value function returning a TIXML_STRING
+	TIXML_STRING SValue() const	{ return value ; }
+
+	TiXmlNode*		parent;
+	NodeType		type;
+
+	TiXmlNode*		firstChild;
+	TiXmlNode*		lastChild;
+
+	TIXML_STRING	value;
+
+	TiXmlNode*		prev;
+	TiXmlNode*		next;
+	void*			userData;
+};
+
+
+/** An attribute is a name-value pair. Elements have an arbitrary
+	number of attributes, each with a unique name.
+
+	@note The attributes are not TiXmlNodes, since they are not
+		  part of the tinyXML document object model. There are other
+		  suggested ways to look at this problem.
+
+	@note Attributes have a parent
+*/
+class TiXmlAttribute : public TiXmlBase
+{
+	friend class TiXmlAttributeSet;
+
+public:
+	/// Construct an empty attribute.
+	TiXmlAttribute() : prev( 0 ), next( 0 )	{}
+
+	#ifdef TIXML_USE_STL
+	/// std::string constructor.
+	TiXmlAttribute( const std::string& _name, const std::string& _value )
+	{
+		name = _name;
+		value = _value;
+	}
+	#endif
+
+	/// Construct an attribute with a name and value.
+	TiXmlAttribute( const char * _name, const char * _value ): name( _name ), value( _value ), prev( 0 ), next( 0 ) {}
+	const char*		Name()  const		{ return name.c_str (); }		///< Return the name of this attribute.
+	const char*		Value() const		{ return value.c_str (); }		///< Return the value of this attribute.
+	const int       IntValue() const;									///< Return the value of this attribute, converted to an integer.
+	const double	DoubleValue() const;								///< Return the value of this attribute, converted to a double.
+
+	void SetName( const char* _name )	{ name = _name; }				///< Set the name of this attribute.
+	void SetValue( const char* _value )	{ value = _value; }				///< Set the value.
+
+	void SetIntValue( int value );										///< Set the value from an integer.
+	void SetDoubleValue( double value );								///< Set the value from a double.
+
+    #ifdef TIXML_USE_STL
+	/// STL std::string form.
+	void SetName( const std::string& _name )	
+	{	
+		SetName(_name.c_str() );	
+	}
+	/// STL std::string form.	
+	void SetValue( const std::string& _value )	
+	{	
+		SetValue( value.c_str() );	
+	}
+	#endif
+
+	/// Get the next sibling attribute in the DOM. Returns null at end.
+	TiXmlAttribute* Next() const;
+	/// Get the previous sibling attribute in the DOM. Returns null at beginning.
+	TiXmlAttribute* Previous() const;
+
+	bool operator==( const TiXmlAttribute& rhs ) const { return rhs.name == name; }
+	bool operator<( const TiXmlAttribute& rhs )	 const { return name < rhs.name; }
+	bool operator>( const TiXmlAttribute& rhs )  const { return name > rhs.name; }
+
+	/*	[internal use]
+		Attribtue parsing starts: first letter of the name
+						 returns: the next char after the value end quote
+	*/
+	virtual const char* Parse( const char* p );
+
+	// [internal use]
+	virtual void Print( FILE* cfile, int depth ) const;
+
+	virtual void StreamOut( TIXML_OSTREAM * out ) const;
+	// [internal use]
+	// Set the document pointer so the attribute can report errors.
+	void SetDocument( TiXmlDocument* doc )	{ document = doc; }
+
+private:
+	TiXmlDocument*	document;	// A pointer back to a document, for error reporting.
+	TIXML_STRING name;
+	TIXML_STRING value;
+	TiXmlAttribute*	prev;
+	TiXmlAttribute*	next;
+};
+
+
+/*	A class used to manage a group of attributes.
+	It is only used internally, both by the ELEMENT and the DECLARATION.
+	
+	The set can be changed transparent to the Element and Declaration
+	classes that use it, but NOT transparent to the Attribute
+	which has to implement a next() and previous() method. Which makes
+	it a bit problematic and prevents the use of STL.
+
+	This version is implemented with circular lists because:
+		- I like circular lists
+		- it demonstrates some independence from the (typical) doubly linked list.
+*/
+class TiXmlAttributeSet
+{
+public:
+	TiXmlAttributeSet();
+	~TiXmlAttributeSet();
+
+	void Add( TiXmlAttribute* attribute );
+	void Remove( TiXmlAttribute* attribute );
+
+	TiXmlAttribute* First() const	{ return ( sentinel.next == &sentinel ) ? 0 : sentinel.next; }
+	TiXmlAttribute* Last()  const	{ return ( sentinel.prev == &sentinel ) ? 0 : sentinel.prev; }
+	TiXmlAttribute*	Find( const char * name ) const;
+
+private:
+	TiXmlAttribute sentinel;
+};
+
+
+/** The element is a container class. It has a value, the element name,
+	and can contain other elements, text, comments, and unknowns.
+	Elements also contain an arbitrary number of attributes.
+*/
+class TiXmlElement : public TiXmlNode
+{
+public:
+	/// Construct an element.
+	TiXmlElement (const char * in_value);
+
+	#ifdef TIXML_USE_STL
+	/// std::string constructor.
+	TiXmlElement( const std::string& _value ) : 	TiXmlNode( TiXmlNode::ELEMENT )
+	{
+		firstChild = lastChild = 0;
+		value = _value;
+	}
+	#endif
+
+	virtual ~TiXmlElement();
+
+// OGRE CHANGE 
+// Resolve ambiguity of std::string / const char* conversion of Ogre::String
+#ifndef TIXML_USE_STL
+// OGRE CHANGE
+	/** Given an attribute name, attribute returns the value
+		for the attribute of that name, or null if none exists.
+	*/
+	const char* Attribute( const char* name ) const;
+
+	/** Given an attribute name, attribute returns the value
+		for the attribute of that name, or null if none exists.
+		If the attribute exists and can be converted to an integer,
+		the integer value will be put in the return 'i', if 'i'
+		is non-null.
+	*/
+	const char* Attribute( const char* name, int* i ) const;
+
+	/** Sets an attribute of name to a given value. The attribute
+		will be created if it does not exist, or changed if it does.
+	*/
+	void SetAttribute( const char* name, const char * value );
+// OGRE CHANGE
+#endif
+// OGRE CHANGE
+    #ifdef TIXML_USE_STL
+	const char* Attribute( const std::string& name ) const;
+	const char* Attribute( const std::string& name, int* i ) const;
+
+	/// STL std::string form.
+	void SetAttribute( const std::string& name, const std::string& value );
+	///< STL std::string form.
+	void SetAttribute( const std::string& name, int value );
+	#endif
+
+	/** Sets an attribute of name to a given value. The attribute
+		will be created if it does not exist, or changed if it does.
+	*/
+	void SetAttribute( const char * name, int value );
+
+	/** Deletes an attribute with the given name.
+	*/
+	void RemoveAttribute( const char * name );
+    #ifdef TIXML_USE_STL
+	void RemoveAttribute( const std::string& name )	{	RemoveAttribute (name.c_str ());	}	///< STL std::string form.
+	#endif
+
+	TiXmlAttribute* FirstAttribute() const	{ return attributeSet.First(); }		///< Access the first attribute in this element.
+	TiXmlAttribute* LastAttribute()	const 	{ return attributeSet.Last(); }		///< Access the last attribute in this element.
+
+	// [internal use] Creates a new Element and returs it.
+	virtual TiXmlNode* Clone() const;
+	// [internal use]
+
+	virtual void Print( FILE* cfile, int depth ) const;
+
+protected:
+
+	// Used to be public [internal use]
+	#ifdef TIXML_USE_STL
+	    virtual void StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag );
+	#endif
+	virtual void StreamOut( TIXML_OSTREAM * out ) const;
+
+	/*	[internal use]
+		Attribtue parsing starts: next char past '<'
+						 returns: next char past '>'
+	*/
+	virtual const char* Parse( const char* p );
+
+	/*	[internal use]
+		Reads the "value" of the element -- another element, or text.
+		This should terminate with the current end tag.
+	*/
+	const char* ReadValue( const char* in );
+
+private:
+	TiXmlAttributeSet attributeSet;
+};
+
+
+/**	An XML comment.
+*/
+class TiXmlComment : public TiXmlNode
+{
+public:
+	/// Constructs an empty comment.
+	TiXmlComment() : TiXmlNode( TiXmlNode::COMMENT ) {}
+	virtual ~TiXmlComment()	{}
+
+	// [internal use] Creates a new Element and returs it.
+	virtual TiXmlNode* Clone() const;
+	// [internal use]
+	virtual void Print( FILE* cfile, int depth ) const;
+protected:
+	// used to be public
+	#ifdef TIXML_USE_STL
+	    virtual void StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag );
+	#endif
+	virtual void StreamOut( TIXML_OSTREAM * out ) const;
+	/*	[internal use]
+		Attribtue parsing starts: at the ! of the !--
+						 returns: next char past '>'
+	*/
+	virtual const char* Parse( const char* p );
+};
+
+
+/** XML text. Contained in an element.
+*/
+class TiXmlText : public TiXmlNode
+{
+	friend class TiXmlElement;
+public:
+	/// Constructor.
+	TiXmlText (const char * initValue) : TiXmlNode (TiXmlNode::TEXT)
+	{
+		SetValue( initValue );
+	}
+	virtual ~TiXmlText() {}
+
+	#ifdef TIXML_USE_STL
+	/// Constructor.
+	TiXmlText( const std::string& initValue ) : TiXmlNode (TiXmlNode::TEXT)
+	{
+		SetValue( initValue );
+	}
+	#endif
+
+protected :
+	// [internal use] Creates a new Element and returns it.
+	virtual TiXmlNode* Clone() const;
+	// [internal use]
+	virtual void Print( FILE* cfile, int depth ) const;
+	virtual void StreamOut ( TIXML_OSTREAM * out ) const;
+	// [internal use]
+	bool Blank() const;	// returns true if all white space and new lines
+	/*	[internal use]
+			Attribtue parsing starts: First char of the text
+							 returns: next char past '>'
+		*/
+	virtual const char* Parse( const char* p );
+	// [internal use]
+	#ifdef TIXML_USE_STL
+	    virtual void StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag );
+	#endif
+};
+
+
+/** In correct XML the declaration is the first entry in the file.
+	@verbatim
+		<?xml version="1.0" standalone="yes"?>
+	@endverbatim
+
+	TinyXml will happily read or write files without a declaration,
+	however. There are 3 possible attributes to the declaration:
+	version, encoding, and standalone.
+
+	Note: In this version of the code, the attributes are
+	handled as special cases, not generic attributes, simply
+	because there can only be at most 3 and they are always the same.
+*/
+class TiXmlDeclaration : public TiXmlNode
+{
+public:
+	/// Construct an empty declaration.
+	TiXmlDeclaration()   : TiXmlNode( TiXmlNode::DECLARATION ) {}
+
+#ifdef TIXML_USE_STL
+	/// Constructor.
+	TiXmlDeclaration(
+						const std::string& _version,
+						const std::string& _encoding,
+						const std::string& _standalone )
+					: TiXmlNode( TiXmlNode::DECLARATION )
+	{
+		version = _version;
+		encoding = _encoding;
+		standalone = _standalone;
+	}
+#endif
+
+	/// Construct.
+	TiXmlDeclaration::TiXmlDeclaration( const char * _version,
+										const char * _encoding,
+										const char * _standalone );
+
+	virtual ~TiXmlDeclaration()	{}
+
+	/// Version. Will return empty if none was found.
+	const char * Version() const		{ return version.c_str (); }
+	/// Encoding. Will return empty if none was found.
+	const char * Encoding() const		{ return encoding.c_str (); }
+	/// Is this a standalone document?
+	const char * Standalone() const		{ return standalone.c_str (); }
+
+	// [internal use] Creates a new Element and returs it.
+	virtual TiXmlNode* Clone() const;
+	// [internal use]
+	virtual void Print( FILE* cfile, int depth ) const;
+
+protected:
+	// used to be public
+	#ifdef TIXML_USE_STL
+	    virtual void StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag );
+	#endif
+	virtual void StreamOut ( TIXML_OSTREAM * out) const;
+	//	[internal use]
+	//	Attribtue parsing starts: next char past '<'
+	//					 returns: next char past '>'
+
+	virtual const char* Parse( const char* p );
+
+private:
+	TIXML_STRING version;
+	TIXML_STRING encoding;
+	TIXML_STRING standalone;
+};
+
+
+/** Any tag that tinyXml doesn't recognize is save as an
+	unknown. It is a tag of text, but should not be modified.
+	It will be written back to the XML, unchanged, when the file
+	is saved.
+*/
+class TiXmlUnknown : public TiXmlNode
+{
+public:
+	TiXmlUnknown() : TiXmlNode( TiXmlNode::UNKNOWN ) {}
+	virtual ~TiXmlUnknown() {}
+
+	// [internal use]
+	virtual TiXmlNode* Clone() const;
+	// [internal use]
+	virtual void Print( FILE* cfile, int depth ) const;
+protected:
+	// used to be public
+	#ifdef TIXML_USE_STL
+	    virtual void StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag );
+	#endif
+	virtual void StreamOut ( TIXML_OSTREAM * out ) const;
+	/*	[internal use]
+		Attribute parsing starts: First char of the text
+						 returns: next char past '>'
+	*/
+	virtual const char* Parse( const char* p );
+};
+
+
+/** Always the top level node. A document binds together all the
+	XML pieces. It can be saved, loaded, and printed to the screen.
+	The 'value' of a document node is the xml file name.
+*/
+class TiXmlDocument : public TiXmlNode
+{
+public:
+	/// Create an empty document, that has no name.
+	TiXmlDocument();
+	/// Create a document with a name. The name of the document is also the filename of the xml.
+	TiXmlDocument( const char * documentName );
+
+	#ifdef TIXML_USE_STL
+	/// Constructor.
+	TiXmlDocument( const std::string& documentName ) :
+	    TiXmlNode( TiXmlNode::DOCUMENT )
+	{
+        value = documentName;
+		error = false;
+	}
+	#endif
+
+	virtual ~TiXmlDocument() {}
+
+	/** Load a file using the current document value.
+		Returns true if successful. Will delete any existing
+		document data before loading.
+	*/
+	bool LoadFile();
+	/// Save a file using the current document value. Returns true if successful.
+	bool SaveFile() const;
+	/// Load a file using the given filename. Returns true if successful.
+	bool LoadFile( const char * filename );
+	/// Save a file using the given filename. Returns true if successful.
+	bool SaveFile( const char * filename ) const;
+
+	#ifdef TIXML_USE_STL
+	bool LoadFile( const std::string& filename )			///< STL std::string version.
+	{
+		return ( LoadFile( filename.c_str() ));
+	}
+	bool SaveFile( const std::string& filename ) const		///< STL std::string version.
+	{
+		//StringToBuffer f( filename );
+		return ( SaveFile( filename.c_str() ));
+	}
+	#endif
+
+	/// Parse the given null terminated block of xml data.
+	virtual const char* Parse( const char* p );
+
+	/** Get the root element -- the only top level element -- of the document.
+		In well formed XML, there should only be one. TinyXml is tolerant of
+		multiple elements at the document level.
+	*/
+	TiXmlElement* RootElement() const		{ return FirstChildElement(); }
+
+	/// If, during parsing, a error occurs, Error will be set to true.
+	bool Error() const						{ return error; }
+
+	/// Contains a textual (english) description of the error if one occurs.
+	const char * ErrorDesc() const	{ return errorDesc.c_str (); }
+
+	/** Generally, you probably want the error string ( ErrorDesc() ). But if you
+			prefer the ErrorId, this function will fetch it.
+		*/
+	const int ErrorId()	const				{ return errorId; }
+
+	/// If you have handled the error, it can be reset with this call.
+	void ClearError()						{ error = false; errorId = 0; errorDesc = ""; }
+
+	/** Dump the document to standard out. */
+	void Print() const						{ Print( stdout, 0 ); }
+
+	// [internal use]
+	virtual void Print( FILE* cfile, int depth = 0 ) const;
+	// [internal use]
+	void SetError( int err ) {		assert( err > 0 && err < TIXML_ERROR_STRING_COUNT );
+		error   = true;
+		errorId = err;
+	errorDesc = errorString[ errorId ]; }
+
+protected :
+	virtual void StreamOut ( TIXML_OSTREAM * out) const;
+	// [internal use]
+	virtual TiXmlNode* Clone() const;
+	#ifdef TIXML_USE_STL
+	    virtual void StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag );
+	#endif
+
+private:
+	bool error;
+	int  errorId;
+	TIXML_STRING errorDesc;
+};
+
+#endif
+
Index: NonGTP/OSceneLoader/TinyXML/tinystr.cpp
===================================================================
--- NonGTP/OSceneLoader/TinyXML/tinystr.cpp	(revision 965)
+++ NonGTP/OSceneLoader/TinyXML/tinystr.cpp	(revision 965)
@@ -0,0 +1,265 @@
+/*
+www.sourceforge.net/projects/tinyxml
+Original file by Yves Berquin.
+
+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 "tinyxml.h"
+
+#ifndef TIXML_USE_STL
+
+
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+
+#include "tinystr.h"
+
+// TiXmlString constructor, based on a C string
+TiXmlString::TiXmlString (const char* instring)
+{
+    unsigned newlen;
+    char * newstring;
+
+    if (!instring)
+    {
+        allocated = 0;
+        cstring = NULL;
+        return;
+    }
+    newlen = strlen (instring) + 1;
+    newstring = new char [newlen];
+    strcpy (newstring, instring);
+    allocated = newlen;
+    cstring = newstring;
+}
+
+// TiXmlString copy constructor
+TiXmlString::TiXmlString (const TiXmlString& copy)
+{
+    unsigned newlen;
+    char * newstring;
+
+	// Prevent copy to self!
+	if ( &copy == this )
+		return;
+
+    if (! copy . allocated)
+    {
+        allocated = 0;
+        cstring = NULL;
+        return;
+    }
+    newlen = strlen (copy . cstring) + 1;
+    newstring = new char [newlen];
+    strcpy (newstring, copy . cstring);
+    allocated = newlen;
+    cstring = newstring;
+}
+
+// TiXmlString = operator. Safe when assign own content
+void TiXmlString ::operator = (const char * content)
+{
+    unsigned newlen;
+    char * newstring;
+
+    if (! content)
+    {
+        empty_it ();
+        return;
+    }
+    newlen = strlen (content) + 1;
+    newstring = new char [newlen];
+    strcpy (newstring, content);
+    empty_it ();
+    allocated = newlen;
+    cstring = newstring;
+}
+
+// = operator. Safe when assign own content
+void TiXmlString ::operator = (const TiXmlString & copy)
+{
+    unsigned newlen;
+    char * newstring;
+
+    if (! copy . length ())
+    {
+        empty_it ();
+        return;
+    }
+    newlen = copy . length () + 1;
+    newstring = new char [newlen];
+    strcpy (newstring, copy . c_str ());
+    empty_it ();
+    allocated = newlen;
+    cstring = newstring;
+}
+
+
+//// Checks if a TiXmlString contains only whitespace (same rules as isspace)
+//bool TiXmlString::isblank () const
+//{
+//    char * lookup;
+//    for (lookup = cstring; * lookup; lookup++)
+//        if (! isspace (* lookup))
+//            return false;
+//    return true;
+//}
+
+// append a const char * to an existing TiXmlString
+void TiXmlString::append( const char* str, int len )
+{
+    char * new_string;
+    unsigned new_alloc, new_size;
+
+    new_size = length () + len + 1;
+    // check if we need to expand
+    if (new_size > allocated)
+    {
+        // compute new size
+        new_alloc = assign_new_size (new_size);
+
+        // allocate new buffer
+        new_string = new char [new_alloc];        
+        new_string [0] = 0;
+
+        // copy the previous allocated buffer into this one
+        if (allocated && cstring)
+            strcpy (new_string, cstring);
+
+        // append the suffix. It does exist, otherwize we wouldn't be expanding 
+        strncat (new_string, str, len);
+
+        // return previsously allocated buffer if any
+        if (allocated && cstring)
+            delete [] cstring;
+
+        // update member variables
+        cstring = new_string;
+        allocated = new_alloc;
+    }
+    else
+        // we know we can safely append the new string
+        strncat (cstring, str, len);
+}
+
+
+// append a const char * to an existing TiXmlString
+void TiXmlString::append( const char * suffix )
+{
+    char * new_string;
+    unsigned new_alloc, new_size;
+
+    new_size = length () + strlen (suffix) + 1;
+    // check if we need to expand
+    if (new_size > allocated)
+    {
+        // compute new size
+        new_alloc = assign_new_size (new_size);
+
+        // allocate new buffer
+        new_string = new char [new_alloc];        
+        new_string [0] = 0;
+
+        // copy the previous allocated buffer into this one
+        if (allocated && cstring)
+            strcpy (new_string, cstring);
+
+        // append the suffix. It does exist, otherwize we wouldn't be expanding 
+        strcat (new_string, suffix);
+
+        // return previsously allocated buffer if any
+        if (allocated && cstring)
+            delete [] cstring;
+
+        // update member variables
+        cstring = new_string;
+        allocated = new_alloc;
+    }
+    else
+        // we know we can safely append the new string
+        strcat (cstring, suffix);
+}
+
+// Check for TiXmlString equuivalence
+//bool TiXmlString::operator == (const TiXmlString & compare) const
+//{
+//    return (! strcmp (c_str (), compare . c_str ()));
+//}
+
+unsigned TiXmlString::length () const
+{
+    if (allocated)
+        return strlen (cstring);
+    return 0;
+}
+
+
+unsigned TiXmlString::find (char tofind, unsigned offset) const
+{
+    char * lookup;
+
+    if (offset >= length ())
+        return (unsigned) notfound;
+    for (lookup = cstring + offset; * lookup; lookup++)
+        if (* lookup == tofind)
+            return lookup - cstring;
+    return (unsigned) notfound;
+}
+
+
+bool TiXmlString::operator == (const TiXmlString & compare) const
+{
+	if ( allocated && compare.allocated )
+	{
+		assert( cstring );
+		assert( compare.cstring );
+		return ( strcmp( cstring, compare.cstring ) == 0 );
+ 	}
+	return false;
+}
+
+
+bool TiXmlString::operator < (const TiXmlString & compare) const
+{
+	if ( allocated && compare.allocated )
+	{
+		assert( cstring );
+		assert( compare.cstring );
+		return ( strcmp( cstring, compare.cstring ) > 0 );
+ 	}
+	return false;
+}
+
+
+bool TiXmlString::operator > (const TiXmlString & compare) const
+{
+	if ( allocated && compare.allocated )
+	{
+		assert( cstring );
+		assert( compare.cstring );
+		return ( strcmp( cstring, compare.cstring ) < 0 );
+ 	}
+	return false;
+}
+
+
+#endif	// TIXML_USE_STL
Index: NonGTP/OSceneLoader/src/OgreOSMScene.cpp
===================================================================
--- NonGTP/OSceneLoader/src/OgreOSMScene.cpp	(revision 965)
+++ NonGTP/OSceneLoader/src/OgreOSMScene.cpp	(revision 965)
@@ -0,0 +1,718 @@
+/**********************************************************************
+ *<
+	oExporter plugin Private Beta (see License.txt)
+
+	FILE: ogreAnimationCompiler.h
+
+	DESCRIPTION: Contains the OE_XMLScene reader (oe_scene)	
+
+	IMPLEMENTED BY: Lioric
+
+	HISTORY: 
+
+		Original implementation by Lasse Tassing (Channex)
+		2005 ITE ApS, Lasse Tassing
+
+ *>	Copyright (c) 2005, All Rights Reserved.
+ **********************************************************************/
+
+#include <OgreOSMScene.h>
+
+using namespace Ogre;
+
+enum {
+	SCENE_SKYPLANE = 1,
+	SCENE_SKYBOX,
+	SCENE_SKYDOME,
+};
+
+#define ENABLE_LOGMANAGER LogManager::getSingleton().setLogDetail(LL_NORMAL);
+#define DISABLE_LOGMANAGER LogManager::getSingleton().setLogDetail(static_cast<LoggingLevel>(0));
+
+
+OSMScene::OSMScene(SceneManager* pSceneMgr, RenderWindow* win)
+{
+	mSceneMgr = pSceneMgr;
+	mWindow = win;
+	//mXMLDoc = 0;
+	mCallbacks = 0;
+}
+
+OSMScene::~OSMScene(void)
+{	
+	/*
+	if(mXMLDoc)
+		delete mXMLDoc;
+	*/
+}
+
+// Init overloads - use either of them
+bool OSMScene::initialise(const char* pszXMLFile, OSMSceneCallbacks* pCallbacks)
+{
+	// Hook up callback interface
+	mCallbacks = pCallbacks;
+
+	LogManager::getSingleton().logMessage("********************************");	
+	LogManager::getSingleton().logMessage("**     oScene Loader Lib      **");
+	LogManager::getSingleton().logMessage("********************************");
+	
+	String msg("oSceneLoader: Loading '");
+	msg += pszXMLFile;
+	msg += "' file";
+	LogManager::getSingleton().logMessage(msg);	
+
+	// Create new XML document
+	mXMLDoc = TiXmlDocumentPtr(new TiXmlDocument());
+
+	DataStreamPtr pStream = ResourceGroupManager::getSingleton().openResource(pszXMLFile);
+	if(!pStream->size())
+	{
+		mXMLDoc.setNull();
+
+		OGRE_EXCEPT(Exception::ERR_ITEM_NOT_FOUND,
+					"oSceneLoader: Empty scene file", 
+					"OSMScene::initialise");
+		
+	}			
+				
+	size_t iSize = pStream->size();
+	char *pBuf = new char[iSize+1];
+	memset(pBuf, 0, iSize+1);
+	pStream->read(pBuf, iSize);
+	pStream.setNull();
+	mXMLDoc->Parse(pBuf);
+	delete[] pBuf;
+	
+	// check for errors
+	if(mXMLDoc->Error())
+	{
+		mXMLDoc.setNull();
+
+		String errDesc = "oSceneLoader: Failed to load scene file, ";
+		msg += mXMLDoc->ErrorDesc();
+
+		OGRE_EXCEPT(Exception::ERR_INVALIDPARAMS,
+					errDesc.c_str(), 
+					"OSMScene::initialise");		
+	}
+
+	return true;
+}
+
+// Declare all resources used in the scene
+void OSMScene::declareResources(void)
+{
+	if(!mXMLDoc.isNull())
+	{
+
+		TiXmlElement* rootElem = mXMLDoc->RootElement();
+
+		try 
+		{
+			// Get mesh filename from entities
+			TiXmlElement *pMeshNode = rootElem->FirstChildElement("entities");
+			if(pMeshNode)
+			{
+				// Iterate all meshes, creating them. 
+				for (TiXmlElement* pMeshElem = pMeshNode->FirstChildElement();
+				pMeshElem != 0; pMeshElem = pMeshElem->NextSiblingElement())
+				{	
+					// Declare mesh resource
+					const char *pszFileName = pMeshElem->Attribute("filename");	
+					ResourceGroupManager::getSingleton().declareResource(pszFileName, "Mesh");
+				}
+			}
+		} catch(...)
+		{
+		}
+
+	}
+}
+
+// Create scene, optionally attaching it to a parent node
+bool OSMScene::createScene(Ogre::SceneNode* pParent)
+{
+	if(!mXMLDoc.isNull())
+	{
+		String msg("oSceneLoader: Creating scene on '");
+		msg += pParent ? pParent->getName() : "Root";
+		msg += "' node";
+		LogManager::getSingleton().logMessage(msg);	
+
+		TiXmlElement* rootElem = mXMLDoc->RootElement();
+
+		if(mSceneMgr == NULL)
+		{
+			if(rootElem->FirstChildElement("sceneManager"))
+				setSceneProperties(rootElem);
+			else
+				mSceneMgr = Root::getSingleton().createSceneManager(ST_GENERIC);
+		}
+
+		if(pParent==NULL)
+			pParent=mSceneMgr->getRootSceneNode()->createChildSceneNode();
+		
+		TiXmlElement* list;
+
+		try {
+			// Entities
+			list = rootElem->FirstChildElement("entities");
+			if(list)
+				createEntities(list, pParent);
+		} catch(...)
+		{
+		}
+
+		try {
+			// lights
+			list = rootElem->FirstChildElement("lights");
+			if(list)
+				createLights(list, pParent);
+		} catch(...)
+		{
+		}
+
+		try {
+			// cameras
+			list = rootElem->FirstChildElement("cameras");
+			if(list)
+				createCameras(list, pParent);
+		} catch(...)
+		{
+		}
+
+
+		LogManager::getSingleton().logMessage("********************************");
+		LogManager::getSingleton().logMessage("** oSceneLoader: Scene loaded **");
+		LogManager::getSingleton().logMessage("********************************");		
+
+		return true;
+	}
+
+	return false;
+
+	
+}
+
+// Get list of cameras in this scene
+OSMScene::CameraList& OSMScene::getCameraList(void)
+{
+	return mCameras;
+}
+
+// Get list of lights in this scene
+OSMScene::LightList& OSMScene::getLightList(void)
+{
+	return mLights;
+}
+
+// Get list of lights in this scene
+OSMScene::EntityList& OSMScene::getEntityList(void)
+{
+	return mEntities;
+}
+
+Ogre::SceneNode *OSMScene::createNode(TiXmlElement* pElem, Ogre::SceneNode* pSceneRoot)
+{
+	SceneNode *pNode=0;
+
+	// Try to find the parent node
+	const char *pszName	= pElem->Attribute("name");
+	if(pszName == NULL) return NULL;
+
+	// Check if this node has a parent
+	const char *pszParent = pElem->Attribute("parent");						
+	if(pszParent == NULL)
+	{	
+		// Check if the scene node has already been created by a child
+		DISABLE_LOGMANAGER
+
+		try 
+		{ 
+			pNode = mSceneMgr->getSceneNode(pszName);
+		} catch(...)
+		{
+			pNode = pSceneRoot->createChildSceneNode(pszName);
+		}
+		
+		ENABLE_LOGMANAGER
+
+	} else
+	{
+		SceneNode *pParent=0;
+		DISABLE_LOGMANAGER
+
+		try 
+		{
+			// Try to find parent scenenode
+			pParent=mSceneMgr->getSceneNode(pszParent);			
+		} catch(...)
+		{	
+			// We try to create the parent node as child of root node.
+			// Later when the parent (hopefully) is created, we can adjust it,
+			// if it is child of another node.
+			pParent=pSceneRoot->createChildSceneNode(pszParent);
+		}
+
+		
+		try 
+		{ 
+			// Check if the scene node has already been created by a child
+			// In this case we would have to change the parent.
+			pNode = mSceneMgr->getSceneNode(pszName);
+
+			// Get old parent (probably scene root)
+			SceneNode *pOldParent=pNode->getParentSceneNode();
+
+			// Remove this node
+			pOldParent->removeChild(pNode);
+
+			// Insert us as child on the "real" parent
+			pParent->addChild(pNode);
+		} catch(...)
+		{
+			pNode = pParent->createChildSceneNode(pszName);
+		}
+
+		ENABLE_LOGMANAGER
+	}
+
+	// Position
+	TiXmlElement* posElem = pElem->FirstChildElement("position");
+    if(posElem)
+    {
+		Vector3 pos;			
+		pos.x = StringConverter::parseReal(posElem->Attribute("x"));
+		pos.y = StringConverter::parseReal(posElem->Attribute("y"));
+		pos.z = StringConverter::parseReal(posElem->Attribute("z"));
+		pNode->setPosition(pos);		
+    }
+
+	// Rotation
+	TiXmlElement* rotElem = pElem->FirstChildElement("rotation");
+    if(rotElem)
+    {				
+		pNode->setOrientation(
+			StringConverter::parseReal(rotElem->Attribute("w")),
+			StringConverter::parseReal(rotElem->Attribute("x")),
+			StringConverter::parseReal(rotElem->Attribute("y")),
+			StringConverter::parseReal(rotElem->Attribute("z")));
+
+    }
+	
+	// Scale
+	TiXmlElement* scaleElem = pElem->FirstChildElement("scale");
+    if(scaleElem)
+    {
+		Vector3 scale;
+		scale.x = StringConverter::parseReal(scaleElem->Attribute("x"));
+		scale.y = StringConverter::parseReal(scaleElem->Attribute("y"));
+		scale.z = StringConverter::parseReal(scaleElem->Attribute("z"));
+		pNode->setScale(scale);
+    }
+
+	// Notify
+	if(mCallbacks)
+		mCallbacks->OnNodeCreate(pNode, pElem);
+
+	// Animation
+	TiXmlElement* animList = pElem->FirstChildElement("animations");
+    if(animList)
+	{
+		// 
+		for (TiXmlElement* animElem = animList->FirstChildElement();
+            animElem != 0; animElem = animElem->NextSiblingElement())
+		{		
+			// Get name of animation
+			const char *pszName = animElem->Attribute("name");
+
+			Animation *pAnim = 0;
+			DISABLE_LOGMANAGER
+			try 
+			{
+				pAnim=mSceneMgr->getAnimation(pszName);
+			} catch(...)
+			{
+			}
+			ENABLE_LOGMANAGER
+
+			// If this animation has not been created yet, we create it
+			if(pAnim == 0)
+			{			
+				float fLength = StringConverter::parseReal(animElem->Attribute("length"));
+				pAnim = mSceneMgr->createAnimation(pszName, fLength);
+				pAnim->setInterpolationMode(Animation::IM_LINEAR);				
+			}		
+
+			// Create animation track for this node
+			NodeAnimationTrack *pTrack = pAnim->createNodeTrack(pAnim->getNumNodeTracks()+1, pNode);
+
+			// Iterate all keyframes for this node
+			for (TiXmlElement* pKeyframeElem = animElem->FirstChildElement();
+					pKeyframeElem != 0; pKeyframeElem = pKeyframeElem->NextSiblingElement())
+			{
+				float fTime=StringConverter::parseReal(pKeyframeElem->Attribute("time"));
+				TransformKeyFrame *pKeyFrame = pTrack->createNodeKeyFrame(fTime);
+
+				// Position
+				TiXmlElement* posElem = pKeyframeElem->FirstChildElement("position");
+				if(posElem)
+				{
+					Vector3 trans;			
+					trans.x = StringConverter::parseReal(posElem->Attribute("x"));
+					trans.y = StringConverter::parseReal(posElem->Attribute("y"));
+					trans.z = StringConverter::parseReal(posElem->Attribute("z"));				
+					pKeyFrame->setTranslate(trans);
+				}
+
+				// Rotation
+				TiXmlElement* rotElem = pKeyframeElem->FirstChildElement("rotation");
+				if(rotElem)
+				{		
+					Quaternion qRot;
+					qRot.x = StringConverter::parseReal(rotElem->Attribute("x"));
+					qRot.y = StringConverter::parseReal(rotElem->Attribute("y"));
+					qRot.z = StringConverter::parseReal(rotElem->Attribute("z"));		
+					qRot.w = StringConverter::parseReal(rotElem->Attribute("w"));		
+					pKeyFrame->setRotation(qRot);
+				}
+				
+				// Scale
+				TiXmlElement* scaleElem = pKeyframeElem->FirstChildElement("scale");
+				if(scaleElem)
+				{
+					Vector3 scale;
+					scale.x = StringConverter::parseReal(scaleElem->Attribute("x"));
+					scale.y = StringConverter::parseReal(scaleElem->Attribute("y"));
+					scale.z = StringConverter::parseReal(scaleElem->Attribute("z"));				
+					pKeyFrame->setScale(scale);
+				}
+			}		
+		}
+	}
+
+	return pNode;
+}
+
+// Set Scene Properties
+void OSMScene::setSceneProperties(TiXmlElement* sceneProp) {
+	assert(sceneProp);
+
+	// Scene manager
+	TiXmlElement* sceneMgrElem = sceneProp->FirstChildElement("sceneManager");
+	int type = Ogre::StringConverter::parseInt(sceneMgrElem->Attribute("type"));
+	Ogre::SceneType sceneType = static_cast<Ogre::SceneType>(1 << (type - 1));
+	mSceneMgr = Ogre::Root::getSingleton().createSceneManager(sceneType);
+	assert(mSceneMgr);
+
+	const char* worldGeometry = sceneMgrElem->Attribute("worldGeometry");
+	if(worldGeometry != NULL)
+		mSceneMgr->setWorldGeometry(worldGeometry);
+
+	// Background Color
+	TiXmlElement* colorElem = sceneProp->FirstChildElement("bkgcolor");
+	if(colorElem && mWindow)
+	{	
+		Ogre::ColourValue color;
+		color.r = StringConverter::parseReal(colorElem->Attribute("r"));
+		color.g = StringConverter::parseReal(colorElem->Attribute("g"));
+		color.b = StringConverter::parseReal(colorElem->Attribute("b"));
+		
+		mWindow->getViewport(0)->setBackgroundColour(color);
+	}
+
+	// Ambient light Color
+	colorElem = sceneProp->FirstChildElement("lightColor");
+	if(colorElem)
+	{	
+		Ogre::ColourValue color;
+		color.r = StringConverter::parseReal(colorElem->Attribute("r"));
+		color.g = StringConverter::parseReal(colorElem->Attribute("g"));
+		color.b = StringConverter::parseReal(colorElem->Attribute("b"));
+
+		mSceneMgr->setAmbientLight(color);
+	}
+
+	// Scene shadows
+	TiXmlElement* shadowsElem = sceneProp->FirstChildElement("shadowTechnique");
+	if(shadowsElem)
+	{
+		int type = Ogre::StringConverter::parseInt(shadowsElem->Attribute("type"));
+		Ogre::ShadowTechnique shadowType = static_cast<Ogre::ShadowTechnique>(type);
+
+		mSceneMgr->setShadowTechnique(shadowType);
+
+		int tex_size = Ogre::StringConverter::parseInt(shadowsElem->Attribute("tex_size"));
+		int tex_count = Ogre::StringConverter::parseInt(shadowsElem->Attribute("tex_count"));
+
+		mSceneMgr->setShadowTextureSettings(tex_size, tex_count);
+
+		// Shadow Color
+		TiXmlElement* colorElem = shadowsElem->FirstChildElement("color");
+		if(colorElem)
+		{	
+			Ogre::ColourValue color;
+			color.r = StringConverter::parseReal(colorElem->Attribute("r"));
+			color.g = StringConverter::parseReal(colorElem->Attribute("g"));
+			color.b = StringConverter::parseReal(colorElem->Attribute("b"));
+			
+			mSceneMgr->setShadowColour(color);
+		}
+	}	
+
+	// Scene sky
+	TiXmlElement* skyElem = sceneProp->FirstChildElement("skyTechnique");
+	if(skyElem)
+	{
+		int type = Ogre::StringConverter::parseInt(skyElem->Attribute("type"));
+		Ogre::String materialName = skyElem->Attribute("material");
+		
+		if(materialName != " ") {
+			bool drawFirst = Ogre::StringConverter::parseBool(skyElem->Attribute("drawFirst"));
+			float tiling = Ogre::StringConverter::parseReal(skyElem->Attribute("tiling"));
+			float scale = Ogre::StringConverter::parseReal(skyElem->Attribute("scale"));
+			float dist = Ogre::StringConverter::parseReal(skyElem->Attribute("dist"));
+			float bow = Ogre::StringConverter::parseReal(skyElem->Attribute("bow"));
+			int xSegments = Ogre::StringConverter::parseInt(skyElem->Attribute("xSegments"));
+			int ySegments = Ogre::StringConverter::parseInt(skyElem->Attribute("ySegments"));
+			Ogre::Quaternion quat(Ogre::Quaternion::IDENTITY);
+			Ogre::Plane plane;
+			plane.d = dist;
+			plane.normal = -(Ogre::Vector3::UNIT_Y);			
+
+			switch(type) {
+
+			case SCENE_SKYPLANE:
+
+				mSceneMgr->setSkyPlane(true, plane, materialName, scale, 
+									   tiling, drawFirst, bow, xSegments, ySegments);
+
+				mSceneMgr->setSkyBox(false, "");
+				mSceneMgr->setSkyDome(false, "");
+
+				break;
+
+			case SCENE_SKYBOX:
+
+				mSceneMgr->setSkyBox(true, materialName, dist, drawFirst, quat);
+				mSceneMgr->setSkyPlane(false, plane, "");
+				mSceneMgr->setSkyDome(false, "");
+
+				break;
+
+			case SCENE_SKYDOME:
+
+				mSceneMgr->setSkyDome(true, materialName, bow, tiling, dist,
+									  drawFirst, quat, xSegments, ySegments);
+
+				mSceneMgr->setSkyPlane(false, plane, "");
+				mSceneMgr->setSkyBox(false, "");
+
+				break;
+				
+			}
+		}
+	}
+
+}
+
+// Create all entities in scene
+void OSMScene::createEntities(TiXmlElement* pEntityNode, Ogre::SceneNode* pSceneRoot)
+{
+	// Iterate all meshes, creating them. 
+	for (TiXmlElement* pMeshElem = pEntityNode->FirstChildElement();
+            pMeshElem != 0; pMeshElem = pMeshElem->NextSiblingElement())
+	{
+		// Ogre could cast an exception, in which case we just try to 
+		// continue reading the other meshes
+		try 
+		{
+			const char *pszName = pMeshElem->Attribute("name");
+			const char *pszFileName = pMeshElem->Attribute("filename");			
+
+			// try to create the mesh
+			Entity *pEntity = mSceneMgr->createEntity(pszName, pszFileName);			
+			if(pEntity==0) continue;
+
+			// Check if the object should cast shadows
+			const char *pszCastShadows=pMeshElem->Attribute("CastShadows");
+			if(pszCastShadows && stricmp(pszCastShadows, "no")==0)
+				pEntity->setCastShadows(false);	
+			else
+				pEntity->setCastShadows(true);	
+
+			// Create node with full information
+			SceneNode *pObjNode=createNode(pMeshElem, pSceneRoot);
+
+			// Attach the mesh entity to node
+			pObjNode->attachObject(pEntity);
+
+			// Notify
+			if(mCallbacks)
+				mCallbacks->OnEntityCreate(pEntity, pMeshElem);
+
+			// Add to entity list
+			mEntities.push_back(pEntity);
+		} catch(...)
+		{
+			continue;
+		}			
+	}	
+}
+
+// Create all Lights in scene
+void OSMScene::createLights(TiXmlElement* pLightNode, Ogre::SceneNode* pSceneRoot)
+{
+	// Iterate all Lights, creating them. We do not attach them yet, since
+	// we need to make sure all potential parent entities have been created.
+	for (TiXmlElement* pLightElem = pLightNode->FirstChildElement();
+            pLightElem != 0; pLightElem = pLightElem->NextSiblingElement())
+	{
+		// Ogre could cast an exception, in which case we just try to 
+		// continue reading the other Lights
+		try 
+		{
+			const char *pszName = pLightElem->Attribute("name");
+
+			Light *pLight = mSceneMgr->createLight(pszName);
+			if(pLight==0) continue;
+
+			// Figure out which type of light we are using
+			const char *pszType = pLightElem->Attribute("type");
+			if(stricmp(pszType, "omni")==0)
+			{
+				pLight->setType(Light::LT_POINT);
+			} else if(stricmp(pszType, "spot")==0)
+			{	
+				pLight->setType(Light::LT_SPOTLIGHT);
+				pLight->setSpotlightRange(
+						Degree(StringConverter::parseReal(pLightElem->Attribute("hotspot"))),
+						Degree(StringConverter::parseReal(pLightElem->Attribute("falloff"))));
+				pLight->setDirection(0,0,-1);
+
+			}  else if(stricmp(pszType, "directional")==0)
+			{
+				pLight->setType(Light::LT_DIRECTIONAL);
+			}
+
+			// Check if the light should be on
+			const char *pszOn = pLightElem->Attribute("on");
+			if(pszOn!=0 && stricmp(pszOn, "true")==0)
+				pLight->setVisible(true);
+			else
+				pLight->setVisible(false);
+
+			// Check if the object should cast shadows
+			const char *pszCastShadows = pLightElem->Attribute("CastShadows");
+			if(pszCastShadows && stricmp(pszCastShadows, "no")==0)
+				pLight->setCastShadows(false);	
+			else
+				pLight->setCastShadows(true);	
+
+			// Diffuse Color
+			TiXmlElement* colorElem = pLightElem->FirstChildElement("color");
+			if(colorElem)
+			{					
+				pLight->setDiffuseColour(
+					StringConverter::parseReal(colorElem->Attribute("r")),
+					StringConverter::parseReal(colorElem->Attribute("g")),
+					StringConverter::parseReal(colorElem->Attribute("b")));
+			}
+
+			// Specular Color
+			TiXmlElement* specularElem = pLightElem->FirstChildElement("specular");
+			if(specularElem)
+			{						
+				pLight->setSpecularColour(
+					StringConverter::parseReal(specularElem->Attribute("r")),
+					StringConverter::parseReal(specularElem->Attribute("g")),
+					StringConverter::parseReal(specularElem->Attribute("b")));
+			}
+
+			// Attenuation
+			TiXmlElement* attenElem = pLightElem->FirstChildElement("attenuation");
+			if(attenElem) {
+				pLight->setAttenuation(
+					StringConverter::parseReal(attenElem->Attribute("range")),
+					StringConverter::parseReal(attenElem->Attribute("constant")),
+					StringConverter::parseReal(attenElem->Attribute("linear")),
+					StringConverter::parseReal(attenElem->Attribute("quadratic")));
+			}
+			
+			// Create node with full information
+			SceneNode *pLightNode=createNode(pLightElem, pSceneRoot);
+
+			// Attach the Light entity to node
+			pLightNode->attachObject(pLight);
+
+			// Target
+			TiXmlElement* targetElem=pLightElem->FirstChildElement("target");
+			if(targetElem)
+			{	
+				// Create node with full information
+				SceneNode *pTargetNode=createNode(targetElem, pSceneRoot);
+				pLightNode->setAutoTracking(true, pTargetNode);
+			}		
+
+			// Notify
+			if(mCallbacks)
+				mCallbacks->OnLightCreate(pLight, pLightElem);
+
+			// Add to light list
+			mLights.push_back(pLight);
+		} catch(...)
+		{
+			continue;
+		}			
+	}	
+}
+
+// Create all Cameras in scene
+void OSMScene::createCameras(TiXmlElement* pCameraNode, Ogre::SceneNode* pSceneRoot)
+{
+	// Iterate all Cameras, creating them. We do not attach them yet, since
+	// we need to make sure all potential parent entities have been created.
+	for (TiXmlElement* pCameraElem = pCameraNode->FirstChildElement();
+            pCameraElem != 0; pCameraElem = pCameraElem->NextSiblingElement())
+	{
+		// Ogre could cast an exception, in which case we just try to 
+		// continue reading the other Cameras
+		try 
+		{
+			const char *pszName = pCameraElem->Attribute("name");
+
+			// Create camera
+			Camera *pCamera=mSceneMgr->createCamera(pszName);
+			if(pCamera==0) continue;
+
+			// Set Field of View on camera
+			pCamera->setFOVy(Radian(StringConverter::parseReal(pCameraElem->Attribute("FOV"))));			
+			pCamera->setNearClipDistance(5);			
+
+			// Create node with full information
+			SceneNode *pCameraNode=createNode(pCameraElem, pSceneRoot);
+
+			// Attach the Camera entity to node
+			pCameraNode->attachObject(pCamera);
+
+			// Target
+			TiXmlElement* targetElem=pCameraElem->FirstChildElement("target");
+			if(targetElem)
+			{	
+				// Create node with full information
+				SceneNode *pTargetNode=createNode(targetElem, pSceneRoot);
+				pCameraNode->setAutoTracking(true, pTargetNode);
+			}
+
+			// Notify
+			if(mCallbacks)
+				mCallbacks->OnCameraCreate(pCamera, pCameraElem);
+
+			// Add to camera list
+			mCameras.push_back(pCamera);
+		} catch(...)
+		{
+			continue;
+		}			
+	}	
+}
