You want a SAX style parser. I'm not a Java guy, but what they do is, after you point them to a file (or stream, depending on the implementation's capabilities), it raises events as it sees elements, attributes, etc.
You then say, in each event (for example, the element events) "Is this an element I'm interested in?". If not, you just let it go on by. If it is, you do some work with it.
Frequently you need to wait until the end-element tag, and then perform some work on a complete record. What you do then is when you see the start-element tag, you start building a string. As you see each element, attribute, and element text go by, you add them to your string. When you get to the end of the element, you have a complete record in string format, to which you can load it into a DOM, write it to a file, whatever you want.
Chip H.
If you want to get the best response to a question, please check out FAQ222-2244 first