R
Rob Richardson
Greetings!
I am introducing myself to VB .Net by rewriting a stock market simulation
program that I developed in VB6. The original program uses MSHTML, the
DOMDocument class and the various IHTML types to parse the contents of a web
page that contains the market information for the stocks in the simulated
portfolio.
While it seems to be possible to use the same types within VB .Net, I have
gathered that there are hoops I'd have to jump through to get them to work
in the .Net world. Also, I'd like to learn the .Net way of doing things.
It seems that the way to parse data from a web page in .Net is XML.
So, I'm trying to use the XmlTextReader object. First, I'm trying just to
get it to pull data in from a page, and then I'll figure out how to parse
it. So, I'm using the following:
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) _
Handles Button2.Click
Dim myXmlReader As XmlTextReader = _
New XmlTextReader("c:\ClevelandRails\index.htm")
Do While myXmlReader.Read()
Console.WriteLine(myXmlReader.NodeType.ToString())
Loop
End Sub
When I click Button 2, I get an XmlException thrown, and in the "Additional
Information" space, it says "System Error". The call to myXmlReader.Read()
is highlighted. Can anybody tell me why?
By the way, if anybody cares to try this with the same file, it's the home
page of http://clevelandrails.railfan.net .
Thanks very much!
Rob
I am introducing myself to VB .Net by rewriting a stock market simulation
program that I developed in VB6. The original program uses MSHTML, the
DOMDocument class and the various IHTML types to parse the contents of a web
page that contains the market information for the stocks in the simulated
portfolio.
While it seems to be possible to use the same types within VB .Net, I have
gathered that there are hoops I'd have to jump through to get them to work
in the .Net world. Also, I'd like to learn the .Net way of doing things.
It seems that the way to parse data from a web page in .Net is XML.
So, I'm trying to use the XmlTextReader object. First, I'm trying just to
get it to pull data in from a page, and then I'll figure out how to parse
it. So, I'm using the following:
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) _
Handles Button2.Click
Dim myXmlReader As XmlTextReader = _
New XmlTextReader("c:\ClevelandRails\index.htm")
Do While myXmlReader.Read()
Console.WriteLine(myXmlReader.NodeType.ToString())
Loop
End Sub
When I click Button 2, I get an XmlException thrown, and in the "Additional
Information" space, it says "System Error". The call to myXmlReader.Read()
is highlighted. Can anybody tell me why?
By the way, if anybody cares to try this with the same file, it's the home
page of http://clevelandrails.railfan.net .
Thanks very much!
Rob