I've recently started using tinyXML. The problem is when I run my program to read through xml, it returns back an access violation. A common line is:
doc.FirstChildElement("Map")->FirstChildElement("Width")->GetText()
With the visual studio debugger, I determined that it is returning null for the 'Map', and then is using a null reference to call functions.
Here is the first lines of code, and the xml
XMLDocument doc;
doc.LoadFile(path.c_str());
int width = atoi(doc.FirstChildElement("Map")->FirstChildElement("Width")->GetText());
XML:
<?xml version="1.0"?>
<Master>
<Map>
<Width>5</Width>
<Height>5</Height>
<Layers>1</Layers>
<Tiles>
<Tile>
<Id>1</Id>
<Path>data/tiles/dirt-base.png</Path>
</Tile>
</Tiles>
<Data>
<DataLayer>1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1</DataLayer>
</Data>
</Map>
</Master>
IT is important to note, I originally did not have the root tag, but added it when it didn't work, adding it still didn't help though. Any help would be appreciated