Dear All,
I want to extract value of "w:val" attribute in "w:id" and "w:tag" tag from the following xml:
<w:sdtPr xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main">
<w:rPr>
<w:rFonts w:ascii="Arial" w:cs="Arial" w:hAnsi="Arial"/>
<w:b/>
<w:noProof/>
<w:sz w:val="20"/>
<w:szCs w:val="20"/>
</w:rPr>
<w:alias w:val="legal_entity"/>
<w:tag w:val="legal_entity"/>
<w:id w:val="-1760514947"/>
<w:placeholder>
<w:docPart w:val="F0003948BDB4448AAEA4C633D11CD157"/>
</w:placeholder>
<w:text/>
</w:sdtPr>
I have tried some xpath:
xpath(Xml(outputs('Compose')),'//w:sdtPr/*[self::w:id]/text()')
xpath(Xml(outputs('Compose')),'//w:sdtPr/w:id/@w:id')
xpath(Xml(outputs('Compose')),'//w:sdtPr/w:id/*[@w:id]')
Please guide me.
Solved! Go to Solution.
I tried xpath but also could not make it work, so I tried a different approach. Instead of parsing the XML I converted it back to JSON:
The two expressions I used to extract the ID and the Tag attributes values were:
outputs('JSON')['w:sdtPr']['w:id']['@w:val']
outputs('JSON')['w:sdtPr']['w:tag']['@w:val']
See how you get on with this.
Blog: tachytelic.net
YouTube: https://www.youtube.com/c/PaulieM/videos
If I answered your question, please accept it as a solution 😘
I tried xpath but also could not make it work, so I tried a different approach. Instead of parsing the XML I converted it back to JSON:
The two expressions I used to extract the ID and the Tag attributes values were:
outputs('JSON')['w:sdtPr']['w:id']['@w:val']
outputs('JSON')['w:sdtPr']['w:tag']['@w:val']
See how you get on with this.
Blog: tachytelic.net
YouTube: https://www.youtube.com/c/PaulieM/videos
If I answered your question, please accept it as a solution 😘
Thanks @Paulie78 for helping me out here.
I have a followup question, I hope you do not mind helping there too.
Now I want to go through a excel table and for each row I want to get the value of the column which matches the tag value and associate it with the corresponding id value.
There is no data structure like map or dictionary in Power automate flow, can you guide me how to achieve it?
It would be better to ask a new question and explain carefully what you want to do based on the JSON that you now have.
User | Count |
---|---|
87 | |
43 | |
21 | |
18 | |
16 |
User | Count |
---|---|
132 | |
47 | |
42 | |
36 | |
28 |