I want to update the xml attriute values in xml and values should come form excel file

Here in image highlighted values of attribute should be updated and values should be come from external file like excel.

Will this file contains only one ordernumber and totalorderquantity?

yes @karthik xml contains all unique tags

Okay. Let me check.

hello karthik did you get any idea to do this.

Can you please Share a Sample xml. I would have a look on your question later

smd_loipr0_02.xml (33.5 KB)

Give me some minutes I will share the xaml file.

ok karthick , Thanks :grinning:

smd_loipr0_02 - Copy.xml (33.5 KB)

@tejach412 thanks for your Message. So issue is still Open and the Forum will have a Look on IT. In my Case Just expect some delays due i am much travelling the next days

@ppr my issue is still in open could you please help

OK. I can have a Look on IT at afternoon. Please ensure that i will find the XML in its latest Version in the Posts. IT would be great If you can confirm following. In the Excel File i do find 2 columns: 1 with the information to element, Second with the new value, right?

loipro smd_1.xml (35.0 KB)

Yes @ppr in Excel one column is element and other column with value

Perfect, thanks

As the elements, which are to update, are unique, so the flow is less complex
Base Pattern is like this (not showing explicitly read in excel, parsing XML)

  • iterating over each row
  • selecting XML Element
  • updating XML Element
    finally save XML Document

I show cased this for you with two approaches:

  • LINQ to XML API: xDoc.Descendants(row(“ElementName”).ToString.Trim).Single
  • XPATH Statement: xDoc.XPathSelectElements(row(“ElementName”).ToString.Trim).Single

So decide by yourself on what you prefer.
Kindly Note:

  • the Single Method is raising an exception of less or more XMLelements were retrieved. You can use it for initial retrieval error handling
  • Using XPathSelectElements method requires the imported Namespace: System.XML.XPath

Demo XAML here: tejach412.xaml (15.0 KB)
Demo EXCEL here: tejach412.xlsx (9.1 KB)

Let us know your feedback and mark the solving post as solution. So others can benefit from it

1 Like

Thanks You so much @ppr both things will help in my project. :grinning: :grinning:

Thanks for your Feedback, Happy automation :grin:

Hi @ppr I hope your doing good. I have one question, could you please have look

I have folder C:\Testing\data\Files\generatexml.xaml.
the generatexml.xaml generate one xml which i have to save in “C:\Testing\data”.

How Can I move one folder back ?

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