This is a sample of an XML. What I need to know is how many “det nItem” are in XML. Note: This amount is variable. I tried using Xpath, Get XML Nodes, .Element. Well, I don’t know if I’m using it the wrong way, but none of them worked for what I need
You can get it using Deserialize XML Activity in UiPath.Web.Activities package.
The following steps shows how to get the number of “<det nitem=” under root element.
Read your xml as string, and parse it by Deserialize XML activity as xDocument (xDoc).
Get root element (xRoot=xDoc.Root) and its namespace (xNS=XRoot.Name.Namespace).
Get descendants which name is “det”. elementsDet = xRoot.Descendants(xNS+"det")
Get number of det element which has nItem attribute. count = xElementsDet.Count(function(x) x.Attributes("nItem").Count>0)