here is an example from one of my programs where i read xml from a file and puts the data into an array. The xml contains a bunch of random phrases.
here's an example of what my Phrases.xml file looks like
<?xml version="1.0" encoding="utf-8"?>
<phrases>
<phrase>phrase 1</phrase>
<phrase>phrase 2</phrase>
<phrase>phrase 3</phrase>
<phrase>phrase 4</phrase>
</phrases>
Dim PhraseArray(500) As String
Dim MyXmlTextReader As New XmlTextReader("S:\ApplicationPool\CIMS Talker\Phrases.xml")
Dim i As Integer = 0
MyXmlTextReader.WhitespaceHandling = WhitespaceHandling.None
'initial read to get past xml declaration
MyXmlTextReader.Read()
While MyXmlTextReader.Read()
If MyXmlTextReader.Value.Length > 0 Then
PhraseArray(i) = MyXmlTextReader.Value
i = i + 1
End If
End While
MyXmlTextReader.Close()
much like using a sqldatareader, everytime you call .Read() it retrieves the next value.
btw import system.xml