xml from a string and parse (Full Version)

All Forums >> [Ask XML questions here] >> .NET programming discussions



Message


jackburton200839 -> xml from a string and parse (17 April 2008)

VS 2005
VB
.NET

Hi everyone,

I am writing a mobile app in vb that returns stock data in xml format from a web service. This works fine if I want the raw xml text all in one textbox but it returns it all in raw xml format. I want to parse the xml so that each item is on a separate line. I cant get it to work.

I would be grateful if you could have a look for me .

The error that I am getting is :

invalid URI : the uri scheme is not valid

Many Thanks,

JB
Imports System.Xml
Imports System.Text.RegularExpressions
Imports System.IO
Imports System.Net



Public Class Form1

Dim ws As New stock.StockQuote

Dim wsdoc As New XmlDocument
Dim wsurl As String


Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
TextBox1.Focus()


End Sub


Public Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

'DownloadFeeds()
'Try
ws.Url = "http://www.webservicex.net/stockquote.asmx"
wsurl = ws.GetQuote(TextBox1.Text)

Dim wsRequest As Net.WebRequest = WebRequest.Create(wsurl)
'save the response daqta into a stream object by adding the below code
Dim wsresponse As System.Net.WebResponse = wsRequest.GetResponse()
Dim wsstream As System.IO.Stream = wsresponse.GetResponseStream()
'load the data stream into a XML document
wsdoc.Load(wsurl)
Dim nodes As System.Xml.XmlNodeList
nodes = wsdoc.SelectNodes("/StockQuotes/Stock")
'display the content in the elements
TextBox2.Text = nodes.Item(0).SelectSingleNode("Symbol").InnerText
TextBox3.Text = wsdoc.SelectSingleNode("StockQuotes/Stock/Last").InnerText
TextBox4.Text = wsdoc.SelectSingleNode("StockQuotes/Stock/Date").InnerText
TextBox5.Text = wsdoc.SelectSingleNode("StockQuotes/Stock/Time").InnerText
TextBox6.Text = wsdoc.SelectSingleNode("StockQuotes/Stock/Change").InnerText
TextBox7.Text = wsdoc.SelectSingleNode("StockQuotes/Stock/Open").InnerText
TextBox8.Text = wsdoc.SelectSingleNode("StockQuotes/Stock/AnnRange").InnerText
TextBox9.Text = wsdoc.SelectSingleNode("StockQuotes/Stock/Earns").InnerText
TextBox10.Text = wsdoc.SelectSingleNode("StockQuotes/Stock/P-E").InnerText
TextBox11.Text = wsdoc.SelectSingleNode("StockQuotes/Stock/Name").InnerText




End Sub




End Class




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.109375