homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / XML Development
Forum Library, Charter, Moderators: httpwebwitch

XML Development Forum

Problem with ASP > RSS Feed
Have an RSS feed that validates, but doesn't display from browser

 1:49 pm on Aug 20, 2004 (gmt 0)


I recently made an XML feed of our product inventory in an ASP page. It takes our main database and outputs an RSS feed.

It (mostly) validates on the major services. It can be parsed by XML readers. However, if I type in the url ( www .example.com/inventory.asp ) directly in my browser, it does not display as a normal XML file should.

I say 'mostly' validates as one of the validation services says something about changing the MIME type on my IIS server. I'd rather just change the document header, if that is the issue, to an IIS-compatible XML document type.


[edited by: tedster at 5:43 pm (utc) on Aug. 30, 2004]
[edit reason] use example.com [/edit]



 1:28 pm on Aug 21, 2004 (gmt 0)

Yeah, you need to send the MIME-TYPE in the HTTP header.

I suggest the general XML mime: "text/xml"

I think RSS has its own type, but for compatibilty reasons I use the standard XML mime-type.


 1:37 pm on Aug 21, 2004 (gmt 0)

So, is this an IIS tweak or is it simply a matter of putting the correct lines at the top of my file?

I currently have this:

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE rss PUBLIC "-//Netscape Communications//DTD RSS 0.91//EN" "http://my.netscape.com/publish/formats/rss-0.91.dtd">
<rss version="0.91">


 1:53 pm on Aug 21, 2004 (gmt 0)

Just try putting:

Response.ContentType = "text/xml"

At the top of your ASP code, or somewhere before the HTTP headers are sent.


 2:08 pm on Aug 21, 2004 (gmt 0)

I tried every combination I could think of with that, still no luck, the ASP file just outputs the data as raw text.

How can the standards be so screwed up?! If i'm understanding this right, microsoft basically doesn't support XML? What is going on..


 2:16 pm on Aug 21, 2004 (gmt 0)

One more thing, I thought to look at this url in netscape, and it displays an error message:

XML Parsing Error: xml processing instruction not at start of external entity
Location: [example.com...]
Line Number 2, Column 1:<?xml version="1.0" encoding="iso-8859-1"?>

What would that indicate to you?

[edited by: tedster at 5:42 pm (utc) on Aug. 30, 2004]
[edit reason] use example.com [/edit]


 2:19 pm on Aug 21, 2004 (gmt 0)

Response.ContentType = "text/xml"
%><?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE rss PUBLIC "-//Netscape Communications//DTD RSS 0.91//EN" "http://my.netscape.com/publish/formats/rss-0.91.dtd">
<rss version="0.91">
<title>Flyerstarter.com - Main Inventory Channel</title>
<description>Nightclub flyer photos, designs and typefaces.</description>


set conn = server.createobject("adodb.connection")
DSNtemp="DRIVER={Microsoft Access Driver (*.mdb)}; "
DSNtemp=dsntemp & "DBQ=" & server.mappath("/mydatabase.mdb")
conn.Open DSNtemp
sqlstmt = "SELECT tables FROM query ORDER BY table DESC;"
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open sqlstmt, DSNtemp, 3, 3

while not rs.eof
if x<15 then
strdescrip = rs("descrip")
finaldescrip = Replace(StripSymbols(strdescrip), "&", "&amp;")
response.write "<item>"
response.write "<title>"& rs("itemname") &"</title>"
response.write "<link>http://www.example.com/default.asp?pg=products&amp;specific="&("ITEMID"))&"</link>"
response.write "<description>"&finaldescrip&"</description>"
response.write "</item>"
end if
set rs = nothing
set Conn = nothing


Does the above not work?

[edited by: tedster at 5:44 pm (utc) on Aug. 30, 2004]


 2:39 pm on Aug 21, 2004 (gmt 0)

You are da man. Thank you very much, works like a charm.


 2:40 pm on Aug 21, 2004 (gmt 0)

Out of curiosity, what code did you use?


 2:52 pm on Aug 21, 2004 (gmt 0)

Well, changing the header text to what you showed worked.

I had two other problems though;

a) For some reason, if I just did an F5 refresh, it wasn't reloading the changes I made. It would only show updates if I exited the browser and entered the URL again! Very frustrating, I probably had it entered right in the first place..

b) I had whitespace in front of the opening <title> etc. tags. This seemed to screw things up royally.

So, what you posted in the last message is a functional way to do it. I still get the impression as an XML/RSS rookie that this whole topic is a can of worms, there seems to be no real standardization..


 3:06 pm on Aug 21, 2004 (gmt 0)

Ok thats cool :).

XML is well standardised, but yeah... there are some issues with RSS and its variants.


 12:18 pm on Sep 26, 2004 (gmt 0)


I'm trying to make an RSS feed in ASP.NET on an IIS Server. I keep getting the error message "XML parsing error". I've included the DTD tag and set the content type to "text/xml" and the reponse encoding to "iso-8859-1".

I don't think its a problem with my code as I got the same error when I uploaded the XML code from a RSS feed that works to my IIS webspace.

I had a similar problem when I tried to put WML pages on an IIS server, but this was solved by changing the content type.

Are there any settings that need to be changed to allow XML pages to be hosted on an IIS server?

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / XML Development
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved