I have a piece of code that updates my rss feed only it puts each new entry at the bottom of the file instead of the top.
How might I correct this?
How might I correct this?
PHP:
If checkbox1.Checked = True Then
Dim XMLd As New XmlDocument
XMLd.Load("D:\Hosting\xxx\html\App_data\sitemap.xml")
Dim ns As String = XMLd.DocumentElement.NamespaceURI
Dim xmlEl As XmlElement = XMLd.CreateElement("URL", ns)
xmlEl.InnerXml = "<loc></loc><lastmod></lastmod><changefreq></changefreq><priority></priority>"
xmlEl.Item("loc").InnerText = "http://www.xxx.com/blogview.aspx?blogno=" + System.Convert.ToString(newblog)
xmlEl.Item("lastmod").InnerText = "now()"
xmlEl.Item("changefreq").InnerText = "weekly"
xmlEl.Item("priority").InnerText = "0.8"
XMLd.DocumentElement.AppendChild(xmlEl)
XMLd.Save("D:\Hosting\xxx\html\App_data\sitemap.xml")
Dim xDoc As XDocument = XDocument.Load("D:\Hosting\xxx\html\feed\rss-feed.xml")
Dim xItem As New XElement("item")
Dim xTitle As New XElement("title", e.Command.Parameters("@title").Value)
Dim xPub As New XElement("pubDate", Now.ToUniversalTime())
Dim xLink As New XElement("link", "http://www.xxx.com/blogview.aspx?blogno=" + System.Convert.ToString(newblog))
Dim xDesc As New XElement("description", e.Command.Parameters("@post").Value)
'Lets insert the nodes in reverse case
xItem.Add(xTitle)
'Add the child node in the Item node
xItem.Add(xPub)
xItem.Add(xLink)
xItem.Add(xDesc)
'Add the item Node in Channel node
xDoc.Root.Element("channel").Add(xItem)
xDoc.Save("D:\Hosting\xxx\html\feed\rss-feed.xml")
End If