2014-09-29 65 views
0

試圖通過smooks將EDI-to-xml轉換。同時轉換到smooks xml的字段分隔符有一些問題。EDI到Xml的smooks轉換問題

<medi:edimap xmlns:medi="http://www.milyn.org/schema/edi-message-mapping-1.4.xsd"> 

    <medi:description name="Invoice" version="1.0"></medi:description> 

    <medi:delimiters segment="~" field="<" component="^" sub-component="~"/> 

... ... EDI文件格式是這樣: ...

SE<17<340001~ 
GE<4<34~ 

... 以下字段分隔符爲 '<'。以上代碼適用於除此之外的其他符號。 但是,當我使用'<'給出錯誤如下。

ERROR:[09-29-2014 04:05:07 PM]:[org.mule.exception.AbstractExceptionListener:267]: 
Caught exception in Exception Strategy: Unable to filter InputStream for target profile [org.milyn.profile.Profile#default_profile]. 
org.milyn.SmooksException: Unable to filter InputStream for target profile [org.milyn.profile.Profile#default_profile]. 
     at org.milyn.delivery.dom.SmooksDOMFilter.filter(SmooksDOMFilter.java:294) 
     at org.milyn.delivery.dom.SmooksDOMFilter.doFilter(SmooksDOMFilter.java:243) 
     at org.milyn.delivery.dom.SmooksDOMFilter.doFilter(SmooksDOMFilter.java:216) 
     at org.milyn.Smooks._filter(Smooks.java:516) 
     at org.milyn.Smooks.filterSource(Smooks.java:475)...... 
..... 
... 
Caused by: org.milyn.edisax.EDIConfigurationException: Error parsing EDI Mapping Model [<?xml version="1.0" encoding="UTF-8"?> 
+0

這似乎是一個危險的分隔符使用,考慮到所涉及的應用程序的XML特性。另外,你會不會遇到與段和子組件是相同的分隔符的麻煩? – Andrew 2014-09-29 20:53:56

+1

對smooks一無所知,但在XMl文檔中,您必須將'<'字符作爲'<'轉義。 – 2014-09-29 20:58:23

回答

0
&lt; worked for me. 

Some other escape characters 
" &quot; 
' &apos; 
< &lt; 
> &gt; 
& &amp;