参考代码
Dim dlg As new OpenFileDialog
If dlg.ShowDialog = DialogResult.OK Then
Dim txt As String = FileSys.ReadAllText(dlg.FileName, Encoding.Default)
Dim idx1 As Integer = txt.IndexOf("<Events")
Dim idx2 As Integer = txt.IndexOf("</Events>")
Dim s As String = txt.SubString(idx1, idx2-idx1+9)
Dim xmlDoc As New System.XML.XmlDocument
xmlDoc.Loadxml(s)
Dim ndList = xmlDoc.GetElementsByTagName("Code")
For i As Integer = 0 To ndList.count - 1
Dim curCode As String = ndList(i).Attributes("curCode").value
Dim packLayer As String = ndList(i).Attributes("packLayer").value
Dim flag As String = ndList(i).Attributes("flag").value
output.show(curCode & " " & packLayer & " " & flag)
Next
End If