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 / xml() Function Does No...
Power Automate
Suggested Answer

xml() Function Does Not Respect Namespace Definition In JSON Key ( defined by colon ) And Deletes

(2) ShareShare
ReportReport
Posted on by 4,363 Moderator
When running an xml() function over the below JSON it correctly maintains the xmlns namespace declarations, but incorrectly removes the namespace defined entities:
 
Anyone come across this?
 
If anyone has a workaround that IS NOT replace() based, I'll also be interested to hear it.
 
Attached is a copy some stuff to play around with, paste it in your flow!:
 
 
{"id":"9dc6d07b-8db1-4ef6-9884-e0f08eaf2e77","brandColor":"#8C3900","connectionReferences":{},"connectorDisplayName":"Control","icon":"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIHZlcnNpb249IjEuMSIgdmlld0JveD0iMCAwIDMyIDMyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPg0KIDxwYXRoIGQ9Im0wIDBoMzJ2MzJoLTMyeiIgZmlsbD0iIzhDMzkwMCIvPg0KIDxwYXRoIGQ9Im04IDEwaDE2djEyaC0xNnptMTUgMTF2LTEwaC0xNHYxMHptLTItOHY2aC0xMHYtNnptLTEgNXYtNGgtOHY0eiIgZmlsbD0iI2ZmZiIvPg0KPC9zdmc+DQo=","isTrigger":false,"operationName":"Scope","operationDefinition":{"type":"Scope","actions":{"jsonArrCNST":{"type":"ParseJson","inputs":{"content":[{"log:employeeID":"599","log:endDate":"2025-04-08"}],"schema":{}},"runAfter":{},"metadata":{"operationMetadataId":"73ee0e4f-39fc-4bd2-9889-d3d7e0a11550"}},"Select":{"type":"Select","inputs":{"from":"@body('jsonArrCNST')","select":"@addProperty(\r\n        json('{}'), \r\n        'soapenv:Envelope', \r\n        addProperty(\r\n\t\t\taddProperty(\r\n\t\t\t    addProperty(\r\n\t\t\t\t\tjson('{}'), \r\n\t\t\t\t\t'soapenv:Body', \r\n\t\t\t\t\taddProperty(\r\n\t\t\t\t\t\tjson('{}'), \r\n\t\t\t\t\t\t'log:InsertShipStaff', \r\n\t\t\t\t\t\titem()\r\n\t\t\t\t\t)\r\n\t\t\t\t), \r\n\t\t\t\t'@xmlns:log', \r\n\t\t\t\t'urn:microsoft-dynamics-schemas/codeunit/LogicAppsIntegration'\r\n\t\t\t), \r\n            '@xmlns:soapenv', \r\n            'http://schemas.xmlsoap.org/soap/envelope/'\r\n        )\r\n    )"},"runAfter":{"jsonArrCNST":["Succeeded"]},"metadata":{"operationMetadataId":"d987eb8c-24ef-4a6f-ab76-4b03803fb114"}},"Apply_to_each":{"type":"Foreach","foreach":"@body('Select')","actions":{"xml":{"type":"Compose","inputs":"@xml(items('Apply_to_each'))","runAfter":{},"metadata":{"operationMetadataId":"68259fd9-2ebf-43a4-9a0c-5fe13ae6d2b1"}},"json":{"type":"Compose","inputs":"@items('Apply_to_each')","runAfter":{"xml":["Succeeded"]},"metadata":{"operationMetadataId":"138d555d-4694-4661-909a-66a8317625fd"}}},"runAfter":{"Select":["Succeeded"]},"metadata":{"operationMetadataId":"57718199-6009-49fb-9ec9-6b46b0268476"}}},"runAfter":{},"metadata":{"operationMetadataId":"3a311d2f-3724-4f59-bc1b-39a982775b33"}}}

THIS IS NOT A LICENSING QUESTION, BUT I CANNOT NOT PICK THAT CATEGORY
Categories:
xmlFunctionNotWor...

Your file is currently under scan for potential threats. Please wait while we review it for any viruses or malicious content.

I have the same question (0)
  • Suggested answer
    MichaelFP Profile Picture
    1,847 Super User 2025 Season 2 on at
    Unfortunately the xml() formula doesn't respect the namespace, you will need to using replace to cover that.

    Another option, that you can do it is to create a custom connector that using a C# code to read the XML and get the data.
     
  • eliotcole Profile Picture
    4,363 Moderator on at
    Cheers, MichaelFP ... but ... yeah, that's not going to fly, unfortunately.
     
    That said, I'm mostly working in Logic Apps, these days, so I can go in other directions relatively easily.

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

#2
Tomac Profile Picture

Tomac 324 Moderator

#3
abm abm Profile Picture

abm abm 232 Most Valuable Professional

Last 30 days Overall leaderboard