[jdom-interest] Element Scanner

Robert (Jamie) Munro rjmunro at arjam.net
Fri May 2 06:48:22 PDT 2003


I've been writing a project that processes XML using ElementScanner.
Recently, since I updated the CVS, I am getting lots of null pointer
exceptions. It seems to be because I am doing:

public void elementMatched(String path, Element e) {
    // process the element
    if ([process was successful]) e.detach();
}

The idea is that once I have processed the element, I don't need it to stick
around in memory any more. If it failed to process, I leave it in the JDOM
tree. The tree that remains at the end of the run is output to a new XML
file as a log of the process.

Is this supposed to be legal? Can it be made to work again? It seems a
pretty logical thing to do, and it certainly used to work. Otherwise, could
elementMatched return a value to say weather the element should be kept in
the tree or not?

Thanks,

Robert Munro

Ps. In case you are interested, the project is a database replication engine
for the Firebird database, called Fibre, http://fibre.sf.net/




More information about the jdom-interest mailing list