XML Extraction - Handling Namespaces (Tableau, Soap, OASIS types)

Hello lovely UIPathers :slight_smile:
I am hoping someone can guide me towards how I can extract the restAPIVersion from this deserialized XML:

Tried just about everything I can think of without success & grateful for any pointers.
Thank you!

@aidan.moore
Welcome to the forum

you may have to handle XML namespaces

Have a look here

Maybe you can share the XML as text with us

Going ahead
Serializing the XML - output: xDoc | DataType: XDocument:
grafik

Checking if we have to handle XML namespaces

We do have:
grafik

Checking for some children:
grafik

Defining Namespace Variable


:bulb: In some cases, we can also do: Assign Activity - xnsDefault = xDoc.Root.Name.Namespace

Checkin the retrieval
grafik

xDoc.Descendants(xnsDefault + "productVersion")
 GetDescendants { [<productVersion build="456" xmlns="http://tableau.com/api">123</productVersion>] }
 xDoc.Descendants(xnsDefault + "productVersion").First().Value
 "123"
 xDoc.Descendants(xnsDefault + "productVersion").First().Attribute("build").Value
 "456"
 xDoc.Descendants(xnsDefault + "restApiVersion").First().Value
 "3.12"

About Prototyping / RnD
we recommend to work within the immediate panel as we can check and prototype very fast
Understanding the 6 Debugging Panels of UiPath in the easiest way possible! - News / Tutorials - UiPath Community Forum

4 Likes

Thanks Peter!
Annoyingly I had squiggly brackets around the XNamespace until I read your solution.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.