I'm trying to get the list of errors into the error tag from this XML that I received by RestRequest but my variable xmlerrors (var xmlerrors) is always null:
<PositionOpeningResult xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://ns.hr-xml.org/2006-02-28">
  <PositionRecordInfo>
    <Ids />
  </PositionRecordInfo>
  <ProcessDate>2023-03-09T05:26:13</ProcessDate>
  <ProcessFeedBack>
    <InternetEmailAddress>info@mail.com</InternetEmailAddress>
  </ProcessFeedBack>
  <Warnings />
  <Errors>
    <Error>The element 'PositionDetail' in namespace 'http://ns.hr-xml.org/2006-02-28' has invalid child element 'PhysicalLocation' in namespace 'http://ns.hr-xml.org/2006-02-28'. List of possible elements expected: 'CompanyScale, IndustryCode' in namespace 'http://ns.hr-xml.org/2006-02-28'.</Error>
    <Error>The 'relationship' attribute is not declared.</Error>
  </Errors>
</PositionOpeningResult>
Here my function to get the error list and concat them to display then in a HTML view :
if (response.Content.Contains("Errors"))
{
    var xmlerrors = (from nm in xelement.Elements("Errors") select nm);
    foreach (XElement error in xmlerrors)
    {
        foreach (XElement suberror in error.Elements("Error"))
        {
            errors += suberror.ToString().Replace("<Error>", "<p>").Replace("</Error>", "</p>") + "\r\n";
        }
    }
    ProviderResponse.errors = errors;
}
What am I doing wrong ?
Thanks a lot for your help and feedback.
 
     
    