Xml help please

Hi all,

i have an xml opened in a browser and through http request i download it.

After, i deserialize the http request response, and try to take the value of a specific tag, but i’m not able to do that.

The specific tag is 1<\ResponseType>

The xml header is the following:

<?xml version=\"1.0\" encoding=\"UTF-8"\<?xml-stylesheet type=\"text/xml" href=\".../nda.xsl\"?><ns0:Response xmlns:ns0=\"http://mywebsite/1"xmlns:soa=\"urn:xmlsoa\"xmlns:S=\"http://schemas.xmlsoap.org/soap/envelope

now, if i try to put in the immediate function, the following expression:

xml.Root.Root.Name i have [{http://mywebsite}Response]
but if i try for example
xml.Root.Descendants()(15) i have just the tag [ServiceCode]

could you please help me?
Thank you

Handling XML Namespaces:
XML Extraction - Handling Namespaces (Tableau, Soap, OASIS types) - Help / Community - UiPath Community Forum

yes can happen, so we just use the element name only (thats why we do these name tests for the exploration)

If possible share with us the XML data as text file along with the description of what needs to be extracted / retrieved

1 Like

how to extract with the element name only?

I’ve tried:

xml.root.Descendants()(“ResponseType”).Name
but it doesn’t work

xml.root.Descendants(“ResponseType”).First().Value

Descendants(…) will return 0,1 or multiple items
the statement will fail on the appended .Name, as it is not a property of the Descendants() return

But please note:

1 Like

Doesn’t work.

The response is: Cannot evaluate at the current context, but if i try xml.Root.Descendants()(5).Name it works and the result is: [ResponseType]

Attached a sample xml, I had to modify it slightly to keep the data safe.
Thank you
xmlInput.txt (462 Bytes)

thats fine, but validate it before sending it. So we do not have to repait invalid structres as we had to do

also ensure that following namespaces are imported:

grafik
grafik

so repaired XML:
grafik

we analyze:
grafik

and access
grafik

1 Like

Appreciate your help.

xmldoc.Root.Descendants(“ResponseType”).First.Value extract the correct data.

Do you see any critical issues in the long run using this kind of approach? Or as long as the xml is not changed does this remain valid?

did not get your question completely. Can you rephrase?

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