web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Trouble while parsing ...
Power Automate
Unanswered

Trouble while parsing xml in logic apps. Flow reads xml from blob and writes to DB

(0) ShareShare
ReportReport
Posted on by 11

Hi All,

 

Following is the xml that I facing trouble with :

 

<?xml version="1.0" encoding="utf-16"?>

<ItemNotification>
        <MessageHeader>
             <MessageID>PABG0103329120200130120241</MessageID>
        </MessageHeader>
        <ItemList>
           <Item>
               <PartNumber>BG01033291</PartNumber>
               <AfterMarketClass/>
              <ApproverDate>2018-11-08</ApproverDate>
         </Item>
      </ItemList>
</ItemNotification>

 

I have tried the following xpath for parsing:

xpath(xml(string(body('Get_blob_content_using_path'))),'string(/ItemNotification/ItemList/Item/PartNumber/text()')

xpath(xml(string(body('Get_blob_content_using_path'))),'string(//PartNumber/text()')

 

I need the Text in PartNumber node. Also tried de-batching this in a For Each loop (not required but tried it). 

 

Following is my flow:

image.png

 

 

 

 

 

 

 

 

 

 

Categories:
I have the same question (0)
  • Verified answer
    abm abm Profile Picture
    32,858 Most Valuable Professional on at
    Re: Trouble while parsing xml in logic apps. Flow reads xml from blob and writes to DB

    Hi @Suhasuser 

     

    XPath expression failed to parse XML for UTF-16  so I did changed the first line of your XML to

     

    <?xml version="1.0" encoding="utf-8"?>

     

    or 

     

    <?xml version="1.0"?>

     

    Try the following steps:

     

    image.png

     

    Below is the expression I used.

    xpath(xml(outputs('Compose_2')),'//ItemList/Item/PartNumber/text()')
     
    image.png
     
     
     
  • Suhasuser Profile Picture
    11 on at
    Re: Trouble while parsing xml in logic apps. Flow reads xml from blob and writes to DB

    Yes, that was the kink giving me the error. Problem solved. Thanks to you.

  • Suhasuser Profile Picture
    11 on at
    Re: Trouble while parsing xml in logic apps. Flow reads xml from blob and writes to DB

    How to deal with this problem. I keep getting this xml from upstream how do read this using xpath in logic app if all xmls are utf-16  encoded ? Can you please give some suggestions ?

  • abm abm Profile Picture
    32,858 Most Valuable Professional on at
    Re: Trouble while parsing xml in logic apps. Flow reads xml from blob and writes to DB

    Hi @Suhasuser 

     

    Thanks for the update. 

     

    You could use a replace expression to change the XML UTF value.

     

    Thanks

  • Suhasuser Profile Picture
    11 on at
    Re: Trouble while parsing xml in logic apps. Flow reads xml from blob and writes to DB

    Hi ,

     

    I have used the following expression to replace the string from utf-16 to utf-8 :

    replace(string(triggerBody()?['Path']),'utf-16','utf-8')
     
    But it has not replaced as i can see in the output
     
    image.png
  • Verified answer
    abm abm Profile Picture
    32,858 Most Valuable Professional on at
    Re: Trouble while parsing xml in logic apps. Flow reads xml from blob and writes to DB

    Hi @Suhasuser 

     

    Create a compose and map the XML.

     

    Next add another compose to use the replace.

     

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

#2
Tomac Profile Picture

Tomac 456 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard