Skip to main content
Community site session details

Community site session details

Session Id : Yasbggh7YuGu+UGc7f/PGm
Power Automate - Building Flows
Unanswered

Deleting XML data between certain tags

Like (0) ShareShare
ReportReport
Posted on 2 Oct 2020 19:03:57 by

Hello everybody!

 

I have searched and couldn't find a solution for this. Anybody who could figure this out, please!

 

I have generated a simple Flow with expression xml(triggerbody()['text']) as following:

ZainabRao_0-1601664283318.png

I run it and paste xml data (generated from an applicaiton) in input window. The flow fails because:

- xml has links (https://) that has '&' in it. 

- xml has data entered by users that has text like  '<xxx>'. Flow identifies it as a tag, searches for end tag and fails. 

 

Is there any way that Flow could delete certain data from this xml and input the treated data to the Flow for further operation?

For example, I would want to delete data between certain tags. Can I do this if the data is in xml form or saved in .text file or any other way? May be 2 different Flows for this?

 

Thank you!!

Best regards,

Zainab 

 

  • Community Power Platform Member Profile Picture
    on 04 Oct 2020 at 08:45:16
    Re: Deleting XML data between certain tags

    @Amanthaper Thanks!

     

    Unfortunately, it does not solve the problem.

     

    Greetings,

    Zainab 

  • Amanthaper Profile Picture
    441 on 04 Oct 2020 at 01:59:28
    Re: Deleting XML data between certain tags

    If the & only needs to be replaced in the &avatarId or &avatarType sections then you could try:

    replace(replace(xmltriggerBody()['text'],'&avatarId','avatarId'),'&avatarType','avatarType')
  • Community Power Platform Member Profile Picture
    on 04 Oct 2020 at 01:50:02
    Re: Deleting XML data between certain tags

     @Amanthaper Thank you for replying!

     

    I have used replace expression as following and the error message still stays. 😕

    ZainabRao_0-1601775290388.png

    qqq.PNG

     

     

     

     

    Also tried replacing & with = in the expression. Runs into error again. 

    If I use replace expression, it will end up replacing characters/letters in the whole document - messing up the data.

    Plus, the file I have has a lot of useless data too. That's why I am trying to find out a way with which I could delete/ignore data between certain tags.

    And if not in xml then, may be any other format that allows it.

     

    Greetings, 

    Zainab 

  • Amanthaper Profile Picture
    441 on 04 Oct 2020 at 00:31:02
    Re: Deleting XML data between certain tags

    Hi,

    You could use the replace function to resolve both issues.

    To remove the "&" for the first issue use this expression:  replace(xmltriggerBody()['text']),'&',''). Be sure to reference your flow element in the expression.

    Once you isolate the second issue and, given that it's a consistent repetitive pattern, use the Replace function to either change the problematic syntax or remove it altogeher.

    Hope this helps. If you still need more help please post (or send privately) a whole or partial xml file and I'll try to replicate the issue.

     

    Cheers,

    Aman T

    ------------------------------------------------------------------------------------------------------
    If my post helps you with your problem or answers your question, please mark it Solved or Answered. This helps anyone with similar challenges. If you like my response, please give it a Thumbs Up.
    ------------------------------------------------------------------------------------------------------

  • Community Power Platform Member Profile Picture
    on 03 Oct 2020 at 18:58:41
    Re: Deleting XML data between certain tags

    @Jcook Thank you for replying. 

     

    It's the Compose action that fails. 

    Here is a piece of a very long (5MB) XML data that is generated from JIRA (a project management application).

    <channel>

    <key id="7395096">xxxx-2618</key>
    <summary>New Discover of Database xx Type "Standalone" vs. "BS"</summary>
    <type id="5" iconUrl="https://xjira.x.x.corp/secure/viewavatar?size=xsmall&avatarId=27826&avatarType=issuetype">Task</type>
    <parent id="7371576">xxx-2599</parent>
    <status id="1" iconUrl="https://xjira.x.x.corp/images/icons/statuses/open.png" description="The item is open and ready for the assignee to start work on it.">Open</status>
    </channel>

    It gives following error message:

     234.PNG

     

     

     

     

    I removed '&' from the underlined part of the URL in code and then it runs successfuly. 

     

    Similarly, there is another chunk of code from the same file that also runs into error. 

    <title>[xxxx-000] Change ACExxx "ADJUST TIMEZONE" to include "db2<sid>", "x<sid>" and "<sid>db" users for  Servers</title> 

    Error message:

    cv.PNG 

     

    When I run the whole file, I also come across this following error message:

    123.PNG

     

     
     

     

     
     

     

     

    Due to these error messages, I want to automate flow in a way that it could ignore code inside certain tags in any way possible. 

     

    Best regards,

    Zainab 

     
     
     

     

     

     

     

  • Jcook Profile Picture
    7,779 Most Valuable Professional on 02 Oct 2020 at 19:37:00
    Re: Deleting XML data between certain tags

    Hello @Anonymous 

     

    Could you provide a sample XML message.

     

    Also which step is failing? The trigger itself? Or is it the Compose action that fails?

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

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 497 Super User 2025 Season 2

#2
David_MA Profile Picture

David_MA 436 Super User 2025 Season 2

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 244 Super User 2025 Season 2

Loading complete