har kommit så långt, men får inte tag på price.... :S
Kod:
string sStock;
string sPrice;
XmlDocument doc = new XmlDocument();
doc.Load(MapPath("../XML/stockandprice.xml"));
XmlNodeList nodes = doc.DocumentElement.SelectNodes("/database/DELTACO.SE/data/items/item");
foreach (XmlNode node in nodes)
{
string sProductID = node.Attributes["id"].Value;
//book.author = node.SelectSingleNode("author").InnerText;
foreach (XmlNode subNode in node)
{
if (subNode.Name == "stock")
{
sStock = subNode.Attributes["quantity"].Value;
}
else
{
XmlNodeList nodes2 = doc.DocumentElement.SelectNodes("/database/DELTACO.SE/data/items/item/price");
foreach (XmlNode subNode2 in nodes2)
{
sPrice = subNode2.Attributes["price"].Value;
}
}
}
}