SwiftFilter

1.配置规则

使用SwiftFilter进行变长有分隔符字符串报文的解析。 解析Switf报文 swift公共部分解析: 收报行解析,etag配置为rcvbic 发报行解析,etag配置为sndbic; 电报输入参考号,etag配置为mir; 电报输出参考号,etag配置为mor; 报文类型,etag配置为mty; 报尾,etag配置为trl; XXX,etag配置为prt; swift 报文4域解析: 报文中不会出现循环的解析以NO为准,例如NO20的etag配置为4.20,类型为String; 如果出现循环但是不在sequence中的话,例如NO20的etag配置为4.#20,#,71F,#20代表NO20,#代表循环次数,71F为域名; 如果出现循环并且在sequence中,例如4.A,#,#6,#,98A代表sequenceA为第一层循环,NO6,为第二层循环,98A为域名; 如果出现循环的类型一律配置为String[],结果都会发在tag命名的数组中。

2.示例

<?xml version="1.0" encoding="UTF-8"?>
<root xmlns="http://www.brilliance.com.cn/interface" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.brilliance.com.cn/interface ../etc/schema/interface.xsd">
   <interface id="swift"  basePackage="com.brilliance.eibs.core.service.instance.impl" version="1">
       <transaction id="swifttest" >
           <process>
               <step id="parseswift" />
               <step id = "dparseswift"/>
           </process>
           <step id="parseswift">
              <connection ref="fileConnection" type="in">
                   <property name="path" value="D:/li700001.txt" />
               </connection>
               <filter ref="swiftfilter" type="in">
                   <field tag = "rcvbic" etag ="rcvbic" type ="String" scope ="transaction" description="收报行"/>
                   <field tag = "sndbic" etag ="sndbic" type ="String" scope ="transaction" description="发报行"/>
                   <field tag = "trl" etag ="trl" type ="String" scope ="transaction" description="报尾"/>
                   <field tag = "prt" etag ="prt" type ="String" scope ="transaction" description=""/>
                   <field tag = "mir" etag ="mir" type = "String" scope ="transaction" description="电报输入参号"/>
                   <field tag = "mor" etag ="mor" type ="String" scope ="transaction" description="电报输出参号"/>
                   <field tag = "direct" etag ="direct" type ="String" scope ="transaction" />
                   <field tag="mty" etag="mty" type="String" scope="transaction" description="报文类型"/>
                   <!-- 不含sequence示例  -->
                   <field tag="A20" etag="4.20" type="String" scope="transaction" />
                   <field tag="A23B" etag="4.23B" type="String" scope="transaction" />
                   <!-- #20代表NO.20 -->
                   <field tag="A71F" etag="4.#20,#,71F" type="String[]" scope="transaction" />
                   <!-- 含有sequence示例  -->
                   <field tag="A28E" etag="4.A,#,28E" type="String[]" scope="transaction" />
                   <field tag="A98A" etag="4.A,#,#6,#,98A" type="String[]" scope="transaction" />
                   <field tag="B22F" etag="B,#,B1,#,B1a,#,#25,#,22F" type="String[]" scope="transaction" /> 
               </filter>
           </step>
           <step id = "dparseswift">
               <filter ref = "swiftfilter" type = "in" >
                   <field tag="size" value ="${getSize()}" >
                       <argument id ="1" value ="${A71F}" />
                   </field>
                   <foreach tag="i" begin="0" end="${size}" step="1" condition="${next()}">
                       <field tag= "TA71F"  value="A71F[i]" type = "String" />
                   </foreach>
               </filter>
           </step>
       </transaction>
   </interface>
</root>

results matching ""

    No results matching ""