Hello everybody, I'm currently working on an integration of XML with a game engine and I'm stumbled upon a problem, I'm trying to expand TinyXML for the engine in which I'm creating a bunch of external functions to load the XML data. However, it seems my function to access a attributes value isn't working once I 'parse' or 'load' the file which I'm doing beforehand. My functions are below.
Function to load the XML before hand.
[code
//---------------------------------------------------
// Purpose:
//---------------------------------------------------
void ReadXMLWeaponDataFromFileForSlot( const char *szXMLWeaponName, TiXmlDocument Doc )
{
char sz;
Q_snprintf( sz, sizeof( sz ), GetFullPathToXMLFile( "weapons/%s.xml" ), szXMLWeaponName );
bool loadOkay = Doc.LoadFile( sz );
And when I'm calling all these together, this is how it looks, ( Perhaps a suggestion on how to make this better would be appreciated! )
TiXmlDocumentBLAHDOC;ReadXMLWeaponDataFromFileForSlot("weapon_pistol",BLAHDOC);Msg("This is the First Person attri value: %s",GetElementDoubleChildValue(BLAHDOC,"weapondata","geometry","firstperson"));
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello everybody, I'm currently working on an integration of XML with a game engine and I'm stumbled upon a problem, I'm trying to expand TinyXML for the engine in which I'm creating a bunch of external functions to load the XML data. However, it seems my function to access a attributes value isn't working once I 'parse' or 'load' the file which I'm doing beforehand. My functions are below.
Function to load the XML before hand.
[code
//---------------------------------------------------
// Purpose:
//---------------------------------------------------
void ReadXMLWeaponDataFromFileForSlot( const char *szXMLWeaponName, TiXmlDocument Doc )
{
char sz;
Q_snprintf( sz, sizeof( sz ), GetFullPathToXMLFile( "weapons/%s.xml" ), szXMLWeaponName );
bool loadOkay = Doc.LoadFile( sz );
if ( loadOkay )
ConColorMsg(Color( 196, 145 ,63 , 255 ), "Loaded Weapon Script %s\n", sz );
else
ConColorMsg(Color( 196, 145 ,63 , 255 ), "Error with XML! \n", Doc.ErrorDesc() );
}
This refuses to work with how I do it at the bottom! If I do separately it will work.
And when I'm calling all these together, this is how it looks, ( Perhaps a suggestion on how to make this better would be appreciated! )