I am trying to use a xml reader to read an url which holds an xml. I am getting an error saying that the strings are null
public void readEyeData()
{
XmlTextReader reader = new XmlTextReader(ExamInfo.eyeURL);
while (reader.Read() && !(reader.NodeType == XmlNodeType.EndElement && reader.Name == "point"))
{
if (reader.NodeType == XmlNodeType.Element)
{
switch (reader.Name)
{
case "point":
var xString = reader.GetAttribute("x");
var yString = reader.GetAttribute("y");
float x = Int32.Parse(xString);
float y = Int32.Parse(yString);
view.EyeMove(x, y);
break;
}
}
}
}
And this is a sample of the xml. Im not sure if I am using the reader properly
<studentMovements>
<eyeCoordinates>
<point>
<x>533</x>
<y>521</y>
<ts>522332022.281823</ts>
</point>
<point>
<x>538</x>
<y>521</y>
<ts>522332029.325239</ts>
</point>
<point>
<x>592</x>
<y>529</y>
<ts>522332058.340718</ts>
</point>
Please help thanks!