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 / "The template language...
Power Automate
Unanswered

"The template language function 'xml' parameter is not valid"

(0) ShareShare
ReportReport
Posted on by 8

I am creating a flow for extracting HTML table from Email then put it in another excel file, when I tested the flow it showed the error:

 

"Unable to process template language expressions in action 'ComposeHTML' inputs at line '0' and column '0': 'The template language function 'xml' parameter is not valid. The provided value cannot be converted to XML: 'The 'img' start tag on line 1 position 236 does not match the end tag of 'a'. Line 1, position 417.'."

 

Does anyone of you had this problem? Do know how to fix this error and what is the solution for this problem?

 

This is the error:HTML Error Details.pngThis is the expression that I used: HTML Error Expression.png

Categories:
I have the same question (0)
  • Expiscornovus Profile Picture
    33,189 Most Valuable Professional on at

    Hi @Marx,

     

    HTML tags like <img> (and also <br>) don't have end tags. I can imagine the xml function does not like that because it is missing the </img> tag in the input.

     

    You can probably workaround that by adding those close tags yourself

  • Marx Profile Picture
    8 on at

    I am confused, where exactly should I put the "</img>" tag in the input?

  • Expiscornovus Profile Picture
    33,189 Most Valuable Professional on at

    Hi @Marx,

     

    Directly after the <img> tag. So, you would have to identify the location of that tag (and its content) with for example an indexOf function.

     

    After that you can use a similar approach like in the screenshots you already shared, by using a replace function to replace <img> tag with <img></img>.

  • Marx Profile Picture
    8 on at

    I don't know how to locate that.

    Screenshot (59).pngScreenshot (60).pngScreenshot (61).png

    that's the screenshots of the early parts of the flow.

     

    Thank you

  • Expiscornovus Profile Picture
    33,189 Most Valuable Professional on at

    Hi @Marx,

     

    Apologies if this is not clear, but there is not a specific location where you can find this <img> tag already.

     

    I am suggesting that you write a new expression for this (with a couple of indexOf and replace functions). So, this could be in one of the existing Compose actions or a new totally new Compose action within that same Scope container.

     

    Only pre-requisite is that just need to clean up the outputs before you try and convert it to the xml in the ComposeHTML action. So, in that sense the location needs to be before the ComposeHTML action 😁

     

    Is it just one image in the HTML or multiple images in your HTML table?

     

    Below is an example of that approach, if that helps?

    The example below only replaces the first img tag it finds. If you have multiple or no images at all in your table this suggested solution will not work.

     

    1. This is the expression used for that in a new compose action called ComposeFindReplaceIMGTag

     

    replace(outputs('ComposeEndOfTable'), substring(substring(outputs('ComposeEndOfTable'), indexOf(outputs('ComposeEndOfTable'), '<img')), 0, add(indexOf(substring(outputs('ComposeEndOfTable'), indexOf(outputs('ComposeEndOfTable'), '<img')), '>'),1)), concat(substring(substring(outputs('ComposeEndOfTable'), indexOf(outputs('ComposeEndOfTable'), '<img')), 0, add(indexOf(substring(outputs('ComposeEndOfTable'), indexOf(outputs('ComposeEndOfTable'), '<img')), '>'),1)), '</img>'))

     

    2. The ComposeAddClosingTableTag is also updated and uses the Outputs field of the ComposeFindReplaceIMGTag instead of the Outputs of the ComposeEndOfTable action.

     

    cleanup_imgtag.png

     

    Btw, I assume you followed @DamoBird365 his video for setting up your flow?

    https://www.youtube.com/watch?v=i4GHCGMAD88

     

  • Marx Profile Picture
    8 on at

    Yes, I followed @DamoBird365 in his video.

     

    Anyways thank you for your help and sharing your knowledge.

  • Roane83 Profile Picture
    2 on at

    Thanks, this has helped me. However, this seems to work only for one img tag. In my case, I have multiple img tags in the string. So how do you go about finding all of them and placing a closing tag at the end of each? Thanks.

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 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard