Sub loadFile(ByVal
loc As String)
Try
Dim
sr As New
IO.StreamReader(loc)
Dim
xr As New
Xml.XmlTextReader(loc)
Dim
xd As New
XmlDocument
xd.Load(xr)
Dim
docs As Xml.XmlNodeList =
xd.GetElementsByTagName("document")
If
docs.Count = 1 Then
Dim
doc As Xml.XmlNode = docs.Item(0)
'doc.
Else
MessageBox.Show("can't open file because:" + Chr(13) +
Chr(10) + "the xml file stracture is
invalid", "Site Mennager - Can't
Open File", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
End If
Catch ex As Exception
MessageBox.Show("can't open file because:" + Chr(13) +
Chr(10) + ex.Message, "Site Mennager - Can't
Open File", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
End Try
End Sub |