This is about UiPath.Web.Activities.
Situation 1: When Root element have the attribute and I want to access the element down below I am getting error: “Object reference not set to an instance of an object.”
In below example: xmlns=“somedata” in instruction element.
XMLFile.Element(“instruction”).Element(“header”).Element(“interchangeid”).Value this is giving error.
Situation 2: When I remove the attribute xmlns=“Somedata” from instruction. Then no error.
I need help on Situation 1, on how to fix the error.
I am using UiPath.Web.Activities 1.4.5
Please check the Repair option in the selector, UiPath will try tofigure it out on its own.
Also use the Open Ui Explorer to enhance your selector, you will se everything the UiPath can capture on the component.
Please let me know if it works
If you want to get an attribute for a component use the ‘Get Attribute’ component.
Give it a try and let me know
@William_Blech_Sister, I am trying to read from xml file on local folder.
This is the xml file I am trying to read
instruction_edi_problem_mini.xml (325 Bytes)
I am getting the same error you are, it appears that the desirialize XML appear working properly.
I will continue trying and get back to you latter.
it looks like your XML has defiend a namespace (somedata, but ensure the value somedata is accepted as a valid namespace or edit it accordingly) and therefore you cannot work with local name only.
test it with a log message and yourXDocVar.Root.Name.toString
Handling namespace have a look here:
Find some starter Help:
retrieving the two responseData elements
reading out an element with name and value
reading out an attribute with name and value
dynamic reading all leaf elements with name and value, adding this to a datatable
Find Xaml here:
pumrum.xaml (12.2 KB)
Let us know your feedback
@ppr. It took sometime to understand your code as I am new. But It works. Thanks a lot.
You are welcome, I did not get the solution but learn nothing new on this
I used. Thanks to
Xmlns = “somedata” (Type XNamespace)
XMLfiledata.- is my XDocument variable.
For the XML file in example below.
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.