commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Don Brown" <>
Subject [digester] Adding location support
Date Sat, 22 Apr 2006 23:22:27 GMT
When digester loads in an XML file, the objects created from it have no
concept from where they came, making it difficult to provide accurate and
helpful error messages down the line.

I'd like to add location support for the Digester that would allow a calling
application to capture the source uri, line number, and column number for
every element encountered.  This information could then be used by the
application to provide helpful error messages to their users.  I believe
Howard calls this "Line-precise error reporting".  I've already added this
capability to OpenSymphony's XWork, which powers both WebWork and Struts
Action 2.  I'd like to bring this feature to Struts Action 1 and Commons
Validator, and Digester is the key.

My implementation is borrowed from Apache Cocoon (what good XML technique
isn't ;)) and would be adapted to fit Digester better.  How it works is
 1. Place a ContentHandler filter in between the parser and Digester, which
adds separately-namespeced attributes to each XML element - uri, lineNumber,
and columnNumber.
 2. Then, the user can use the builtin namespace support of Digester to feed
these values into their own Location object and inject it into their
configuration objects in any way they choose.

This technique would leverage Digester's rules to allow the parent
application to have its own Location objects and therefore not require
Digester imports to be scattered throughout their application.  Furthermore,
it would only be enabled if namespace support was enabled, allowing for
complete backwards compatibility.

I am a Jakarta Commons commiter, so I guess I'm asking a) can I join and b)
any objections to me adding this feature?


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message