Home All Groups Group Topic Archive Search About

creating an rss.xml file dynamically has issues



Author
6 Mar 2006 2:25 PM
Astra
Hi All

Creating an rss.xml file dynamically via ASP/ADO/DB, but find errors in the
file.

Don't think it's an ASP prob to be honest.  Think its more to do with the
fact that the ampersands are accepted in the file.  Do I take it that you
have to 'escape' all non alphanumeric chars to produce a valid file?

I thought xml files were supposed to eradicate the usual invalid char
problems that tab-delimited and csvs used to have?

Any ideas?

Thanks

Robbie

Author
6 Mar 2006 3:01 PM
Mike Brind
Astra wrote:
Show quote
> Hi All
>
> Creating an rss.xml file dynamically via ASP/ADO/DB, but find errors in the
> file.
>
> Don't think it's an ASP prob to be honest.  Think its more to do with the
> fact that the ampersands are accepted in the file.  Do I take it that you
> have to 'escape' all non alphanumeric chars to produce a valid file?
>
> I thought xml files were supposed to eradicate the usual invalid char
> problems that tab-delimited and csvs used to have?
>
> Any ideas?
>
> Thanks
>
> Robbie

No - you don't have to escape all non-alphanumeric characters, just the
ones that have special meaning in xml.

Try this function for cleaning your strings up prior to outputting them
to your rss.xml file:

function tidyxml(text)
  text = replace(text,Chr(180),"'")
  text = replace(text,"&","&")
  text = replace(text,"'","'")
  text = replace(text,"'","'")
  text = replace(text,""","""")
  text = replace(text,""","""")
  text = replace(text,"-","-")
  text = replace(text,"<","&lt;")
  text = replace(text,">","&gt;")
  tidyxml = text
End function

--
Mike Brind
Author
6 Mar 2006 5:16 PM
Astra
Many thanks Mike

"Mike Brind" <paxton***@hotmail.com> wrote in message
news:1141657272.611399.295250@j52g2000cwj.googlegroups.com...

Astra wrote:
Show quote
> Hi All
>
> Creating an rss.xml file dynamically via ASP/ADO/DB, but find errors in
> the
> file.
>
> Don't think it's an ASP prob to be honest.  Think its more to do with the
> fact that the ampersands are accepted in the file.  Do I take it that you
> have to 'escape' all non alphanumeric chars to produce a valid file?
>
> I thought xml files were supposed to eradicate the usual invalid char
> problems that tab-delimited and csvs used to have?
>
> Any ideas?
>
> Thanks
>
> Robbie

No - you don't have to escape all non-alphanumeric characters, just the
ones that have special meaning in xml.

Try this function for cleaning your strings up prior to outputting them
to your rss.xml file:

function tidyxml(text)
  text = replace(text,Chr(180),"'")
  text = replace(text,"&","&amp;")
  text = replace(text,"'","'")
  text = replace(text,"'","'")
  text = replace(text,""","""")
  text = replace(text,""","""")
  text = replace(text,"-","-")
  text = replace(text,"<","&lt;")
  text = replace(text,">","&gt;")
  tidyxml = text
End function

--
Mike Brind

AddThis Social Bookmark Button