|
View:
New views
3 Messages
—
Rating Filter:
Alert me
|
|
|
Terminating the SAX filtering process
Hi there.
Something that has been asked for on a few occasions is the ability to terminate the SAX filtering before reaching the end of the message. I just had a look at this and it's really easy to do. I created a TerminateVisitor and a TerminateException (RuntimeException). I added it as part of the new core configuration and it looks like... Or...<?xml version="1.0"?> <smooks-resource-list xmlns="http://www.milyn.org/xsd/smooks-1.1.xsd" xmlns:core="http://www.milyn.org/xsd/smooks/smooks-core-1.3.xsd"> <!-- Visitors... --> <core:terminate onElement="customer" /> </smooks-resource-list> <?xml version="1.0"?> <smooks-resource-list xmlns="http://www.milyn.org/xsd/smooks-1.1.xsd" xmlns:core="http://www.milyn.org/xsd/smooks/smooks-core-1.3.xsd"> <!-- Visitors... --> <core:terminate onElement="customer" terminateBefore="true" /> </smooks-resource-list> Works fine I think. Any reason anyone can think of to not add this? I'm going to check it in for now and we can roll it back out if we discover something. Regards, T. |
|
|
Re: Terminating the SAX filtering processHey Tom,
Great that this feature got implemented. Does the TerminateException go all the way through and you need to catch it or does Smooks catch it for you? Do the conditionals also work on this? M. On Sat, Nov 7, 2009 at 12:38 PM, Tom Fennelly <tom.fennelly@...> wrote:
|
|
|
Re: Terminating the SAX filtering processHey Maurice.
Smooks handles the exception. As far as the user is concerned, they have no idea that the exception is the mechanism for terminating. The conditionals should work same as for any other visitor. Also, the new XPath selectors will be useful for this. T. Maurice Zeijen wrote: > Hey Tom, > > Great that this feature got implemented. Does the TerminateException > go all the way through and you need to catch it or does Smooks catch > it for you? Do the conditionals also work on this? > > M. > > > On Sat, Nov 7, 2009 at 12:38 PM, Tom Fennelly <tom.fennelly@... > <mailto:tom.fennelly@...>> wrote: > > Hi there. > > Something that has been asked for on a few occasions is the > ability to terminate the SAX filtering before reaching the end of > the message. I just had a look at this and it's really easy to > do. I created a TerminateVisitor and a TerminateException > (RuntimeException). I added it as part of the new core > configuration and it looks like... > > <?xml version="1.0"?> > <smooks-resource-list xmlns="http://www.milyn.org/xsd/smooks-1.1.xsd" <http://www.milyn.org/xsd/smooks-1.1.xsd> > xmlns:core="http://www.milyn.org/xsd/smooks/smooks-core-1.3.xsd" <http://www.milyn.org/xsd/smooks/smooks-core-1.3.xsd>> > > <!-- Visitors... --> > > <core:terminate onElement="customer" /> > > </smooks-resource-list> > > > Or... > > <?xml version="1.0"?> > <smooks-resource-list xmlns="http://www.milyn.org/xsd/smooks-1.1.xsd" <http://www.milyn.org/xsd/smooks-1.1.xsd> > xmlns:core="http://www.milyn.org/xsd/smooks/smooks-core-1.3.xsd" <http://www.milyn.org/xsd/smooks/smooks-core-1.3.xsd>> > > <!-- Visitors... --> > > <core:terminate onElement="customer" terminateBefore="true" /> > > </smooks-resource-list> > > > > Works fine I think. Any reason anyone can think of to not add > this? I'm going to check it in for now and we can roll it back > out if we discover something. > > Regards, > > T. > > --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
| Free embeddable forum powered by Nabble | Forum Help |