Get values of attribute and descriptor from xml

new 1.xml (1.5 KB)

Hi team ,

I have attached the xml.

Please help me in extracting “CMP0767” which is the company id and
“EUR” which is the currency descriptor and “9783” which is the currency numeric code.I tried many ways but was not able to get the values.

Hi,

Hope the following sample helps you.

xns = "urn:com.workday.repoting_main"
xelmCompany = xdoc.Descendants(xns+"Company").Where(Function(x) x.Element(xns+"ID").Value="CMP0767").FirstOrDefault()
dict =xelmCompany.Element(xns+"Currency").Elements(xns+"ID").ToDictionary(Function(x) x.attributes(xns+"type").First.Value,Function(x) x.Value)

Sample20220817-3.zip (3.3 KB)

Regards,

1 Like

Hi Yoichi ,

It helps me in extracting currency descriptor and currency numeric code but not “CMP0767”.

I also want to extract the company id which is “CMP0767” in this case.
Can you help me in designing the code line for that ?

Thank you for the solution for the rest cases.It works fine :slight_smile:

Regards,
Gokul

Also I wanted the currency from the wd:Descriptor line not from the attribute “Currency_ID”.I have highlighted the one in the post above.

Regards,
Gokul

Hi @gokul1904 - Please check the attached workflow to extract the highlighted values as shown in the above screenshots

Example.zip (4.3 KB)

Note : You forgot to close the tags for wd:Report_Data, wd:Report_Entry, I did that change in that attached xml :slight_smile:

1 Like

Perfect! Thanks a lot Usha - It will be a learning curve for me too.
Appreciate it

Regards,
Gokul

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.