XML has complex formatting and need help in XML data extraction and update xml data

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” /

In general it is about working with attributes:

grafik
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:
grafik

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>

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:

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.

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