
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "stdafx.h"
#include "fxsys.h"

// Constructor
CXML_Interface::CXML_Interface()
{	setDoc(NULL);
}

/*
* Delete Document
*/
void CXML_Interface::deleteDocument( void )
{	if(getDoc())
	{	delete getDoc();
		setDoc(NULL);
	}
}

/*
* Get Document Element
*/
TiXmlNode *CXML_Interface::getDocElem( void )
{	if(getDoc())
	{	return getDoc()->RootElement();
	}
	return NULL;
}

/*
* Parse
*/
bool CXML_Interface::Parse( string strXMLFile )
{	m_Document = new TiXmlDocument(strXMLFile.c_str());
	// Error
//	if(!getDoc()->LoadFile(strXMLFile.c_str()))
	if(!m_Document->LoadFile())
	{	string strError = "ERROR: Can't parse \"";
		strError.append(strXMLFile);
		strError.append("\"!\n");
		ConsolePrint(strError.c_str());
		return false;
	}
	return true;
}