<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:tracking="http://www.mulesoft.org/schema/mule/ee/tracking" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns:file="http://www.mulesoft.org/schema/mule/file" 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" version="EE-3.5.0"
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/file http://www.mulesoft.org/schema/mule/file/current/mule-file.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/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:namespace-manager includeConfigNamespaces="true">
<mulexml:namespace prefix="ns0" uri="http://www.cpscreen.com/schemas"/>
</mulexml:namespace-manager>
<configuration doc:name="Configuration">
<expression-language autoResolveVariables="true">
<import class="org.mule.util.StringUtils" />
<import class="org.mule.util.ArrayUtils" />
</expression-language>
</configuration>
<flow name="user_provisions_-_xml_postFlow1" doc:name="user_provisions_-_xml_postFlow1">
<file:inbound-endpoint path="E:/temp/mule" responseTimeout="10000" doc:name="File">
<file:filename-regex-filter pattern="in_(.*).csv" caseSensitive="true"/>
</file:inbound-endpoint>
<file:file-to-string-transformer doc:name="File to String"/>
<expression-component doc:name="Expression"><![CDATA[java.util.List items = new java.util.ArrayList(Arrays.asList(payload.split("\n")));
items.remove(0);;
java.lang.String listString = '';
for (String s : items) {
listString += s + "\n";
}
payload=listString.trim();]]></expression-component>
<http:outbound-endpoint exchange-pattern="request-response" host="localhost" port="46908" path="userprovision" method="POST" doc:name="HTTP"/>
<object-to-string-transformer mimeType="text/xml" doc:name="Object to String"/>
<splitter expression="#[xpath('//UpdateUserRequest')]" doc:name="Splitter"/>
<logger message="Here is #[payload]" level="INFO" doc:name="Logger"/>
</flow>
</mule>
我越来越喜欢,如何拆分Mule Anypoint中的XML?
WARN 2014-09-10 15:30:27,181 [[user_provisions_-_xml_post].user_provisions_-_xml_postFlow1.stage1.02] org.mule.routing.ExpressionSplitter: Splitter returned no results. If this is not expected, please check your split expression
更新:
我得到了其中的问题是,但我可以解决分裂问题。由于namespace
在XML分路器不评估分割表达...
<?xml version="1.0" encoding="UTF-8"?>
<UpdateUserRequests xmlns="http://www.cpscreen.com/schemas">
<UpdateUserRequest userId="Test" account="Test" password="Test">
<User>
<Account id="4">34567</Account>
<UserId>Test</UserId>
<Profile>Admin</Profile>
<PersonName>
<GivenName>Sahak</GivenName>
<FamilyName>Kn</FamilyName>
</PersonName>
</User>
</UpdateUserRequest>
<UpdateUserRequest userId="Test" account="Test" password="Test">
<User>
<Account id="5">12345</Account>
<UserId>Test</UserId>
<Profile>Admin</Profile>
<PersonName>
<GivenName>Arun</GivenName>
<FamilyName>Kumar</FamilyName>
</PersonName>
</User>
</UpdateUserRequest>
</UpdateUserRequests>
的如果我删除xmlns="http://www.cpscreen.com/schemas"
这是拆分到多个
如何添加吐表达式,如果有一个命名空间中xml?
我不能这样做,因为我正在向其他ESB发送CSV数据(因为Mule数据映射器已付款),并且它返回了我的xml。我需要拆分XML并阅读 – Sahal 2014-09-10 11:30:57
我得到了我所面临的问题..更新了项目。名称空间在xml中存在,这是它没有拆分的原因 – Sahal 2014-09-10 11:31:41