My xml has different format than regular formats and need help in data extraction and updating data in xml based on name values.
Searched for solution in different sources but no luck.
Example I need solution to extract and update values based on name value = message5 etc
<field name=“message178” type=“text” value=“723” /
ppr
(Peter Preuss)
July 16, 2024, 3:24pm
2
In general it is about working with attributes:
out: xDoc | DataType: XDocument
Filter for the element
Assign Activity:
myXElement | DataType: XElement =
xDoc.Root.Descendants("field").Where(Function (x) x.Attribute("name").Value.Equals("message5")).FirstOrDefault
Assign Activity:
myXElement.Attribute("value").Value = "101010"
Finally, save the XML file if needed
Visuals:
then update:
Could you please help me with following 1 also.
I also have collection part of my XML and need to understand how can update data to collection and how to insert new rows into collection.
<field name="message" type="text" value="" />
<field name="message2" type="text" value="" />
<field name="MydataInfo" type="collection">
<row>
<field name="MyFinance" type="collection">
<row>
<field name="JSON:Array" type="collection">
<row>
<field name="Finance1" type="text" value="XYZ" />
<field name="Finance3" type="text" value="$2,500.00" />
<field name="Finance7" type="text" value="$243,912.00" />
</row>
</field>
</row>
<row>
<field name="JSON:Array" type="collection">
<row>
<field name="Coverage3" type="text" value="ABC" />
<field name="Coverage7" type="text" value="$0.00" />
<field name="coverage9" type="text" value="$0.00" />
</row>
</field>
</row>
<row>
<field name="JSON:Array" type="collection">
<row>
<field name="Coverage23" type="text" value="hgt" />
<field name="HDJGHJG35" type="text" value="$0.00" />
<field name="ETETY56" type="text" value="$500,000.00" />
</row>
</field>
</row>
ppr
(Peter Preuss)
July 18, 2024, 9:50am
5
Let us stay by 1 topic = 1 use case. So other researchers can faster find solutions for their similar use cases
With the initial use case
find element by a particular attribute value
update another attribute value of the found element
we answered and showcased. So, let close the topic by:
Forum FAQ - How to mark a post as a solution
This document is part of our beginners guide .
This article will teach you how to properly mark a post as a solution.
We were closely following our last UiPath Forum feedback round! topic and carefully extracted all the bits of feedback that was provided. As such, we would like to tackle the topic of solutions on our Forum and how to properly use them.
When is the topic resolved?
The topic can be considered resolved when the topic author has fo…
for your other case just open a new topic and provide us
sample xml (currently we only had fragments)
use case description / output definition
sample output
thanks for support
Sure I have marked as solution for initial problem and created new topic for other query.
I have collection part of XML and need help in understanding how to insert new rows into collection and also how to read collection data from xml.
<field name="message" type="text" value="" />
<field name="message2" type="text" value="" />
<field name="MydataInfo" type="collection">
<row>
<field name="MyFinance" type="collection">
<row>
<field name="JSON:Array" type="collection">
<row>
<field name="Finance1" type="text" value="XYZ" />
<field name=…
system
(system)
Closed
July 21, 2024, 10:04am
7
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.