chromatinpt
October 23rd, 2009, 07:51 AM
Hello!
I have a xml file with a specific data node like this:
<settings>mean</settings>
<out class="cell" size="[1,2]">
<tr>
<td class="numeric" size="[0,0]" />
<td class="numeric" size="[17,1]">
1.46590270801;
1.47197105847;
1.44441393964;
(more values...)
</td
</tr>
</out>
<pred class="cell" size="[1,2]">
<tr>
<td class="numeric" size="[0,0]" />
<td class="numeric" size="[17,1]">
110.401;
1.474;
(more values...)
</td>
</tr>
</pred>
Using this code:
Código: [Seleccione]
String xmlString = textBox4.Text;
XmlTextReader reader = new XmlTextReader(new System.IO.StringReader(xmlString));
while (reader.Read())
{
XmlNodeType nodeType = reader.NodeType;
if (nodeType == XmlNodeType.Element)
{
switch (reader.Name)
{
case "out":
textBox5.Text = reader.ReadString();
break;
}
}
}
If I ask for the values of out the textBox5 is empty, but if I ask for the "settings" value node I obtain the correct result -> "mean".
How can I obtain the values from out, and only the first one 1.46590270801; ?
Regards
I have a xml file with a specific data node like this:
<settings>mean</settings>
<out class="cell" size="[1,2]">
<tr>
<td class="numeric" size="[0,0]" />
<td class="numeric" size="[17,1]">
1.46590270801;
1.47197105847;
1.44441393964;
(more values...)
</td
</tr>
</out>
<pred class="cell" size="[1,2]">
<tr>
<td class="numeric" size="[0,0]" />
<td class="numeric" size="[17,1]">
110.401;
1.474;
(more values...)
</td>
</tr>
</pred>
Using this code:
Código: [Seleccione]
String xmlString = textBox4.Text;
XmlTextReader reader = new XmlTextReader(new System.IO.StringReader(xmlString));
while (reader.Read())
{
XmlNodeType nodeType = reader.NodeType;
if (nodeType == XmlNodeType.Element)
{
switch (reader.Name)
{
case "out":
textBox5.Text = reader.ReadString();
break;
}
}
}
If I ask for the values of out the textBox5 is empty, but if I ask for the "settings" value node I obtain the correct result -> "mean".
How can I obtain the values from out, and only the first one 1.46590270801; ?
Regards