Hello,
ive started to experiment with using XML to load data in to my application. heres a short snippit from my xml sheet
Code:
<AnimationSet name="orc">
<Animation name="Move">
<Direction compasDir="North">
<spriteSheet>Content//Art//Sprite//orc_forward_north.png</spriteSheet>
<startFrame>0</startFrame>
<endFrame>9</endFrame>
</Direction>
Ive set up and xml reader, and ive got some simple if statements that check the name of the current element and then pull out the expected text or attribute.
this works fine for all nodes apart from the startFrame node which keeps getting read as a EndElement, so i cant read any data out of it. At first i thought it might have something to do with the slashes in the previous line, but it still happens that element has noral text in it. any ideas? heres my processing code.
Code:
while (reader.Read())
{
if (reader.NodeType == XmlNodeType.Element)
{
if (reader.Name == "AnimationSet")
{
//pull out data
}
else if (reader.Name == "Animation")
{
//pull out data
}
else if (reader.Name == "Direction")
{
//pull out data
}
else if (reader.Name == "spriteSheet")
{
spriteSheet = reader.ReadElementContentAsString();
}
else if (reader.Name == "startFrame")
{
startFrame = reader.ReadElementContentAsInt();
}
else if (reader.Name == "endFrame")
{
endFrame = reader.ReadElementContentAsInt();
}
}
}
its able to read endFrame no problem, why whould start frame be any different?
Thnaks for you help!