NightShadow
New Member
I have an XML reader like below. I would like to have some filtering options but I don't know how to handle it. In my XML file there is category child and I would like to make a filter to choose only one category.XML Sample: \[code\]<product><title>XXXX</title><category>Fashion</category><image>.....</image><link>.....</link></product><product><title>YYYY</title><category>Fashion</category><image>.....</image><link>.....</link></product><product><title>AAAA</title><category>Sports</category><image>.....</image><link>.....</link></product></products>\[/code\]I have an XML like this and I want to show Fashion category. Here below you can see the reader code:\[code\] @using System.Xml.XPath; @using System.Xml; @{ //Fetch RSS XML XmlTextReader udBrudRSS = new XmlTextReader("http://myblog.com/rss"); //Create new XML document XmlDocument doc = new XmlDocument(); //Load in our remote XML into our XML document doc.Load(udBrudRSS); //Select our nodes we want with some xPath XmlNodeList rssItems = doc.SelectNodes("//product"); } <ul> @{ //For each item node we can then ouput what we want foreach (XmlNode node in rssItems) { <li> <a href="http://stackoverflow.com/questions/14537032/@node["link"].InnerText">@node["title"].InnerText</a> </li> } } </ul>\[/code\]I would appreciate any help and suggestions.Best,