Ankur Garg
Ankur Garg

Reputation: 49

how to parse xml using sax parser in java?

In a loop, each time i need to parse a new xml and in xml i have to parse some specific nodes, if they has value then copy them to another file else keep going until the last xml, how to do it ?

Upvotes: 1

Views: 448

Answers (1)

Michael Kay
Michael Kay

Reputation: 163587

The essence of Sax is that you don't own the flow of control: when you say "in a loop", you are hinting that you want the flow of control. With Sax, the parser calls you when it's ready to do so. If you want to be in control, try using a pull parser (Stax, for example Woodstox).

Upvotes: 1

Related Questions