Change XML tags/fields across entire file
Change XML tags/fields across entire file
(OP)
Apologies if the title is't descriptive but I'm not sure on exactly how to describe the issue in short.
I have a large XML file exported from an on-prem system that we need to import the data into another system (SharePoint) using Power Automate. I have created a Flow to consume the XML data in a simple format (as in the second XML example), however as we have over 40,000 document records each with 10 attributes each I can't change this manually on all records.
Is there a way to easily change my XML from the following:
to read like:
Or will I need to look at my flow and adjust it to accept the first example of the XML?
Thanks
I have a large XML file exported from an on-prem system that we need to import the data into another system (SharePoint) using Power Automate. I have created a Flow to consume the XML data in a simple format (as in the second XML example), however as we have over 40,000 document records each with 10 attributes each I can't change this manually on all records.
Is there a way to easily change my XML from the following:
CODE --> xml
<Document Scheme="PurchaseInvoice" ID="0B807CEEF97411E4B64500505685156C" SchemeHash="FF298EE05B8622172077FD1E1100E20B"> <Attributes> <NamedDV Name="PIRRef" ID="30ADFF586B6BE26316619C294DFEC637"> <Value Encoding="UTF-8" Type="TEXT" Locale="en-GB">42103</Value> </NamedDV> <NamedDV Name="InvoiceDate" ID="5C0491A99EC233C72FEB9C205A0F1D5B"> <Value Encoding="UTF-8" Type="DATE" Plain="@20100107000000" Locale="en-GB" Millis="0">07/01/2010</Value> </NamedDV> <NamedDV Name="NetAmount" ID="9C7E756656A4DE19FC3209DC4C94BD66"> <Value Encoding="UTF-8" Type="DECI" Plain="@150" Locale="en-GB">150</Value> </NamedDV> </Attributes> </Document>
to read like:
CODE --> xml
<Document> <Attributes> <PIRRef>42103</PIRRef> <InvoiceDate>07/01/2010</InvoiceDate> <NetAmount>150</NetAmount> </Attributes> </Document>
Or will I need to look at my flow and adjust it to accept the first example of the XML?
Thanks
RE: Change XML tags/fields across entire file
There are a few things yet unspecified, but this may be a starting point:
CODE --> XSLT
RE: Change XML tags/fields across entire file
It should be not problem to write a little program which does this work.
You mentioned SharePoint, so I assumed you are on windows and wrote this little example in Vbscript:
mancdad.vbs
CODE
Running the script on your input XML (I named it mancdad.xml) produces this output:
CODE
Using redirection to get a resulting xml file mancdad_result.xml:
CODE