RSS feed and invalid characters`

D

Diffident

Hi All,

I have created an RSS feed reader. However, the feed that I am trying to
read has some invalid characters which my reader does not like. I have no
control on the RSS feed but I would like to be able to read the feed.

Is there a way I could handle these invalid characters and replace them with
something else in my reader?

Thanks for your suggestions!
 
M

Martin Honnen

Diffident said:
I have created an RSS feed reader. However, the feed that I am trying to
read has some invalid characters which my reader does not like. I have no
control on the RSS feed but I would like to be able to read the feed.

Is there a way I could handle these invalid characters and replace them with
something else in my reader?

RSS is supposed to be XML and XML has strict rules on well-formedness.
If you use an XML parser like XmlReader to parse RSS feeds and a feed is
not well-formed then the XmlReader will throw an XmlException and abort
parsing.
You would need to search the web for an error tolerant parser that does
not enforce XML well-formedness rules but generally that is not a good idea.
 
C

clintonG

Did you ever hear the old adage "pissing in the wind?"
That's what you are doing Diff. Give it up now is my best advice as you'll
be trying to write regular expressions for the rest of your life looking for
invalid characters in the files. Send the feed back to its source and tell
them it is garbage and point them to page(s) that explain how to do it
correctly. Unless you are Google or Microsoft and have two dozen people
writing code that can be assigned to build a regex library that will parse
every known ASCII character you are on what programmers call a Death March
(the title of a programming book discussing impossible or unrealistic
objectives).

<%= Clinton
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,190
Members
46,740
Latest member
AdolphBig6

Latest Threads

Top