Hi all I have attempted to write a simple xml reader but have found that it unintentionally skips every other element in the xml file.
Im guessing I am telling it to move onto the next element twice but I am unsure how whats happening or what the solution is.
any help will be greatly appreciated :)
here is a sample of the code and a sample of the xml file
public LevelLoader(string theLevelFile ,ContentManager theContent)
{
XmlTextReader reader = new XmlTextReader(theLevelFile);
while (reader.Read())
{
if (reader.NodeType == XmlNodeType.Element)
{
switch (reader.Name)
{
case "tilerow":
{
currentRow = currentRow + 1;
Console.WriteLine("row found");
currentCol = 0;
break;
}
case "tilecol":
{
Console.WriteLine("col found");
currentTexture = reader.ReadElementContentAsFloat();
currentCol = currentCol + 1;
break;
}
}
}
}
}
sample xml
<tilerow>
<tilecol>1</tilecol><tilecol>2</tilecol><tilecol>3</tilecol><tilecol>4</tilecol><tilecol>5</tilecol><tilecol>6</tilecol><tilecol>7</tilecol><tilecol>8</tilecol><tilecol>9</tilecol><tilecol>10</tilecol>
</tilerow>