468,257 Members | 1,431 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,257 developers. It's quick & easy.

Strange error

Hello,

I am trying to a load a RSS with some really simple
code. However when I run the code I got this error:

'', hexadecimal value 0x1F, is an invalid character. Line
1, position 1.

Though the rss seems to me well formed. Here is the code
and the rss.

TestRSS("http://www-
106.ibm.com/developerworks/news/dw_webservices.rss")

Function TestRSS(ByVal strRSS As String)
Dim reader As New XmlTextReader(strRSS)
' Load the XmlTextReader to the XmlDocument
Dim xmlDoc As New XmlDocument
Try
xmlDoc.Load(reader)
Catch ex As Exception
Response.Write("ERR in Rss File:" & strRSS
& "<br>")
Response.Write("Err: RSS File:" & ex.Message
& "<br>")
Response.Write("Exiting function
ReadPosts:<br>")
Exit Function
End Try

' load only the item nodes
Dim nodes As XmlNodeList = xmlDoc.SelectNodes
("/rss/channel/item")

' Now we have all posts
For Each node As XmlNode In nodes
Try

Response.Write(node("title").InnerXml
& "<br>")
Catch ex As Exception
Response.Write("ERR in loading nodes: " &
ex.Message() & "<br>")
End Try
Next
End Function

Many thanks
Nov 12 '05 #1
1 2992
Vishal wrote:
'', hexadecimal value 0x1F, is an invalid character. Line 1, position 1.Though the rss seems to me well formed.


If a document has is character value of 0x1F, then it is impossible for the
document to be well-formed XML. From the XML specification [1] here are the
valid character ranges:

Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] |
[#x10000-#x10FFFF]

That omits #x1F, so it's not XML.

Cheers,
Stuart Celarier, Fern Creek

[1] http://www.w3.org/TR/2004/REC-xml-20040204/#charsets
Nov 12 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

25 posts views Thread by Neil Ginsberg | last post: by
reply views Thread by Kris Vanherck | last post: by
6 posts views Thread by Gary | last post: by
5 posts views Thread by Nathan Sokalski | last post: by
reply views Thread by ivb | last post: by
11 posts views Thread by Martin Joergensen | last post: by
1 post views Thread by JoReiners | last post: by
11 posts views Thread by Mike C# | last post: by
3 posts views Thread by Shelly | last post: by
reply views Thread by kermitthefrogpy | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.