creating an rss.xml file dynamically has issues

A

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
 
M

Mike Brind

Astra said:
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
 
A

Astra

Many thanks Mike

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
 

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,769
Messages
2,569,581
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top