Hi @manu ,
According to your xml file, is it caused by the missing node Order?
I made a test with a simple xml and I can get the values.
Here is my code example:
var xml = XElement.Load(@"C:\Users\Desktop\test.xml");
IEnumerable<XElement> de =from el in xml.Descendants("Header").Elements("EcommerceNotification").Elements("Order").Elements("OrderReferenceFields").Elements("ReferenceField") select el;
foreach (XElement el in de)
Console.WriteLine(el.Value);
And the following is my test.xml:
<?xml version="1.0" standalone="yes"?>
<Upsscs SchemaVersion="1.0" applicationVersion="1.0.">
<Header>
<EcommerceNotification type="OrderCreatedNotification">
<Order number="26875690">
<OrderReferenceFields>
<ReferenceField id="1">79787709</ReferenceField>
<ReferenceField id="2">936N5D4CPU</ReferenceField>
<ReferenceField id="3"/>
<ReferenceField id="4"/>
<ReferenceField id="5"/>
</OrderReferenceFields>
</Order>
</EcommerceNotification>
</Header>
</Upsscs>
Here is also a related thread you can refer to.
If the problem is still not resolved, please provide your code and xml file.
Best Regards,
Daniel Zhang
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
Hi @manu ,
The Descendants method is used to return a collection of the descendant elements for this document or element.
So it should start from Header element in my test.
More details please refer to this document.
And please pay attention to spelling and check your xml.
It is Upsscs instead of UPsscsc.
<Header></Header>
Best Regards,
Daniel Zhang