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)
cake.aspx
cake2.aspx
donut.aspx
donut2.aspx
--------------------------------------------------------------------------------------------------
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
prashantPosted Jul 4, 2008, 4:49 AM
http://www.c-sharpcorner.com/UploadFile/mahesh/ReadWriteXMLTutMellli2111282005041517AM/ReadWriteXMLTutMellli21.aspx