How would I read XML data into an array? I have an XML sheet, and I want to read each of the values of a specific element into an array. So for each element in each data group I would have an array holding that data.
The idea is to be able to graph that data using the XML sheet, so that I dont have to keep recalculating the values everytime I want to graph.
Heres the XML code that Ive been trying to work with:
<MyData>
<Gap>0.05</Gap>
<Diameter>200.00</Diameter>
<R2>2.54</R2>
<VentDiamater>97.39999</VentDiamater>
<R1>1.236979873</R1>
<Height>0.00127</Height>
</MyData>
<MyData>
<Gap>0.05</Gap>
<Diameter>12.00</Diameter>
<R2>0.1524</R2>
<VentDiamater>5.844</VentDiamater>
<R1>0.0742188</R1>
<Height>0.00127</Height>
</MyData>
<MyData>
<Gap>0.02</Gap>
<Diameter>12.00</Diameter>
<R2>0.1524</R2>
<VentDiamater>5.844</VentDiamater>
<R1>0.0742188</R1>
<Height>0.000508</Height>
</MyData>
and the code:
While reader.Read()
Select Case reader.NodeType
Case XmlNodeType.Element
' Keep track of the element that the user is on.
s = reader.Name
Case XmlNodeType.Text
If s.Equals("Gap") Then
Dim i As Integer = 0
'Save the reader Value into an array with length i
myItem(i) = reader.Value
MsgBox(myItem(i))
i += 1
End If
End Select
End While
So if you want to understand exactly what Im asking, I want an array to hold the values of Gap (theres 3 of them here), and then another array to hold the values of diameter, and so on.