简体   繁体   English

如何在 Azure 逻辑应用程序上将 xml 数据转换为 csv

[英]How to transform xml data to csv on Azure logic app

I am trying to grab the XML from the URI below and transform it into a csv file.我正在尝试从下面的 URI 中获取 XML 并将其转换为 csv 文件。 How do I go about doing this with an Azure Logic app?我如何使用 Azure Logic 应用程序执行此操作?

https://reportservices.crediblebh.com/reports/ExportService.asmx/ExportXML?connection=Y!KcFwIoIa1BZLzJnKfEshACoW10Rtw!DmvWxFkFgsUiJmP34wHKBMB9VD1YcnuRPQewAfLGSdDOiQXdvGiURA__&start_date=&end_date=&custom_param1=&custom_param2=&custom_param3= https://reportservices.crediblebh.com/reports/ExportService.asmx/ExportXML?connection=Y!KcFwIoIa1BZLzJnKfEshACoW10Rtw!DmvWxFkFgsUiJmP34wHKBMB9VD1YcnuRPQewAfLGSdDOiQXdvGiURA__&start_date=&end_date=&custom_param1=&custom_param2=&custom_param3=

Step 1 in my Logic app is a HTTP trigger using the GET method:我的逻辑应用程序中的第 1 步是使用 GET 方法的 HTTP 触发器:

HTTP trigger with GET method and URI containing the XML I want to parse HTTP 触发器与 GET 方法和 URI 包含 XML 我想解析

When I run Step 1 I get the following:当我运行第 1 步时,我得到以下信息:

Result after running Step 1运行步骤 1 后的结果

Essentially I want to parse the Body of of the HTTP trigger (Step 1) into a csv file.本质上,我想将 HTTP 触发器(步骤 1)的主体解析为 csv 文件。 In other words I want to transform this:换句话说,我想改变这个:

<?xml version="1.0" encoding="utf-8"?>
<string xmlns="https://www.crediblebh.com/">&lt;NewDataSet&gt;
  &lt;Table&gt;
    &lt;client_id&gt;-99999&lt;/client_id&gt;
    &lt;clientprogramscount&gt;80066&lt;/clientprogramscount&gt;
    &lt;teamclientcount&gt;68247&lt;/teamclientcount&gt;
    &lt;employeeclientscount&gt;40415&lt;/employeeclientscount&gt;
    &lt;questioncount&gt;190954&lt;/questioncount&gt;
    &lt;answercount&gt;463010&lt;/answercount&gt;
    &lt;delvisitcount&gt;7484&lt;/delvisitcount&gt;
    &lt;savedvisitanswercount&gt;6950104&lt;/savedvisitanswercount&gt;
    &lt;cntclientsext&gt;60330&lt;/cntclientsext&gt;
    &lt;cntclientepisode&gt;68069&lt;/cntclientepisode&gt;
    &lt;cntclientvisit&gt;487500&lt;/cntclientvisit&gt;
    &lt;cntchangelog&gt;13231067&lt;/cntchangelog&gt;
    &lt;cntchangelogdetail&gt;1272642&lt;/cntchangelogdetail&gt;
    &lt;cntclientvisitapproval&gt;29540&lt;/cntclientvisitapproval&gt;
  &lt;/Table&gt;
&lt;/NewDataSet&gt;</string>

into the following csv:进入以下 csv:

client_id,clientprogramscount,teamclientcount,employeeclientscount,questioncount,answercount,delvisitcount,savedvisitanswercount,cntclientsext,cntclientepisode,cntclientvisit,cntchangelog,cntchangelog,cntchangelogdetail,cntclientvisitapproval -99999,80066,68247,40415,190954,463010,7484,6950104,60330,68069,487500,13231067,13231067,1272642,29540 client_id,clientprogramscount,teamclientcount,employeeclientscount,questioncount,answercount,delvisitcount,savedvisitanswercount,cntclientsext,cntclientepisode,cntclientvisit,cntchangelog,cntchangelog,cntchangelogdetail,cntclientvisitapproval -99999,80066,68247,40415,190954,650010,74834,65010,74834, 487500,13231067,13231067,1272642,29540

Sorry that I can't show the actual images in my post because apparently I don't have enough reputation points to embed actual images yet.抱歉,我无法在帖子中显示实际图像,因为显然我还没有足够的声誉点来嵌入实际图像。

Thanks in advance for your help!在此先感谢您的帮助!

You many want to use "Flat File Encoding" action in Logic App.许多人想在 Logic App 中使用“平面文件编码”操作。

For this, you should create a schema, which would map the XML fields into CSV format that you require -> place that schema in Integration Account -> use this schema in "Flat File Encoding" action in Logic App to transform XML data to CSV format. For this, you should create a schema, which would map the XML fields into CSV format that you require -> place that schema in Integration Account -> use this schema in "Flat File Encoding" action in Logic App to transform XML data to CSV格式。 Take a look at this Encode and decode flat files in Azure Logic Apps by using the Enterprise Integration Pack 使用企业集成包查看 Azure 逻辑应用程序中的此编码和解码平面文件

If Integration Account option seems expensive, use a custom Azure Function that does the schema functioning (XML->CSV) and use Azure Function action in Logic App. If Integration Account option seems expensive, use a custom Azure Function that does the schema functioning (XML->CSV) and use Azure Function action in Logic App.

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM