디스크에서 읽은 Simple XMl 파일을 구문 분석하고이를 JSON으로 변환하고 Mulesoft를 사용하여 파일에 다시 저장하려고합니다. 노새 flow.xml, 난 점점 오전 내가 노새 프로젝트를 실행하면mulesoft를 사용하여 XML 파일 구문 분석
<Names>
<Name>
<title>bnbnbha</title>
<firstname>aa</firstname>
<lastname>aaa</lastname>
</Name>
<Name>
<title>bjkjkjk</title>
<firstname>bb</firstname>
<lastname>bbb</lastname>
</Name>
<Name>
<title>hjhjhc</title>
<firstname>cc</firstname>
<lastname>ccc</lastname>
</Name>
<Name>
<title>djkjkj</title>
<firstname>dd</firstname>
<lastname>ddd</lastname>
</Name>
</Names>
같은 모습을 구문 분석하려고
<file:connector name="File" autoDelete="false" streaming="true" validateConnections="true" doc:name="File"/>
<file:connector name="File1" outputPattern="sample1.txt" autoDelete="false" streaming="true" validateConnections="true" doc:name="File"/>
<flow name="datatranformerFlow">
<file:inbound-endpoint path="C:\Madhu" name="sample.xml" responseTimeout="10000" doc:name="File" connector-ref="File"/>
<file:file-to-string-transformer mimeType="application/xml" doc:name="File to String"/>
<splitter expression="#[xpath3('/Names/Name')]" doc:name="Splitter"/>
<json:xml-to-json-transformer doc:name="XML to JSON"/>
<file:outbound-endpoint path="C:\Madhu\GV dev documents\WD files" connector-ref="File1" responseTimeout="10000" doc:name="File"/>
</flow>
샘플 XML 파일과 같은 방법
입니다 예외 :
INFO 2016-07-29 11 : 56 : 25,287 [[datatranformer] .File.receiver.01] org.mule.transport.file.FileMessageReceiver : 파일 : C : \ Madhu \ sample에서 획득 한 잠금. xxxx INFO 2016-07-29 11 : 56 : 26,193 [datatranformer] .datatranformerFlow.stage1.02] org.mule.routing.ExpressionSplitter : 표현식이 분할 될 수있는 유형으로 평가되지 않습니다. java.lang.String 오류 : '예기치 않은 문자'b '(코드 98)가 프롤로그에 있습니다. 예상 '<' [행, 열 {unknown-source}] : [2,3] ' 오류 2016-07-29 11 : 56 : 26,272 [[datatranformer] .datatranformerFlow.stage1.02] org.mule. exception.DefaultMessagingExceptionStrategy :
메시지 : com.ctc.wstx.exc.WstxUnexpectedCharException : 프롤로그 예기치 문자 'B'(번호 98); 에서 '<' 예상 [행, COL {알 수없는 소스}] : [2,3] (javax.xml.transform.TransformerException) 페이로드 : bnbnbha AA AAA
내가 뭐하는 거지 뭔가가 있나요 잘못된 ?
이을에 JSON하여 작업을 수행 할 수 있습니다 메시지 구성 요소