<Body>
<ProductMasterDataStatus>
<Status>INVALID</Status>
<Errors>
<Error source="HUB">
<Description>Data Validation Error (Product code length is invalid.)</Description>
<Code>#A16</Code>
</Error>
</Errors>
</ProductMasterDataStatus>
</Body>
&#13;
我想检查ProductMasterDataStatus是否在这个xml中,如果它在那里我想改变驼峰路线中的路线。
<camelContext id="cbr-example-context" xmlns="http://camel.apache.org/schema/spring">
<route id="_route1">
<from id="_from1" uri="file:///d:/in"/>
<camel:choice id="_choice1">
<camel:when id="_when1">
<camel:xpath>
</camel:xpath>
<camel:to id="_to1" uri="file:C:/outbox_Denmark"/>
</camel:when>
<process id="_process_transform" ref="myTransform"/>
<to id="_to1" uri="file:///d:/out?fileName=Product.xml"/>
</route>
&#13;
答案 0 :(得分:0)
xpath表达式是 // ProductMasterDataStatus ,因此您应该检查它是否为空。
<camelContext id="cbr-example-context" xmlns="http://camel.apache.org/schema/spring">
<route id="_route1">
<from id="_from1" uri="file:///d:/in"/>
<camel:choice id="_choice1">
<camel:when id="_when1">
<camel:xpath>//ProductMasterDataStatus != null</camel:xpath>
<camel:to id="_to1" uri="file:C:/outbox_Denmark"/>
</camel:when>
<process id="_process_transform" ref="myTransform"/>
<to id="_to1" uri="file:///d:/out?fileName=Product.xml"/>
</route>