I want to filter my code based on id xmlelement value,based throught a QueryString, but it doesn’t seem to be working!!!
XmlDocument xdoc = new XmlDocument();
xdoc.Load(filepath);
XmlNode root = xdoc.DocumentElement;
XmlNode idNode = root.SelectSingleNode("/students/student/id");
if (idNode.Value == null){create a new xml node}
else if (idNode.Value != null) {update the xml element with the value of id)
i tried to explain it in question, here is the link…
If I understand you correctly, you want to add student element, if there is no student for specified id (and possibly add some data to student node). Here is Linq to xml solution: