since i included some code to read the level filename from an xml file,
the program crashes with a segfault before it's done with the xml-read loop!
after looking through my code a million times and finding nothing that would
cause this(i think), i tried running the tutorial.9(meshviewer),
which also uses the xml reader, and it does the same thing!
is the xml-reader broken for linux?
do i need to change something? whatsup?
xml reader
workaround?
I have created a workaround to the issue by forcing the xml read loop to end after a number ov iterations.
Simple method:
int i;
i=0;
while(xml && xml->read() and i<255)
{
i++;
I am going to try a more complex method - including an end tag in the xml file, and set a break variable when the program reads that tag.
complex method :
while(xml && xml->read() and Is_Set_breakXML!="set")
{
//read xml file,
if (core::stringw("breakXML") == xml->getNodeName())
{
Is_Set_breakXML="set";
}
}
Simple method:
int i;
i=0;
while(xml && xml->read() and i<255)
{
i++;
I am going to try a more complex method - including an end tag in the xml file, and set a break variable when the program reads that tag.
complex method :
while(xml && xml->read() and Is_Set_breakXML!="set")
{
//read xml file,
if (core::stringw("breakXML") == xml->getNodeName())
{
Is_Set_breakXML="set";
}
}
Core2Duo E8400 3.0ghz - 2048mb DDR2 800 - geForce 9600 - Slackware12.1
Word-image-symbol programming limits, controls, and imprisons the individual.
Smash the control images, smash the control machine.
Word-image-symbol programming limits, controls, and imprisons the individual.
Smash the control images, smash the control machine.
...
it works fine. I just tried the second method using this code from tyn's 2080 demo:
// here is XML
<?xml version="1.0"?>
<level X="40" Y="40" tileset="DeadPlanet">
<addClutter TileX="18" TileY="10" Level="0" SubMat="0" Type="1" />
<addCharacter Faction="1" PosX="33" PosY="34" Move="10" Time="60" />
<changeTileTexture TileX="6" TileY="6" Level="0" SubMat="4" />
<endXMLread/>
</level>
// here is c++
CString foo;
while(xml && xml->read() and foo!="set")
{
switch(xml->getNodeType())
{
case io::EXN_ELEMENT:
{
if (core::stringw("endXMLread") == xml->getNodeName())
{
foo="set";
}
...
}
}
}
// here is XML
<?xml version="1.0"?>
<level X="40" Y="40" tileset="DeadPlanet">
<addClutter TileX="18" TileY="10" Level="0" SubMat="0" Type="1" />
<addCharacter Faction="1" PosX="33" PosY="34" Move="10" Time="60" />
<changeTileTexture TileX="6" TileY="6" Level="0" SubMat="4" />
<endXMLread/>
</level>
// here is c++
CString foo;
while(xml && xml->read() and foo!="set")
{
switch(xml->getNodeType())
{
case io::EXN_ELEMENT:
{
if (core::stringw("endXMLread") == xml->getNodeName())
{
foo="set";
}
...
}
}
}
Last edited by xhrit on Tue Jul 13, 2004 12:57 am, edited 2 times in total.
Core2Duo E8400 3.0ghz - 2048mb DDR2 800 - geForce 9600 - Slackware12.1
Word-image-symbol programming limits, controls, and imprisons the individual.
Smash the control images, smash the control machine.
Word-image-symbol programming limits, controls, and imprisons the individual.
Smash the control images, smash the control machine.