Skip to main content
Community site session details

Community site session details

Session Id : vhzt/EuhXkoIppQ7wgGzym
Power Automate - General Discussion
Unanswered

Parsing XML containing illegal characters with xpath, issue with angel brackets

Like (0) ShareShare
ReportReport
Posted on 27 Oct 2021 03:56:11 by 21

I build a SharePoint form with dynamic rows (repeating sections in Nintex form) that have four fields in each row. Users could enter ', &, <, > in the first two text fields. The data of the dynamic rows are saved as XML. 

 

Below is two rows of data:

<?xml version='1.0' encoding='utf-8'?><RepeaterData><Version /><Items><Item><Milestones type='System.String'>test1's & <name></Milestones><Descriptions type='System.String'>test1's name</Descriptions><Recipients type='System.String'>user1, user2</Recipients><DueDate type='System.DateTime'>11/1/2021</DueDate></Item><Item><Milestones type='System.String'>TEST 2 </Milestones><Descriptions type='System.String'>TEST 2 </Descriptions><Recipients type='System.String'>user1, user2</Recipients><DueDate type='System.DateTime'>10/27/2021</DueDate></Item></Items>

</RepeaterData>

 

I use a Compose action to escape &: REPLACE(outputs('getRepeatingActions'),'&','ZZZ'), then another compose to run xpath: 

xpath(xml(outputs('Compose')), '//Item'), which returns Item array. 

 

' doesn't seem to have problem with xpath, & I code it as ZZZ then convert it back with replace function when I use it to send email. The tricky part is with angle brackets,< and >. The workflow fails when the text field has < or >. 

 

The error is: Unable to process template language expressions in action 'getAllItems' inputs at line '1' and column '14916': 'The template language function 'xml' parameter is not valid. The provided value cannot be converted to XML: 'The 'Name' start tag on line 1 position 168 does not match the end tag of 'Milestones'. Line 1, position 175.'. Please see https://aka.ms/logicexpressions#xml for usage details.'.

 

How to escape angle brackets to allow xpath to work? When there are angle brackets in XML, convert to JSON doesn't work either.

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

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

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!

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