William Brogden wrote:I think that trying to re-use a SAX parser would be a mistake. But note that you can re-use the same instance of SAXParserFactory.
Perhaps you meant re-use the same handler for the SAX events? That would indeed lead to a mess.
If this was my problem I would look into the Apache Commons Digester project.
Bill
Thanks for your reply.
Yes, what I consider is to re-use the same handler for SAX events. I think there would be a mess too. I am still looking for the better tool than SAX.
The reason I use SAX is because my app should handle different structure of xml. So I should create a lot of objects for one xml file if I use Digester. If a lot of xml files, I create a lot of objects, thats heavy. For SAX, I just add a lot of if statement in the startElement() method for searching for a tag or attributes.