Read XML wich different tags

Hi,

My automatation are read many XML files. There is some tags can change. The exemple are below.

case 1:

case 2:

case 3:

in that 3 cases i want the get that value in “orig” but the way change.

this is my expression
currentXElement.Element(“imposto”).Element(“ICMS”).Element(“ICMS40”).Element(“orig”).Value

my doubt is:

how to make an expression to take any situation ICMS40, ICMS00, ICMS61? (there may be more variations, always ICMSXX)

there are many options to have a more open retrieval like:

YourXDocumentVar.Root.Descendants("orig").First().Value

or

currentXElement.Element("imposto").Element("ICMS").Elements().First().Element("orig").Value

or

currentXElement.Element("imposto").XPathSelectElement("//ICMS/*/orig").Value

thx ppr. There expression below work well
currentXElement.Element(“imposto”).Element(“ICMS”).Elements().First().Element(“orig”).Value

@Felipe_Moura
Perfect so the topic can be closed by

1 Like

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