XML Like I've Never seen before

So I have an attached XML document. XML is my least favourite plus this looks formatted in a completely different way to any others I have seen.

If I open it in excel I would like the below 2 columns

The strange part that I cannot get my head around is when imported to excel the ns1 part of the column name is ns2 in the actual xml?
image

I have already:

Read the XML to text string
Deserialised It
I have a for each loop
I just trying to do a write line to get some sort of output I have tried (“ns1:…”) after the currentrow.element(“ns2:GoodsServicesDescriptionText”).value.tostring but gives me an error about the “:” after ns2

88559449_status_st96.xml (42.2 KB)

@rmorgan

Can you please show the error message exactly

Cheers

Write Line: The ‘:’ character, hexadecimal value 0x3A, cannot be included in a name.

currentItem.Element(“ns:2GoodsServicesDescriptionText”).value.tostring

it is about handling XML Namespaces. Find below topic elaborating on analysis and handling
XML Extraction - Handling Namespaces (Tableau, Soap, OASIS types) - Help / Community - UiPath Community Forum

we cannot use the : within the name as we have to handle properly the namespace info for the element name

yeah thats way above my knowledge of XML

not understood what you tried to say

As described within the above linked topic, we have to handle XML Namespaces

The Namespace analysis we can short cut as we do know

  • we have to handle namespaces
  • ns2 Namespace is to handle

grafik

And can get the ns:2GoodsServicesDescriptionText elements by using the namespace e.g. like


for looping

Or can do the element value retrieval like:
grafik

Think im just thick
how do we incorporate the element retrieval method in a for each loop to iterate thorugh the document and extract all the GoodsServiceDescriptions?

as already mentioned above and derivable to:


xnsNs2 = xDoc.Root.GetNamespaceOfPrefix("ns2")
item =

xDoc.Root.Descendants(xnsNs2 + "GoodsServicesDescriptionText")

having output:
grafik

RnD / Prototyping done with:
Understanding the 6 Debugging Panels of UiPath in the easiest way possible! - News / Tutorials - UiPath Community Forum

gotcha, nearly there with that bit :slight_smile: thankyou

Get IN

Thank you I can work with that now!!! :hugs:

Perfect, so the topic can be closed by marking the solving post
Forum FAQ - How to mark a post as a solution - News / Tutorials - UiPath Community Forum

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