A
Alberto
I'm trying to read a xml file who is like this:
<frase>
<nodo>
<x>10</x>
<y>20</y>
<text>aaa</text>
</nodo>
<nodo>
<x>50</x>
<y>60</y>
<text>bbb</text>
</nodo>
</frase>
I'd like to read the values of every "nodo" in order to create a class with
the values "x", "y" and "text" but I don't know how to do it. The code I
have now is this. I really appreciate that you tell me how to change it to
read the values. I suppose that I have to write a loop to read the values of
every value. Thank you very much.
FileStream fs = new FileStream(fileName, FileMode.Open);
XmlTextReader tr = new XmlTextReader(fs);
while(!tr.EOF)
{
if (tr.MoveToContent() == XmlNodeType.Element)
....
else
tr.Read();
}
<frase>
<nodo>
<x>10</x>
<y>20</y>
<text>aaa</text>
</nodo>
<nodo>
<x>50</x>
<y>60</y>
<text>bbb</text>
</nodo>
</frase>
I'd like to read the values of every "nodo" in order to create a class with
the values "x", "y" and "text" but I don't know how to do it. The code I
have now is this. I really appreciate that you tell me how to change it to
read the values. I suppose that I have to write a loop to read the values of
every value. Thank you very much.
FileStream fs = new FileStream(fileName, FileMode.Open);
XmlTextReader tr = new XmlTextReader(fs);
while(!tr.EOF)
{
if (tr.MoveToContent() == XmlNodeType.Element)
....
else
tr.Read();
}