Read XML String RRS feed

  • Question

  • User1076264835 posted

    Hi All,

    I using HttpWebRequest to request XML String from the URL.

    URLStr = "http://example.com/test/"
    Dim webRequest As HttpWebRequest = CType(HttpWebRequest.Create(URLStr), HttpWebRequest) Using response As HttpWebResponse = CType(webRequest.GetResponse(), HttpWebResponse) Dim dataStream As Stream = response.GetResponseStream() Dim reader As New StreamReader(dataStream) Dim status As String = reader.ReadToEnd() 'XML Result is assign to status variable. reader.Close() response.Close() dataStream.Close() End Using

    My problem is, how can I read the value for the each parameter in that XML String?

    <?xml version="1.0" encoding="UTF-8"?>
    Thursday, August 15, 2013 12:13 AM


  • User289622470 posted



       You can use following code to read throuh the xml string available in stream


       XmlTextReader xmlreader = null;

      xmlreader = new XmlTextReader (reader);

      while (xmlreader.Read())


    switch (xmlreader.NodeType)    


    case XmlNodeType.Element:

    // The node is an Element.            


    case XmlNodeType.Text:

    //Process text           


    case XmlNodeType. EndElement:

    //process end element







    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, August 15, 2013 12:38 AM