Xml file reading and extracting some information from it

Hi All,

i am trying to readl xml file from folder and extract some information from it.

but while reading the file only i am getting error.

Read Text File: One or more errors occurred. (Could not find file ‘C:\Users\asus\OneDrive\Documents\UiPath\Mexico_XML_Extraction\C’.) (Could not find file ‘C:\Users\asus\OneDrive\Documents\UiPath\Mexico_XML_Extraction\C’.) (Could not find file ‘C:\Users\asus\OneDrive\Documents\UiPath\Mexico_XML_Extraction\C’.)


Check the current item value. It is correct filepath or not?

yes, it is correct

reported file looks not as a full FilePath for a XML file


Is the above Folder? if so, the first assign will be as the following.

FilePath = System.IO.Directory.GetFiles("‘C:\Users\asus\OneDrive\Documents\UiPath\Mexico_XML_Extraction","*.xml")

Note: FilePath is String array type.


i have not saved the file to that full file path intead i have saved in desktop.

and when i go to desktop and click on shift right click copy as path it gives me below path

“C:\Users\asus\OneDrive\Desktop\xml files”

you need to provide the full filepath Folderpath/filename + filetype extension

so also as mentioned by Yoichi when looping over the files contained in a directory, then use File / Directory related statements for getting the single file paths

[CheatSheet] - Filesystem APIs - News / Tutorials - UiPath Community Forum

ok, now it is reading all the files.

now i want to extract around 10 - 15 values from it.

when i open xml files using edge, it open like below.


how to traverse the elements and find suppose first value (fecha) i.e Date, and also position of each elements might change in each file of xml, i.e if fecha is in third line then it might be available on 4 or fifth line.

how to achieve it

you need to handle the XML Namespaces

we don’t see all details, but it could the case, that fecha is an attribute of the root element

give a try at: YourDeserializeXMLOutputVar.Attribute(“Fecha”).Value


Attribute function is not available

it looks like you a trying to do it with the text but not with returned output of DataType XDocument.

Feel free to share with us the XML file as text file

61C611AD-6505-4653-8493-590E59E39151@1000000000XX0.xml (5.0 KB)

pls extract below values

Buyer/ Entity - In Receptor: Nombre – find out - Nombre=“FRONTIER CAR GROUP MEXICO SA DE CV”
Invoice address Domicilio / expedido en:[Spanish] – not found
Vendor Name - In Emisor: Nombre - Nombre=“ANA KAREN HERNANDEZ PEREZ”
Supplier TAX ID (vendor vat) - In Emisor : Rfc - HEPA9012159B8
Invoice Number - Serie + Folio? -=“2369” Serie=“AK”
Invoice date - Fecha comprobante Fecha - 2022-06-17T14:57:40
PO number - Su pedido - n2022-06-17T14:57:40 not found
Invoice total - Total – Total=”1173.92”

i tried to find out the first value

xmlstring.Descendants(xDefaultValues + “Emisor Nombre”)
GetDescendants { [<cfdi:Emisor Nombre=“CFE SUMINISTRADOR DE SERVICIOS BASICOS” RegimenFiscal=“601” Rfc=“CSS160330CP7”/>] }
xmlstring.Descendants(xDefaultValues + “Emisor Nombre”).First().Value

but this gives me error

Hi All,

below error

for this code

trying to find below


kindly help

handle the namespace as described above in the link. do not use the prefix from the namespace within the name as the : is causing the issue

YourXNameSpaceVar + “YourXMLElementLocalName” is to use


error - Assign: The ‘:’ character, hexadecimal value 0x3A, cannot be included in a name.

as mentioned
do not use :

as told removed “:”



  • Just reread the attached links
  • do not mix up Elements and Attribute

You can do the explorations by using the immediate panel (as shown in the screenshots) more quick

Understanding the 6 Debugging Panels of UiPath in the easiest way possible! - News / Tutorials - UiPath Community Forum

Is it done? Can the topic be closed?
Forum FAQ - How to mark a post as a solution - News / Tutorials - UiPath Community Forum