UiPath Error - XML Activities


I’m having problems using the UiPath Web Activities package, when using XML activities.

I downloaded an example of the UiPath documentation, from this link:

I imported into the environment where I am developing and executed. I got the same error I was having with the activities I had created myself.

I read the XML file, deserialize a string for an XDocument. When displaying only the XDocument variable, it shows all the XML. When I’m going to filter to get the elements, for example:

xmlDoc is my variable XDocument,

xmlDoc.Element (“emit”). Element (“CNPJ”). Value the image error occurs.

When I run the image process, which is the example of the UiPath itself, the same error occurs.

Please, could someone help me solve this problem?


Is the element you’re looking for in the XMLfiles.txt? I think the error occurs because it does not exist in the XMLfiles.txt. Thus, null value is returned. I downloaded the activity from UiPath and ran it - it works well. But when I changed the element to something I know does not exist in the XMLfiles.txt, I encountered the same error: “Object reference not set to an instance of the object”

1 Like

Good Morning

Yes, I did the correct test now and it worked. The problem is in the XML that I need to work on. For some reason I can’t get the tag’s values from this XML. Here is a piece of it:

I did the same logic as the UiPath sample XML and it wasn’t the same error.

Hi Octavio,

I think you have to include several for loops to get the tags under . I tried to use the XML you provided; I was getting the null error as well when I try to get the value of .

What I did was I added the following loops inside the initial loop in UiPath sample XAML:

Loop IEnumerable “node.document.DescendantNodes()”
If item.name.localname = “ide”, assign item.Descendants to variable then break
Else //do nothing
End Loop

Loop IEnumerable “item.Descendants”
If item.name.localname = “cNF”, assign item.value.toString to variable
End Loop

Your XML has namespaces. thats why you get no returns in case you only use the local name for retrieval. Fortunately you will find some working examples for this type of XML here in forum ( do also a further search by your own)

and much more

1 Like