This project has moved and is read-only. For the latest updates, please go here.

How to serialize a custom RSSDocument object?

Topics: Developer Forum, User Forum
Jul 1, 2007 at 4:56 AM
I am trying to serialize a custom RSSDocument object that was created using the RssDl tool. This custom RSSDocument object suports Yahoo Media extensions. i.e. <media:credit>James</media:credit>. However when I serialize this object, the RSS feed outputs the content in the following format: <credit xmlns="">James</credit>.

My question is how do I alter the custom RSSDocument object to serialize the object with the following format: <media:credit>James</media:credit>.

Thanks in advance,

Jul 18, 2007 at 1:31 AM
I'm after the same thing but for georss extensions. Any ideas on a workaround or fix for the problem?
Aug 16, 2007 at 10:45 PM
I'm seeking the same thing as luke. Need the resulting feed to keep the namespace, ie: for GeoRSS... <geo:lat>37.4</geo:lat> instead of <lat>37.4</lat>
Aug 22, 2007 at 6:54 PM
I would love to find a solution to this as well for GeoRSS.
Jan 11, 2008 at 12:43 AM
I'd also love a soultion to the GeoRSS issue!
Jan 12, 2008 at 11:11 AM
For thoose that are interested I have made a work around for the GeoRSS issue...

Below is the .rss file content that goes in the app_code folder...

<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:geo="" xmlns:georss="">
<ppoint>43.127697 -77.573776</ppoint>
<description>HTMl Encoded Description</description>
<ppoint>43.127697 -77.573776</ppoint>

Now after you have done the normal building of your data in the ashx place this at the bottom of the fucntion.

Dim str As String = Rss.ToDataSet.GetXml()
Context.Response.ContentType = "application/rss+xml"
str = str.Replace(" xmlns=""""", "")

str = str.Replace("BeAQuoteHere", """)
str = str.Replace("Point>", "geo:Point>")
str = str.Replace("ppoint>", "georss:point>")
str = str.Replace("long>", "geo:long>")
str = str.Replace("lat>", "geo:lat>")
str = str.Replace("rss version=""2.0""", "rss version=""2.0"" " & vbCrLf & "xmlns:geo="""" " & vbCrLf & " xmlns:georss=""""")
Context.Response.Write("<?xml version=""1.0"" encoding=""utf-8""?>" & vbCrLf)

I know this isn't a pretty work around, put I just hacked it together in 20 mins and it works.
Mar 10, 2008 at 1:04 AM
Just put this in your custom RSSDocument object, it will change <point xmlns="">10 10</point> to <georss:point>10 10</point>. It has noting to do with the RSSToolkit, it is just how XmlSerializer works.

public XmlSerializerNamespaces Namespaces