首页 > 解决方案 > 我有一个布局相同的 xml 文件文件夹。我想将它们合并到一个文件中。有什么建议可以通过 sql server 做到这一点吗?

问题描述

文件 1 输入:

<?xml version="1.0" encoding="utf-8"?>
<saw:ibot xmlns:saw="com.siebel.analytics.web/report/v1.1" version="1" priority="normal" xmlns:cond="com.oracle.bi/conditions/v1" xmlns:sawx="com.siebel.analytics.web/expression/v1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" jobID="79" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><saw:schedule timeZoneId="(GMT-08:00) Pacific Time (US &amp; Canada); Tijuana"><saw:start startImmediately="false" date="2017-07-06" time="11:30:00"/><saw:recurrence runOnce="false"><saw:weekly weekInterval="2" thu="true"/></saw:recurrence></saw:schedule><saw:dataVisibility type="runAsUser" runAs="weblogic" runAsGuid="weblogic"/><cond:condition/><saw:choose><saw:when condition="true"><saw:deliveryContent disposition="attachment" format="excel2007"><saw:headline><saw:caption><saw:text>DO &amp; RVP</saw:text></saw:caption></saw:headline><saw:reportRef path="/shared/BJs Analytics/Agent/Reports/Dana DO &amp; RVP"/><saw:attachmentMessage><saw:caption><saw:text>DO &amp; RVP Report</saw:text></saw:caption></saw:attachmentMessage></saw:deliveryContent><saw:postActions/></saw:when><saw:otherwise><saw:postActions/></saw:otherwise></saw:choose><saw:deliveryDestinations><saw:destination category="pcemail"/></saw:deliveryDestinations><saw:recipients specificRecipients="true" subscribers="false" customize="false"><saw:specificRecipients><saw:user name="dtaylor" guid="dtaylor"/><saw:user name="eluster" guid="eluster"/></saw:specificRecipients><saw:subscribers/></saw:recipients><saw:emailRecipients/></saw:ibot>

文件 2 输入:

<?xml version="1.0" encoding="utf-8"?>
<saw:ibot xmlns:saw="com.siebel.analytics.web/report/v1.1" xmlns:cond="com.oracle.bi/conditions/v1" xmlns:sawx="com.siebel.analytics.web/expression/v1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1" priority="normal" jobID="145" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><saw:schedule timeZoneId="(GMT-08:00) Pacific Time (US &amp; Canada); Tijuana"><saw:start startImmediately="false" date="2017-07-06" time="11:30:00"/><saw:recurrence runOnce="false"><saw:weekly weekInterval="2" thu="true"/></saw:recurrence></saw:schedule><saw:dataVisibility type="runAsUser" runAs="weblogic" runAsGuid="weblogic"/><cond:condition/><saw:choose><saw:when condition="true"><saw:deliveryContent disposition="attachment" format="excel2007"><saw:headline><saw:caption><saw:text>Test Mail from bjri-obi-004</saw:text></saw:caption></saw:headline><saw:reportRef path="/shared/BJs Analytics/Agent/Reports/Dana DO &amp; RVP"/><saw:attachmentMessage><saw:caption><saw:text>DO &amp; RVP Report</saw:text></saw:caption></saw:attachmentMessage></saw:deliveryContent><saw:postActions/></saw:when><saw:otherwise><saw:postActions/></saw:otherwise></saw:choose><saw:deliveryDestinations><saw:destination category="pcemail"/></saw:deliveryDestinations><saw:recipients specificRecipients="true" subscribers="false" customize="false"><saw:specificRecipients><saw:user name="ereeh" guid="ereeh"/></saw:specificRecipients><saw:subscribers/></saw:recipients><saw:emailRecipients/></saw:ibot>

所需输出:

Is it possible to merge FILE 1 and FILE 2 XML via SQL query.

标签: sql-serverxml

解决方案


为什么要为此使用 SQL Server?只需使用能够将文件夹作为集合访问的 XQuery 引擎(如 Saxon 或 BaseX),然后使用查询

<merged>{collection('/my/folder/')}</merged>

推荐阅读