What I need to do is search XML files which possibly could be as large as 1 mb. I will be searching by allowing the user to type in a word or words and searching the whole xml document for occurences of that word(s). Now I will be searching all the nodes, the attributes as well as the text/data. Now I have used a xml dom and sax and the searching takes a couple of minutes sometimes. What is the fastest way to search an xml document? What can I do to speed up my search times.
DOM of course is going to take a lot of time up front, building a tree in memory. SAX essentially guarantees a method call on every element. Both approaches are predicated on the idea that context is as important as the word you want to find. If all you really want to do is find a string, don't use either tool. Put the parser tools away, and just use regular expression pattern matching to find it.
Make visible what, without you, might perhaps never have been seen. - Robert Bresson