mapping a string containing xml in BizTalk

[亡魂溺海] 提交于 2019-12-01 11:14:53

I have tackled a similar issue in a project, where I have a series of 2 mappings (both native xslt).

The first map will map your input document to an intermediate format. This format has one "any" node (instead of the escaped XML node), where eventually, I put in the unescaped XML. I unescape using a C# extension object.
The C# code could just be a wrapper for System.Web.HttpUtility.HtmlDecode()

In the second mapping, you can map using plain XPath.

Example Input message:

<root>
  <someNode>blabla</someNode>
  <any>&lt;root2&gt;&lt;myValue&gt;escapedXml&lt;/myValue&gt;&lt;/root2&gt;</any>
</root>

Intermediate format:

<root>
  <someNode>blabla</someNode>
  <any>
    <root2>
      <myValue>escapedXml</myValue>
    </root2>
  </any>
</root>

In your second mapping, you could use XPaths like /root/any/root2/myValue/text() without any issue.

Important Note:

If you need to do XSD validation against this intermediate format, this is a good way to do this as well. You would just need to create the appropriate intermediate XSD according to your needs. In my case this was needed, so I had to validate this unescaped format using a receive pipeline execution in an orchestration.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!