I'm trying to get an attribute from the XML but I'm getting an error:
Expression must evaluate to a node-test
I'm new to XPath.
XML file example:
<Message>
<Head>
<Sender Identifier="id" ref=""/>
</Head>
</Message>
Code:
XPathDocument xDoc = new XPathDocument("documentName.xml");
XPathNavigator nav = xDoc.CreateNavigator();
XPathNodeIterator xpathNode = nav.Select("/Message/Head/Sender/[@Identifier]");
//This is where I get the error.
And I'm also not sure how to display the attribute value.
{ }) on the editor toolbar to nicely format and syntax highlight it!