I have this xml structure:
I need all elements from the elements "item" in the element "ORDERCFGSVALUE". Does anyone know what the correct LINQ query is?
I have tried these query:
Unfortunately I get no result.
This query works to get the items of element EXTENSIONIN:
The result should be:
Thank you in advance.
XMLstructure:
<?xml version="1.0" encoding="utf-8"?>
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
<asx:values>
<SALESORDER>
<EXTENSIONIN>
<item>
<CONFIRMATIONPRINTDATE />
<CUSTOMEROFFERNOTE />
<CUSTOMERREFERENCE />
</item>
</EXTENSIONIN>
<ORDERCFGSVALUE>
<item>
<CHARC>DRAWING_LANGUAGE_CRM</CHARC>
</item>
<item>
<CHARC>EOS_QUOT_ORD_TYPE</CHARC>
</item>
<item>
<CHARC>GRP_BRANCH_EFFICIENCY_FACTOR</CHARC>
</item>
</ORDERCFGSVALUE>
</SALESORDER>
</asx:values>
</asx:abap>
I have tried these query:
Tested queries::
items = from values in xdocument.Descendants("ORDERCFGSVALUE").Elements("item").Elements()
select values;
items = from values in xdocument.Descendants("ORDERCFGSVALUE").Descendants("item").Elements()
select values;
items = from values in xdocument.Descendants("ORDERCFGSVALUE").Descendants("CHARC")
select values;
Unfortunately I get no result.
This query works to get the items of element EXTENSIONIN:
Working query::
items = from values in xdocument.Descendants("EXTENSIONIN").Elements("item").FirstOrDefault().Elements()
select values;
The result should be:
Result:
<CHARC>DRAWING_LANGUAGE_CRM</CHARC>
<CHARC>EOS_QUOT_ORD_TYPE</CHARC>
<CHARC>GRP_BRANCH_EFFICIENCY_FACTOR</CHARC>
Thank you in advance.
Last edited by a moderator: