Best way to check for well formed XML in Mule (3.4) -
what current best approach checking incoming xml message formed in mule?
for example if send badly formed (or non) xml choice mule throws error , flow stops:
<choice> <when expression="#[xpath('fn:count(//event/@publicid)') != 0]"> ....
the error like:
[fatal error] :1:1: content not allowed in prolog. java.lang.runtimeexception: org.mule.api.muleruntimeexception: failed evaluate xpath expression: "fn:count(//event/@publicid)" @ org.mule.module.xml.el.xpathfunction.call(xpathfunction.java:50)
and, alternatively, there way catch , ignore error in flow? i've tried exception strategies per docs , got no where.
thanks, geoff
you might have solved now, there's convenient filter in mule xml module may help:
<mulexml:is-xml-filter />
this filters out non/bad xml. can use message-filter route dlq or throw exception etc.
also can catch exception follows:
<choice-exception-strategy> <catch-exception-strategy when="#[exception.causedby(org.mule.api.muleruntimeexception)]"> <logger level="error" message="not xml" /> </catch-exception-strategy> </choice-exception-strategy>
Comments
Post a Comment