[jdom-interest] Location-based parsing

Rolf Lear jdom at tuis.net
Tue Feb 28 20:56:12 PST 2012


Hi all.

I have moved the 'Line-Number' based SAXParser code to core. It is not a 
straight move, but rather, a rewrite to be more general, and to fit in 
to the JDOM2 way of doing things in the SAX parsing area.

A big side-effect of this move is that I have Extended the JDOMFactory 
interface. The changes are all 'extending' the interface, and the 
changes are fully compatible with JDOM 1.x ... unless you have created 
your own custom JDOMFactory.

If you have your own factory then you will need to implement a number of 
new methods. If you extend the DefaultJDOMFactory (like most people will 
have, I imagine) then you will find that you are overriding final 
methods (which fails to compile), but the fix is easy... for example if 
you overrode the 'text(String)' method (which returns a Text instance), 
you will have (for example):

public Text text(String text) {
   return new Text(text);
}

You will need to change this to:

public Text text(int line, int col, String text) {
   return new Text(text);
}

and you will again have your full functionality.

Rolf


More information about the jdom-interest mailing list