File Mule更改文件名/扩展名以在拆分后存储多个文件
我正在尝试拆分xml并将其存储为不同的文件。如果我没有在文件名/模式选项中指定任何内容,文件将以.dat格式正确存储。但我希望这些文件以.xml格式存储,比如a1.xml、a2.xml、a3.xml 这是我正在尝试的流程File Mule更改文件名/扩展名以在拆分后存储多个文件,file,mule,splitter,filepattern,File,Mule,Splitter,Filepattern,我正在尝试拆分xml并将其存储为不同的文件。如果我没有在文件名/模式选项中指定任何内容,文件将以.dat格式正确存储。但我希望这些文件以.xml格式存储,比如a1.xml、a2.xml、a3.xml 这是我正在尝试的流程 <?xml version="1.0" encoding="UTF-8"?> <mule xmlns:json="http://www.mulesoft.org/schema/mule/j
<?xml version="1.0" encoding="UTF-8"?>
<mule
xmlns:json="http://www.mulesoft.org/schema/mule/json"
xmlns:tracking="http://www.mulesoft.org/schema/mule/ee/tracking"
xmlns:file="http://www.mulesoft.org/schema/mule/file"
xmlns:http="http://www.mulesoft.org/schema/mule/http"
xmlns:mulexml="http://www.mulesoft.org/schema/mule/xml"
xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
xmlns:spring="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/file http://www.mulesoft.org/schema/mule/file/current/mule-file.xsd
http://www.mulesoft.org/schema/mule/xml http://www.mulesoft.org/schema/mule/xml/current/mule-xml.xsd
http://www.mulesoft.org/schema/mule/ee/tracking http://www.mulesoft.org/schema/mule/ee/tracking/current/mule-tracking-ee.xsd
http://www.mulesoft.org/schema/mule/json http://www.mulesoft.org/schema/mule/json/current/mule-json.xsd">
<http:listener-config name="HTTP_Listener_Configuration" host="0.0.0.0" port="8081" doc:name="HTTP Listener Configuration"/>
<flow name="splitterprojectFlow">
<http:listener config-ref="HTTP_Listener_Configuration" path="/splitter" allowedMethods="POST" doc:name="HTTP"/>
<splitter expression="#[xpath('//Employee')]" doc:name="Splitter"></splitter>
<mulexml:dom-to-xml-transformer doc:name="DOM to XML"/>
<file:outbound-endpoint path="src/test/resources" outputPattern=".xml" responseTimeout="10000" doc:name="File"/>
</flow>
</mule>
您的outputPattern属性只是“.xml”。如果查看src/test/resources,您可能会发现一个名为.xml的文件,其中包含最后一次拆分的内容 您需要证明outputPattern属性的表达式,类似于:
<mulexml:dom-to-xml-transformer doc:name="DOM to XML"/>
<file:outbound-endpoint path="src/test/resources" outputPattern="#[xpath3("//name",payload)].xml" responseTimeout="10000" doc:name="File"/>
</flow>