web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / How to change XML stru...
Power Automate
Unanswered

How to change XML structure

(0) ShareShare
ReportReport
Posted on by 31

Hello, 

 

as a newbie, i am struggling with this. 

I have a xml file, that i need to change its structure from this: 

 

Jan_Ur_1-1691225452357.png

 

to this: 

Jan_Ur_0-1691225383354.png

 

as you can see, i need to go from each StoItem element having multiple atributes to have its own elements instead. 

Hope I am using the correct terminology. 

 

Any idea how to go about it?

 

Thanks for all suggestions. 

 

Categories:
I have the same question (0)
  • Verified answer
    Matthy79 Profile Picture
    4,180 Super User 2024 Season 1 on at

    Hello @Jan_Ur 

     

    It would be great if you provide sample data as text not as screenshot. Currently it is not possible to solve this puzzle because you provided input and output but not from the same source. You have to tell us which property should be transformed to which node if you change names.

     

    For example. In your output-sample there is a node called "eshop". But there is no property called "eshop" in your input sample.

     

    Or is this just a sample with no connection at all? In that case here is how I would do it. This is not 100% but maybe good enough for your need:

     

    xml(json(replace(string(json(xml(YOURXMLDATA))), '"@', '"')))

     

    Instead of YOURXMLDATA you have to put your xml data.

  • Jan_Ur Profile Picture
    31 on at

    Hi, thanks for the reply. 

    Both sample data: 

     

    wrong format: 

    <Result DeaCurrency="CZK">
    <StoItem Id="5011062" Code="TDE SHARK01" PartNo="SHARK01" EAN="8594161330141" Name="EVOLVEO Shark 35dBi, aktivní venkovní anténa DVB-T/T2" ManName="EVOLVEO" PriceDea="484.7100" PriceDeaCurrency="484.7100" QtyFree="50" Url="https://www.abacus.cz/default.asp?cls=stoitem&amp;stiid=5011062" />
    </Result>
     

    right format: 

    <products date="05.08.2023:10:08" presna-dostupnost="N">
    <product>
    <eshop>Produkty značky solight.cz</eshop>
    <objednaci_cislo>XA05</objednaci_cislo>
    <EAN>8595092105587</EAN>
    <MINQTY>2</MINQTY>
    </products >
     
    What I am really going for is the structure itself, not particular data. 
    I need to transform the "wrong formatted xml" from
    <Result>
    <StoItem
    id=x
    name = y
    />
    </Result>
    to
    <Result>
    <StoItem>
    <id>x</id>
    <name>y</name>
    </StoItem>
    </Result>
     
    I hope I am explaining it better this time 🙂
     
     
  • Verified answer
    Matthy79 Profile Picture
    4,180 Super User 2024 Season 1 on at

    Have you even tried my suggestion?

  • Jan_Ur Profile Picture
    31 on at

    have not 😄 i was just so excited to answer that i didnt even think about trying it, since i wasnt sure about the explanation. 

     

    But it works, thank you very much

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 538 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 405 Moderator

#3
abm abm Profile Picture

abm abm 252 Most Valuable Professional

Last 30 days Overall leaderboard