FAQ Database Discussion Community

XPath query to select nodes

I have the following XML: <?xml version="1.0" encoding="utf-8"?> <Persons> <Person> <PersonID>6352</PersonID> <Forename>Tristan</Forename> </Person> <Person> <PersonID>6353</PersonID> <Forename>Ruth</Forename> </Person> <Person> <PersonID>6913</PersonID> <Forename>Mina</Forename> <Surname>Asif</Surname> </Person> <Person> <PersonID>6914</PersonID>...

remove nodes listed into XmlNodeList from XML file

I have a problem with my XML file. <?xml version="1.0" encoding="UTF-8"?> <config> <settings> <excelFilePath>C:\Temp\</excelFilePath> <mailHost>smtp</mailHost> <mailPort>25</mailPort> <mailFrom>[email protected]</mailFrom> <keepInCopy> <mailCC>[email protected]</mailCC> <mailCC>[email protected]</mailCC> <mailCC>[email protected]</mailCC> </keepInCopy> <mailSubject>My Mail subject</mailSubject>...

Convert contents of an XmlNodeList to a new XmlDocument without looping

I have Xml that I filter using XPath (a query similar to this): XmlNodeList allItems = xDoc.SelectNodes("//Person[not(PersonID = following::Person/PersonID)]"); This filters all duplicates from my original Persons Xml. I want to create a new XmlDocument instance from the XmlNodeList generated above. At the minute, the only way I can see...