Reputation: 16219
I have simple logic app with Transform_XML
in which i'm giving input as java xml
data.
I want to replace a below string from that input java xml
.
'<?xml version=\"1.0\" encoding=\"utf-16\"?>'
to
'<?xml version=\"1.0\" encoding=\"utf-8\"?>
I tried using following into code view but its not working any clue ?
"Transform_XML": {
"inputs": {
"content": "@{xml(replace(string(triggerBody()),'<?xml version=\"1.0\" encoding=\"utf-16\"?>','<?xml version=\"1.0\" encoding=\"utf-8\"?>'))}",
"integrationAccount": {
"map": {
"name": "mytestmap"
}
}
},
"runAfter": {},
"type": "Xslt"
}
But at Xml Validation
it is giving error -
InvalidXml. The provided content must be of XML content type.
Upvotes: 0
Views: 371
Reputation: 11040
The replace() looks correct, but you probably don't need to use xml() at this point.
If the content from the Trigger is coming in as base64, you may need to do a base64ToString() first as replace() may be trying to act on the base64 content instead. Some Actions handle this correctly, other don't.
replace(base64ToString(triggerBody()),'',''))}"
But...be very careful changing the header like this since now you're obligated to send it as full UTF to any downstream clients.
Upvotes: 1