Новичок ищет помощь по получению ответа xml http в vb.net
это то, что я собираюсь сделать, получить эти атрибуты values(Red,Green,Yellow,Black)
в 4 различных текстовых полях на vb.net project.
спасибо
<system ver="1.0">
<colors>
<type red="Red" green="Green" yellow="Yellow" Black="Black" />
</colors>
</system>
Вот то, что я до сих пор пробовал разными способами, но всегда заканчивал тем, что стирал его. :(
Sub GetData()
Dim request As System.Net.HttpWebRequest = System.Net.HttpWebRequest.Create("target url")
request.Credentials = New System.Net.NetworkCredential("user", "pass")
Dim response As System.Net.HttpWebResponse = request.GetResponse()
If response.StatusCode = System.Net.HttpStatusCode.OK Then
Dim stream As Stream = response.GetResponseStream()
' Create a reader for the stream object
Dim reader As New StreamReader(stream)
' Read from the stream object using the reader, put the contents in a string
Dim contents As String = reader.ReadToEnd()
' Create a new, empty XML document
Dim HttpResult As New XmlDocument
Dim UserInfo As XmlNodeList
Dim Discription As XmlNode
HttpResult = New XmlDocument
HttpResult.LoadXml(contents)
'Create the XML Document
HttpResult = New XmlDocument()
Dim _XPath As String =
UserInfo = HttpResult.SelectNodes("")
'Get the Gender Attribute Value
Dim DetailsAttribute = Discription.Attributes.GetNamedItem("").Value
endif
End Sub