How to efficiently make a large XML file searchable in a web application?



I have an XML document and I need to make it searchable via a webapp. The document is currently only 6mb.. but could be extrememly large, thus from my research SAX seems the way to go.


So my question is, given a search term do I:




  1. Do I load the document in memory once (into a list of beans and then store it in memory)? And then search it when need be? or




  2. Parse the document looking for the desired search term and only add the matches to the list of beans? And repeat this process with each search?




I am not that experienced with webapps, but I am trying to figure out the optimal way to approach this, does anyone with Tomcat, SAX and Java Web apps have any suggestions as to which would be optimum?


Regards, Nate


No comments:

Post a Comment