Code: Select all
<?xml version="1.0"?>
<attributes>
<int name="activeLevelNum" value="1" />
<int name="activeLevelProgress" value="2" />
</attributes>
Code: Select all
bool kx::LoadGame()
{
io::path fileName = fileOpenDialog->getFileName();
// current working directory is appropriate
IXMLReader* reader = fileSys->createXMLReader( fileSys->getFileBasename( fileName ));
if (!reader)
{
cout<< "\nError: couldn't create XML reader :(";
return false;
}
else
{
cout<< "\nparser format= "<< reader->getParserFormat(); // outputs 3 (ETF_UTF16_LE)
cout<< "\nsource format= "<< reader->getSourceFormat(); // outputs 3
while( reader->read() );
{
switch( reader->getNodeType() )
{
case io::EXN_ELEMENT_END:
cout<< "\nEnd reached";
break;
case io::EXN_ELEMENT:
if( core::stringw(L"attributes") == reader->getNodeName() )
{
// read attributes
io::IAttributes* attr = fileSys->createEmptyAttributes( driver );
attr->read( reader );
cout<< "\nactiveLevelNum= "<< attr->getAttributeAsInt( "activeLevelNum" );
attr->drop();
}
break;
default: break;
}
}
reader->drop();
return true;
}
}
What am I doing wrong?