Spring Integration xpath表达式多条件检查

时间:2017-03-23 02:57:25

标签: spring xpath spring-integration

我有一个我想要过滤的SAP IDOC,但我被困在一个地方。

这是一个示例XML

    <E1EDK14 SEGMENT="1">
        <QUALF>007</QUALF>
        <ORGID>10</ORGID>
    </E1EDK14>
    <E1EDK14 SEGMENT="1">
        <QUALF>008</QUALF>
        <ORGID>BP01</ORGID>
    </E1EDK14>
    <E1EDK14 SEGMENT="1">
        <QUALF>012</QUALF>
        <ORGID>ZMOR</ORGID>
    </E1EDK14>

条件会像

那样

如果QUALF = 12且ORGID = ZOR,则处理else忽略

我的代码是这样的

<int-xml:xpath-router id="splitORGID" input-channel="ORDERS" evaluate-as-string="true" resolution-required="false" default-output-channel="ORDER-TYPE-NOT-SUPPORTED">
    <int-xml:xpath-expression id="splitORGIDExpression" expression="//E1EDK14/ORGID" />
    <int-xml:mapping value="ZOR" channel="ALLOW_ORDERS" />
</int-xml:xpath-router>

我想知道这是否正确。

1 个答案:

答案 0 :(得分:0)

这是我提出的解决方案,它运行良好

<int-xml:xpath-router id="splitORGID" input-channel="CUSTORDERS" evaluate-as-string="true" resolution-required="false" default-output-channel="ORDERTYPE-NOTSUPPORTED-KTOKD">
    <int-xml:xpath-expression id="splitORGIDExpression" expression="//E1EDK14[QUALF=012]/ORGID" />
    <int-xml:mapping value="ZOR" channel="ORDERS" />
    <int-xml:mapping value="ZSCO" channel="ORDERS" />
    <int-xml:mapping value="ZMOR" channel="HISTORICALORDERS" />
</int-xml:xpath-router>