How to read specific text in xml file that I attached file. How can I get version number in xml file?

How can I get version number in xml file? I tried read text file and deserialize however this methode got all text in xml file. Could you please help me for this topic?

Hi @Mrv_Vrl ,

Use Execute XPath activity
ExistingXML → xmlDeserialized
XPathExpression - > “string(/EcuDTCHandling/@version)”

Regards,
Arivu

Hi @arivu96,
I tried your first recommondation however I got an error.
code

Hi @Mrv_Vrl

Please find the attached overall project with sample xml

Hope its solves your issue
Xml usecase.zip (5.1 KB)
we need traverse according to xml file
kindly update us whether your issue resolved or not

Thanks,
Robin S

Hi @Mrv_Vrl ,

Can we do it in simple way without desearalizing.

Use invoke method below to convert the xml into dataset

image

inside properties create parameter with your XMLTextFilepath

Now use For each

For Each item in ds.tables

XMLTableName = item.tostring

inside use one more for each row data table assign item

use if condition XMLTableName = “EcuDTCHandling”

then → Version = row(“version”).tostring

Use break statement to end the loop.

Please try this different logic and let us know. thanks.

Hi @Mrv_Vrl ,
refer below screenshot.
Use Execute XPath activity
ExistingXML → xmlDeserialized
XPathExpression - > “string(/EcuDTCHandling/@version)”

xml

Regards,
Arivu

Hello @Robinnavinraj_S
Firstly thank you for your kindly help. I tried your recommondation however I got error again.

I couldnt able to understand your error
You have to give element function not attribute

@Mrv_Vrl
The XML IS defining namespaces which are to handle. But as WE are doing a retrieval from the root element WE can simplify IT.

Use deserialize Activity from the uipath.webapi.activities package
Output - xDoc

Assign Activity
Lhs: strVErsion |Datatype: String
Rhs:
XDoc.Root.Attribute("version").value