[jdom-interest] adding a finalise method to element

Phill_Perryman at Mitel.COM Phill_Perryman at Mitel.COM
Wed Aug 27 10:55:35 PDT 2003

Now it's my turn to request a change to JDOM

I have an application with several classes which extend Element and some of
these I need to take action on. Currently I have to wait until the document
is built and then iterate over the elements, find the ones I want and then
call the method as I cannot find a way to tell an Element is complete.

If the following changes were made this could be achieved on the fly at
very little cost.

1. In the default jdom factory add a final static boolean CALL_VALIDATE =
2. In element add a public void validate() throws SAXException {} method
3. in the saxHandler endElement method add if (factory.CALL_VALIDATE)

Then when Element is extended the factory that generates ExtendedElement
can set CALL_VALIDATE to true and the ExtendedElement can overide the
validate method to do its thing. It allows for content specific validation
to be performed rather than syntax validation.  For instance I have one
attribute which should contains double, it is read many times so I can
convert it (validate as well) on completion of the Element and only parse
it once.

IS Dept, Software Engineer.
phill_perryman at mitel.com
Tel: +44 1291 436023

More information about the jdom-interest mailing list