Search code examples
exceptionxml-parsingsmooks

Exception throwing in smooks


Is it possible to throw an Exception in the smooks configuration file. Example if in an xml of order,

<order id="332">
<header>
    <customer number="123">Joe</customer>
</header>
<order-items>
    <order-item id='1'>
        <product>1</product>
        <quantity>2</quantity>
        <price>8.80</price>
    </order-item>
</order-items>
</order>

If the node <order-items> is not present then an exception should be thrown or an error should arise. Is there an option to do that in Smooks configuration file??


Solution

  • You could look at the validation cartridge. See the user guide.