BizTalk Utilities Xselerator XSLT IDE


Forum main page

Most active member

Login page
Register
Log out

Search page

View our event calendar
Add general event such as an upcoming software release or conference
View all birthdays

Public image gallery
Upload your images in your profile

Profile editing page
Subscription list page
Address book page

Member list page
View the most active member
User groups listing

Private message page

xml from a string and parse

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
  Printable Version
All Forums >> [Ask XML questions here] >> .NET programming discussions >> xml from a string and parse Page: [1]
Login
Message << Older Topic   Newer Topic >>
xml from a string and parse - 17 April 2008   
jackburton200839

 

Posts: 1
Score: 0
Joined: 17 April 2008
Status: offline
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
Post #: 1
Page:   [1]
All Forums >> [Ask XML questions here] >> .NET programming discussions >> xml from a string and parse Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts



Email TopXML

Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI

0.031