XDocument variable does not have XPathSelectElement option

When we create a variable of type XDocument to load a xml file, and then use the variable to define XPathSelectElement we get error saying XPathSelectElement is not defined in XDocument.

for example
Assign:
Xdoc = System.Xml.Linq.XDocument.Load(“C:\test.xml”)

Assign
Xdoc.XPathSelectElement results in error.

Found the solution:

It is because the XPathSelectElement is an extention to the XDocument. In order to be able to use the XPathSelectElement, we had to import System.Xml.XPath library in imports in UiPath Studio project.
image

image

5 Likes