ponomandr
ponomandr

Reputation: 1534

How to tell Digester to stop parsing XML?

I use Apache digester to parse a big XML file. I need to gracefully stop parsing the XML when some particular tag value is found. In my case it's a kind of metadata at the beginning of the XML.

The only solution I've found so far is to create a rule which throws an Exception. But I feel it is rather hack than proper solution.

Can I tell the Digester to stop processing and skip the rest of XML?

Upvotes: 0

Views: 106

Answers (1)

Jim Garrison
Jim Garrison

Reputation: 86774

You are looking for a way to short-circuit normal processing when a terminating condition is encountered. An exception, which you catch in the driver, is the way to go.

Upvotes: 1

Related Questions