From a DLL I'm getting this XML string (not file):
<?xml version="1.0" encoding="UTF-8"?>
<SerRes RequestID="1" RequestType="GetStatus" OverallResult="ConnectionError">
</SerRes>
what I want to have is the values of RequestID
, OverallResult
.
dim ID as string = ... (will be 1)
dim Result as string = ... (will be ConnectionError)
I've tried this, but I'm getting an error that some characters aren't correct.
Dim Result as string
Dim ID as string
Dim sr As New System.IO.StringReader(XMLString)
Dim doc As New Xml.XmlDocument
doc.Load(sr)
Dim reader As New Xml.XmlNodeReader(doc)
While reader.Read()
Select Case reader.NodeType
Case Xml.XmlNodeType.Element
If reader.Name = "SerRes" Then
Result = reader.GetAttribute("OverallResult")
ID = reader.GetAttribute("RequestID")
End If
End Select
End While
I get the following error on the line doc.Load(sr)
An unhandled exception of type 'System.ArgumentException' occurred in mscorlib.dll
Additional information: Illegal characters in path.
It looks like VB chooses .Load(String)
instead of .Load(Stream)
for some reason.
Can someone see the problem?