Hi
I have a situation where I receive an XML (document) file from an external company. I need to filter the document to remove all data I am not interested in. The file is about 500KB but will be requested very often.
let say the following file:
<dvdlist>
<dvd>
<title>title 1</title>
<director>directory 2</director>
<price>1</price>
<location>
<city>denver</city>
</location>
</dvd>
<dvd>
<title>title 2</title>
<director>directory 2</director>
<price>2</price>
<location>
<city>london</city>
</location>
</dvd>
<dvd>
<title>title 3</title>
<director>directory 3</director>
<price>3</price>
<location>
<city>london</city>
</location>
</dvd>
</dvdlist>
What I need is simply filter the document based on the city = london in order to end up with this new XML document
<dvdlist>
<dvd>
<title>title 2</title>
<director>directory 2</director>
<price>2</price>
<location>
<city>london</city>
</location>
</dvd>
<dvd>
<title>title 3</title>
<director>directory 3</director>
<price>3</price>
<location>
<city>london</city>
</location>
</dvd>
</dvdlist>
I have tried the following
XmlDocument doc = new XmlDocument();
doc.Load(@"C:\Development\Website\dvds.xml");
XmlNode node = doc.SelectSingleNode("dvdlist/dvd/location/city[text()='london']");
Any help or links will appreciate
Thanks