Visa ett inlägg
Oläst 2013-11-22, 14:23 #3
naak2803 naak2803 är inte uppkopplad
Mycket flitig postare
 
Reg.datum: Jun 2011
Inlägg: 767
naak2803 naak2803 är inte uppkopplad
Mycket flitig postare
 
Reg.datum: Jun 2011
Inlägg: 767
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;
                    }

                }
            }
        }
naak2803 är inte uppkopplad   Svara med citatSvara med citat