0

I would like to find the value of errorCode node using XElement. Please advise.

<registration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <errorCode>201498</errorCode>
  <errorMessage>XML response de-serialization error.  Details: XML ??(1, 569)?????</errorMessage>
</registration>
bardiir
  • 14,556
  • 9
  • 41
  • 66

1 Answers1

0

You just need to load the xml into an XElement and call Element method to retrieve value

//Load from file location
var errFile = XElement.Load("C:\\YourFile.xml");

//Get Element value from xml
var errorCode = (string)_x.Element("errorCode");
Justin
  • 2,093
  • 1
  • 16
  • 13