【发布时间】:2013-11-27 17:29:21
【问题描述】:
我为 Mule 流程输入了复杂的大型 XML 文件。
文件结束点->字节数组转字符串->拆分器-> ....
当我尝试使用 Splitter 组件处理输入文件时,我得到 org.xml.sax.SAXParseException: Content is not allowed in prolog。当我创建新的 xml 文件并将原始文件的内容复制到文件时,会处理输入文件。 我在创建新文件时删除了 BOM 标记。原始文件从文件开头就有EF BB BF,本地文件没有。
骡配置:
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:tracking="http://www.mulesoft.org/schema/mule/ee/tracking"
xmlns:mulexml="http://www.mulesoft.org/schema/mule/xml"
xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
xmlns:spring="http://www.springframework.org/schema/beans" version="EE-3.4.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.mulesoft.org/schema/mule/file
http://www.mulesoft.org/schema/mule/file/current/mule-file.xsd
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/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">
<mulexml:dom-to-xml-transformer name="domToXml"/>
<flow name="SplitterFlow1" doc:name="SplitterFlow1">
<file:inbound-endpoint path="D:\WORK\Input"
moveToDirectory="D:\WORK\Output"
responseTimeout="10000" doc:name="File" fileAge="200" encoding="UTF-8"/>
<byte-array-to-string-transformer doc:name="Byte Array to String" />
<splitter evaluator="xpath" expression="/Invoices/invoice"
doc:name="Splitter"/>
<transformer ref="domToXml" doc:name="Transformer Reference"/>
<tracking:custom-event event-name="Invoice ID" doc:name="Custom Business event">
</tracking:custom-event>
<logger level="INFO" doc:name="Logger"/>
<file:outbound-endpoint path="D:\WORK\Output"
outputPattern="#[function:dateStamp:dd-MM-yyyy-HH.mm.ss]-#[header:OUTBOUND:MULE_CORRELATION_SEQUENCE]"
responseTimeout="10000" doc:name="File"></file:outbound-endpoint>
</flow>
</mule>
请告诉我如何在 Mule 流程中做到这一点。提前谢谢你。
【问题讨论】:
-
添加您的配置以便更好地理解。
-
Mule 配置已添加
标签: parsing mule sax byte-order-mark