Reading all the tags of an XML and take them to excel


I am too new to UIPATH and I am trying to do an XML reading project and take a document in excel. so far he managed to get me to read some XML tags.

I have trouble reading some labels

example these:

<cbc:CompanyID schemeAgencyID=“195” schemeID=“0” schemeName=“31”>NIT PROVEEDOR</cbc:CompanyID>
<cbc:CompanyID schemeAgencyID=“195” schemeID=“0” schemeName=“31”>NIT CLIENTE</cbc:CompanyID>
cbc:DescriptionPRUEBA PRUEBA</cbc:Description>
<cbc:BaseQuantity unitCode=“94”>1</cbc:BaseQuantity>
7. Valor total de la operación
The other thing is that I cannot find for what reason that at a time when you are storing the information in excel it throws the following error:

Escribir celda: Mensaje de error original: Excepción de HRESULT: 0x800401A8

Lector.xaml (15.5 KB)

Data1.xml (32.1 KB)

Thank you

Ok telling you that you are dealing with namespace is obsolete :slight_smile:
I dont speak your language and have to do transfer to other european languages. It seems to me that excel is running active or in background and that this is blocking the write range. Just try to close / kill process Excel and try again

I understand that you understand another language, I will try to write as specific as possible.

I was reviewing the last thread you wrote me and to solve the excel problem I put the activity “ExcelCloseWorkbook” which apparently worked.

However, the data I have stored is not entirely what I need.

I made a list of the tags that I want to obtain but my question is: In what activity can I add the XML tags so that only this data reaches my excel?

tag values ​​i want to get:

<cbc:CompanyID schemeAgencyID="195" schemeID="0" schemeName="31"></cbc:CompanyID>
<cbc:CompanyID schemeAgencyID="195" schemeID="0" schemeName="31"></cbc:CompanyID>
<cbc:BaseQuantity unitCode="94"></cbc:BaseQuantity>
<cbc:UUID schemeID="1" schemeName="CUFE-SHA384"></cbc:UUID>

Lector.xaml (15.8 KB)

Document.xlsx (25.8 KB)


I do feel that a XPath Approach is better for the retrieval

Setting up a NamespaceManager with a Config Datatable:

for the default namespace with empty prefix “def” is assigne as prefix

the retrieval is configured as another datatable (could also be externalize into an excel)

I did also for a deeper nested element for demo purpose

After all preperation it is iterating over the retrieval config and retrieves the specfied values. et voila:

So this result can be used and preprocess (e.g. removing path column, dynamic reating another structure…)

I did it as a quick prototype for you and you can finalize.

Open the XML in Chrome or Firefox and activate the Webtools (F12)
with following you can easy get the Xpath: Kopieren means Copy:

Demo XAML here:
Lector_V2.xaml (16.7 KB)


I am trying to run the project, but from the first run I encounter the following problem:

“Log Message: Object reference not set as an instance of an object.”

I don’t know if the problem only occurs on my computer

I never share a demo xaml without running it sucessfully on my machine.
In such a case the standard procedure is:

  • Debugging
  • inspecting the value of xeXpat…Name variable. if the content is null finding out the root cause for this.

But you have not done any changes on the code base right?

The only change I made was to direct the “Read Text File” activity to my XML.

Now that the error is up, I am trying to change the label like this: xDoc.Root.XPathSelectElement (" cbc: CustomizationID ", NamespaceMGR)

But the error continues.

yes but never with spaces in name
Use “cbc:CustomizationID” for the name

Hi every one,
I’ve found this solution successful. However, I’d wish to know how to get data from this part? I have a similar XML.

Data such as Taxable amount currecncy ID, TaxAmount currency ID, If you notice, that is like a tag, I’m unsure.

Thanks in advance.

Just create a new topic for your case, so we can adress individually. Also provide us a clear description on the expected output and provide if possible some sample data. Thanks