{"id":32553,"date":"2021-02-02T08:05:00","date_gmt":"2021-02-02T02:35:00","guid":{"rendered":"https:\/\/www.flexmind.co\/?p=32553"},"modified":"2021-02-02T19:11:26","modified_gmt":"2021-02-02T13:41:26","slug":"xml-node-action-in-pad-for-xml-element-attribute","status":"publish","type":"post","link":"https:\/\/www.flexmind.co\/xml-node-action-in-pad-for-xml-element-attribute\/","title":{"rendered":"XML node Trilogy in PAD – Part-II"},"content":{"rendered":"\n

Hello everyone, today we will see the second part of the XML node Trilogy in PAD. You can go through this link to see the previous article. In this article, we will look below the actions of the XML node in the pad (Power Automate Desktop) for the XML element attribute<\/strong>.
1. Get XML element attributes
2. Set XML element attributes
3. Remove XML element attributes<\/strong><\/p>\n\n\n\n

Before we jump into the above three actions of PAD, I would like to share the XML file. In order to know more about XML attributes, refer to this link<\/a>.<\/p>\n\n\n\n

<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<bookstore>\n  <book>\n    <title lang=\"en\">Harry Potter<\/title>\n    <price currency=\"INR\">29.99<\/price>\n  <\/book>\n  <book>\n    <title lang=\"en\">Learning XML<\/title>\n    <price currency=\"HKD\">39.95<\/price>\n  <\/book>\n  <book>\n    <title lang=\"en\">Flexmind PowerApps<\/title>\n    <price currency=\"USD\">49.95<\/price>\n  <\/book>\n<\/bookstore><\/pre>\n\n\n\n

In the above example I am using currency attribute of price element. Let’s start !!<\/p>\n\n\n\n

Get XML element attribute<\/strong><\/h2>\n\n\n\n

This action get the value of an attribute of an XML element. For example, let us consider this below piece of code. Here currency is an attribute for price element which value is INR<\/strong>.<\/p>\n\n\n\n

<price currency=\"INR\">29.99<\/price><\/pre>\n\n\n\n
\"XML
Flow<\/figcaption><\/figure><\/div>\n\n\n\n
\"XML
Get Attribute<\/figcaption><\/figure>\n\n\n\n

Parameters explanation<\/h3>\n\n\n\n

XML Document : Variable coming from read XML file action.
XPath query: \/bookstore\/book[%input1%]\/price. Here [%input1%] is basically a variable which value is equal to user input (an integer).
Attribute Name: Currency
Get Value as: Text Value

Now run the flow to see the result. It will look like below picture.<\/p>\n\n\n\n

\"XML
Display Result<\/figcaption><\/figure><\/div>\n\n\n\n

Set XML element attribute<\/strong>s<\/h2>\n\n\n\n

We use this action to set the value of an attribute. If you see the below picture, set XML’s parameters pretty similar to Get action. Suppose, if we want to set the currency from INR to SGD, then we will use the Set action.<\/p>\n\n\n\n

\"XML
Set Attribute<\/figcaption><\/figure><\/div>\n\n\n\n

Remove XML element attribute<\/strong><\/h2>\n\n\n\n

If you want to remove the attribute of an XML element, then in that case you will use this action. Parameters for this action is also very similar to Set and Get actions.
Hope you all will enjoy this article. In our next blog, we will go through the remaining actions of XML node in PAD. So stay tuned.<\/p>\n\n\n\n

\"\"<\/figure><\/div>\n","protected":false},"excerpt":{"rendered":"

Hello everyone, today we will see the second part of the XML node Trilogy in PAD. You can go through this link to see the previous article. In this article,<\/p>\n

READ MORE<\/a><\/div>\n","protected":false},"author":5,"featured_media":32563,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_glsr_average":0,"_glsr_ranking":0,"_glsr_reviews":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[133],"tags":[63,389,134,423],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"https:\/\/www.flexmind.co\/wp-content\/uploads\/2021\/02\/XML-Node-PAD-2.png","_links":{"self":[{"href":"https:\/\/www.flexmind.co\/wp-json\/wp\/v2\/posts\/32553"}],"collection":[{"href":"https:\/\/www.flexmind.co\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.flexmind.co\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.flexmind.co\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/www.flexmind.co\/wp-json\/wp\/v2\/comments?post=32553"}],"version-history":[{"count":0,"href":"https:\/\/www.flexmind.co\/wp-json\/wp\/v2\/posts\/32553\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.flexmind.co\/wp-json\/wp\/v2\/media\/32563"}],"wp:attachment":[{"href":"https:\/\/www.flexmind.co\/wp-json\/wp\/v2\/media?parent=32553"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.flexmind.co\/wp-json\/wp\/v2\/categories?post=32553"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.flexmind.co\/wp-json\/wp\/v2\/tags?post=32553"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}