I'm working on an assignment for school to create an online store. There is a page where the admin can update the item inventory and/or put items on sale. Every time an item is put on sale or taken off from sale, a function is called to update the RSS feed with the latest sale items.
Here is the RSS XML structure:
<?xml version="1.0"?>
<rss version="2.0">
<channel>
<title>Project2 RSS Feed</title>
<language>en-us</language>
<link>http://people.rit.edu/~cns3946/539/project2/project2.rss</link>
<description>Project 2 RSS Feed</description>
<item>
<title>Far Cry 3</title>
<link>http://people.rit.edu/cns3946/539/project2/index.php?item_num=3</link>
<description>
<![CDATA[a boring description goes here....]]></description>
<price>59.99</price>
<salePrice>49.99</salePrice>
<pubDate>Sun, 03 Feb 2013 01:20:04 -0500</pubDate>
</item>
<item>
<title>Tales of the Abyss 3DS</title>
<link>http://people.rit.edu/cns3946/539/project2/index.php?item_num=13</link>
<description><![CDATA[a boring description goes here....]]></description>
<price>39.99</price>
<salePrice>29.99</salePrice>
<pubDate>Sun, 03 Feb 2013 01:20:04 -0500</pubDate>
</item>
<item>
<title>Resistance: Fall of Man</title>
<link>http://people.rit.edu/cns3946/539/project2/index.php?item_num=17</link>
<description><![CDATA[a boring description goes here....]]></description>
<price>19.99</price>
<salePrice>9.99</salePrice>
<pubDate>Sun, 03 Feb 2013 01:20:04 -0500</pubDate>
</item>
</channel>
</rss>
Every time the function is called, it appends to the file. I want to be able to remove all of the nodes and then append the new sale items to the file. I've tried using removeChild and couldn't figure it out. If you have any tips or pointers on how I can make this work, could you let me know? Any help would be appreciated.