I've been trying to play around with reading in an XML file that would look something like this into a 2D array with no luck:
I want to go through this XML document and put the data into a 2D array.
So if the program went through it correctly there would be two 2D arrays of ints of size 2x2 with the number under img"#'. This would be similar to:
I've been reading many tutorials on using C#'s System.Xml to handle an XML file similar to this with no luck. Anyone else know how to do this, I thought it sounded simple but it has not been for me.
Any help will be appreciated.
Code:
<?xml version="1.0" ?> <map index="0" name="Test" cellsx="2" cellsy="2" cellwidth="16" cellheight="16"> <layers> <layer index="0" name="TopLayer" visible="1"> <cell x="0" y="0" img="24" /> <cell x="1" y="0" img="56" /> <cell x="0" y="1" img="23" /> <cell x="1" y="1" img="76" /> </layer> <layer index="1" name="BottomLayer" visible="1"> <cell x="0" y="0" img="3" /> <cell x="1" y="0" img="3" /> <cell x="0" y="1" img="4" /> <cell x="1" y="1" img="4" /> </layer> </layers> </map>
So if the program went through it correctly there would be two 2D arrays of ints of size 2x2 with the number under img"#'. This would be similar to:
Code:
int [,] TopLayer = {
{24,56},
{23,76}
};
Any help will be appreciated.
Comment