首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >连接多个XML文件

连接多个XML文件
EN

Stack Overflow用户
提问于 2021-09-23 00:23:55
回答 1查看 79关注 0票数 0

我的azure BLOB存储帐户中有多个XML文件,它们都具有相同的格式,是否可以使用Logic App将它们全部连接到单个XML文件中?我尝试过使用concat,但它超过了104,857,600个字符的限制,所以我真的需要附加到现有的BLOB文件中,但我似乎只能选择创建/更新,这两个选项都会覆盖它。

例如,文件1可能如下所示:

代码语言:javascript
复制
<?xml version="1.0" encoding="utf-8"?>
<enfinity xsi:schemaLocation="http://www.intershop.com/xml/ns/enfinity/7.0/xcs/impex catalog.xsd http://www.intershop.com/xml/ns/enfinity/6.5/core/impex-dt dt.xsd" major="6" minor="1" family="enfinity" branch="enterprise" build="build" xmlns="http://www.intershop.com/xml/ns/enfinity/7.0/xcs/impex" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dt="http://www.intershop.com/xml/ns/enfinity/6.5/core/impex-dt">
  <offer sku="123456777">
    <custom-attributes>
      <custom-attribute name="parentcolour" dt:dt="string" xml:lang="en-US">Green</custom-attribute>
      <custom-attribute name="parentcolour" dt:dt="string" xml:lang="de-DE">Grün</custom-attribute>
    </custom-attributes>
  </offer>
</enfinity>

而文件2可能如下所示:

代码语言:javascript
复制
<?xml version="1.0" encoding="utf-8"?>
<enfinity xsi:schemaLocation="http://www.intershop.com/xml/ns/enfinity/7.0/xcs/impex catalog.xsd http://www.intershop.com/xml/ns/enfinity/6.5/core/impex-dt dt.xsd" major="6" minor="1" family="enfinity" branch="enterprise" build="build" xmlns="http://www.intershop.com/xml/ns/enfinity/7.0/xcs/impex" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dt="http://www.intershop.com/xml/ns/enfinity/6.5/core/impex-dt">
  <offer sku="123456">
    <variations>
      <mastered-products>
        <mastered-product sku="123456777" domain="WhiteStuff-MasterRepository"/>
        <mastered-product sku="123456888" domain="WhiteStuff-MasterRepository"/>
      </mastered-products>
    </variations>
  </offer>
</enfinity>

我知道一个有<custom-attributes>,另一个有<variations>,但需要追加的是<offer sku=>块,所以整个文件应该是这样的:

代码语言:javascript
复制
<?xml version="1.0" encoding="utf-8"?>
<enfinity xsi:schemaLocation="http://www.intershop.com/xml/ns/enfinity/7.0/xcs/impex catalog.xsd http://www.intershop.com/xml/ns/enfinity/6.5/core/impex-dt dt.xsd" major="6" minor="1" family="enfinity" branch="enterprise" build="build" xmlns="http://www.intershop.com/xml/ns/enfinity/7.0/xcs/impex" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dt="http://www.intershop.com/xml/ns/enfinity/6.5/core/impex-dt">
  <offer sku="123456777">
    <custom-attributes>
      <custom-attribute name="parentcolour" dt:dt="string" xml:lang="en-US">Green</custom-attribute>
      <custom-attribute name="parentcolour" dt:dt="string" xml:lang="de-DE">Grün</custom-attribute>
    </custom-attributes>
  </offer>
  <offer sku="123456">
    <variations>
      <mastered-products>
        <mastered-product sku="123456777" domain="WhiteStuff-MasterRepository"/>
        <mastered-product sku="123456888" domain="WhiteStuff-MasterRepository"/>
      </mastered-products>
    </variations>
  </offer>
</enfinity>

如果有帮助,出现在一个文件中的SKU将永远不会出现在单独的文件中。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-09-24 17:50:55

基于您的共享需求,我复制了相同的内容,以下是它在我身上的工作方式:

我从存储中检索了blob >添加了Compose Connector with json function >,然后将其解析为json >,然后使用定制的json将其合并为一个,并相应地添加值

以下是流程的屏幕截图,供您参考:

最后,您需要再次将变量转换为XML,以获得所需的格式

参考资料:azure functions - Merge multiple XML files of same structure into single xml in logic apps - Stack Overflow

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/69292591

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档