I'm pretty new in using XML, can someone help me find a way to load data from an XML file to a hashtable. I need it in a hashtable because i need to have a key value pair. The reason i also have two items per value is i need to do a rotation everythime a user goes to my site it will rotate the image. I've never done this before and not sure if it's possible. I'm using asp.net in C#
I also can't use the .net adrotator because I don't want the image to change when the user refreshes the page that's why I choose to do the hash table. That way i can set it so that when the user is inside cake.aspx, i can grab the data from the hashtable that belongs under the items that have the "cake" value.
XML:located inside App_Data(cake.xml)
<cakeshop><items value="cake"> <item> <image>cake1.gif</image> <link>cake.aspx</link></item> <item> <image>cake2.gif</image> <link>cake2.aspx</link></item></items>
<items value="donut"> <item> <image>donut1.gif</image> <link>donut.aspx</link></item> <item> <image>donut2.gif</image> <link>donut2.aspx</link></items></cakeshop>--------------------------------------------------------------------------------------------------code is located inside the App_Code (cakerotate.cs)
public static void CakeRotate(){XMLDocument objGetCake = new XMLDocument();objGetCake.Load(HttpContext.Current.Server.MapPath("~/App_Data/cake.xml"));
if (null != objGetCake){ XMLNode objNode = (XmlNodeList objList in objGetCake) { //this is where I get stuck because I'm not sure how to load the XML Data inside the HashTable. }}
}
Any help would be much appreciated.Thanks in advance