The XML data is invalid. A tag Valuedoes not have valid matching closing tags, and tags Itemdo not have matching closing tags ( </Item>).
As for your XPath, try including the data you want to match in quotes:
const string xmlString =
@"<Items>
<Item>
<Code>Test</Code>
<Value>Test</Value>
</Item>
<Item>
<Code>MyCode</Code>
<Value>MyValue</Value>
</Item>
<Item>
<Code>AnotherItem</Code>
<Value>Another value</Value>
</Item>
</Items>";
var doc = new XmlDocument();
doc.LoadXml(xmlString);
XmlElement element = (XmlElement)doc.SelectSingleNode("Items/Item[Code='MyCode']/Value");
Console.WriteLine(element.InnerText);
source
share