473,480 Members | 1,943 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

System Error when using XmlTextReader

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
Nov 20 '05 #1
2 1103
Cor
Hi Rob,

That page is HTML, and also the path in your xmltextreader.

XML is original a dataformat that uses the same <tag> principes as HTML.

The difference is that XML has general speaking only data tags and HTML all
kind of tags.

You can access a HTML page in VB.net.

You need for that MSHTML, but it it terribible difficult to use, so be
awared.

http://msdn.microsoft.com/library/de...ng/hosting.asp

You also can download a webpage document and use that as a kind of raw data,
but that seems more easy but gives mostly a lot of problems if the document
is complex.

I hope it gives you some idea's

Cor

Nov 20 '05 #2
Cor,

Thanks for the reply. I'm surprised that .Net doesn't have something
updated for it, but if that's what I've got to use, that's not such a bad
thing, since I've already got working code that uses it.

Rob
Nov 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
2380
by: Bill Cohagan | last post by:
I'm writing a console app in c# and am encountering a strange problem. I'm trying to use redirection of the standard input stream to read input from a (xml) file. The following code snippet is from...
5
5443
by: Burton Roberts | last post by:
This is also posted in the security newsgroup. Sorry for cross-posting, but I'm desperate. I have a Winforms application in VB.NET with a SQL Server (MSDE) backend. In the root application...
1
17097
by: Martin Honnen | last post by:
With both .NET 1.0 and 1.1 I have found the following strange behaviour where System.Xml.XmlDocument.LoadXml doesn't throw an error when parsing a text node with a character reference to an invalid...
4
2574
by: Jesse Elve | last post by:
I am using an XmlValidatingReader which uses an XSD for xml validation. The code has been performing reliably for months. Yesterday it failed for the first time with the following exception: ...
0
1765
by: Juan Galdeano | last post by:
Hi, I'm working on an ONIX project and when I try to validate or read XML files C# gives me this exception: System.IndexOutOfRangeException at System.Xml.XmlScanner.ScanDtdContent() at...
1
6305
by: Sammy | last post by:
Can anyone please explain me the cause and resolution of this error. TIA Sammy Server Error in '/' Application. The device is not ready. Description: An unhandled exception occurred during...
0
1861
by: Ramon de Klein | last post by:
I try to serialize an exception using the SoapFormatter, but this is a little bit problematic. The MethodInfo tag of the serialized exception contains &x00 characters (ASCII 0x00) in its serialized...
1
5073
by: bilal.hamdan | last post by:
Hi, I' trying to read some RSS feeds and all works fine on the DEV machin. once it's at Magma i run into this error. Security Exception Description: The application attempted to perform an...
2
14356
by: job | last post by:
In a sharepoint setup using smartpart to load our user controls using enterprise blocks (data) we are getting some strange errors (logged to the event log). We dont get the error all the time. When...
0
7037
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
6904
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7034
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
6732
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
4768
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4472
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
1294
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
558
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
174
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.