473,387 Members | 1,903 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Problems reading xml feed into XmlTextReader

hi,

I have a function which reads the xml from a web url into the
XmlTextReader, and then I work my way through the reader producing
html from the different nodes. All the code works fine when I debug
the project, but when I publish the project and run it on a live
server, I seem to be getting problems.

I get the error:

A connection attempt failed because the connected party did not
properly respond after a period of time, or established connection
failed because connected host has failed to respond

My code is as follows:

Dim strURL As String = "http://www.nme.com/clubnmerss"
Dim sb As New StringBuilder()
Dim reader As New XmlTextReader(strURL)
reader.MoveToContent()
Dim sString2 As String = ""
Dim hasEnteredGig As Integer = 0
While reader.Read()
If reader.Name = "venue" Then
hasEnteredGig = 1
sString = sString.Replace("##G##", sString2)
sString2 = ""
Venue = reader.ReadString()
sString += "<div class='gig-box'><img src='media/liv/
club-nme.gif' /><br /></div>"
sString += "<div class='gig'><div class='basic-
headline'><h1>CLUB NME</h1></div>##G##</div>"
sString2 += "<h2>" & Venue & "</h2>"
End If
If reader.Name = "address" Then
Address = reader.ReadString()
sString2 += "<h2>" & Address & "</h2>"
End If
If reader.Name = "url" Then
Url = reader.ReadString()
sString2 += "<h2>" & Url & "</h2>"
End If
If reader.Name = "gig" Then
Gig = reader.ReadString() & "<br />"
sString2 += "" & Gig & ""
hasEnteredGig = 0
End If
End While
If hasEnteredGig = 0 Then
sString = Left(sString, (sString.Length) - 148)
End If
'sString = sb.ToString()
reader.Close()

Like I say this works fine when debuging the project locally, but
fails online.

Hopefully someone can help :)

Sep 20 '07 #1
1 2447
TheDude5B wrote:
I have a function which reads the xml from a web url into the
XmlTextReader, and then I work my way through the reader producing
html from the different nodes. All the code works fine when I debug
the project, but when I publish the project and run it on a live
server, I seem to be getting problems.

I get the error:

A connection attempt failed because the connected party did not
properly respond after a period of time, or established connection
failed because connected host has failed to respond
I don't think it is a problem with your code using XmlTextReader, there
seems to be a network connection problem you will need to investigate.

--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Sep 20 '07 #2

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

Similar topics

5
by: Lawrence Oluyede | last post by:
I decided to rewrite a parser that I wrote with XmlTextReader cause I did have some problems with the pull model, but now I can't start coding it 'cause even the simplest XPath query doesn't work,...
4
by: Drew | last post by:
I'm reading in an XML file from the server using XmlTextReader in C# like so: XmlTextReader xr = new XmlTextReader(url); while(xr.Read()) { //parse the xml file here
0
by: Robert Björn | last post by:
I'm trying to process a MemoryStream of XML data, which at any point in time may have incomplete fragments (because data arrives from a socket). If I process data until XmlTextReader.Read()...
1
by: Emsi | last post by:
Hello, how can I read values of child nodes with the XmlTextReader? File format: <root> <items> <item> <field1>value1</field1> <field2>value2</field2>
5
by: Sergey Poberezovskiy | last post by:
Hi, I have an .xsd document (Inc_B.xsd) that "includes" two more from the same folder: <xs:include schemaLocation="Inc.xsd" /> <xs:include schemaLocation="Inc_A.xsd" /> They all have the same...
5
by: WebBuilder451 | last post by:
is there ant place where i can learn the basics of reading an rss feed and enumerating through the values? just want to start at the bottom, no frills. thanks -- thanks (as always) some day...
13
by: Rick | last post by:
The following code will enter an infinate loop when in ReadChars. I can only make it happen when reading a Stream and with this particular XML. If I use the ReadInnerXml call rather than my own...
13
by: Chet C | last post by:
I am trying to make a simple RSS reader using asp.net (VB) and am getting an error when I run the project locally (works fine after being published) Here is my basic code: Sub Page_Load(sender...
16
by: billsahiker | last post by:
I am researching for an upcoming c# .net 2.0 project that may require reading and writing xml files. I don't want to use xmltextreader/ xmltextwriter as I prefer to have lower level file access...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.