At 05:34 PM 12/1/2004, Curt Arnold wrote:

The approach that I'm thinking of is to parse the configuration once, collect objects that correspond to the startElement and endElement events but with some minor namespace normalization and dropping foreign elements, then replay those normalized events to JoranInterpreter. It should not be necessary to make any changes to JoranInterpreter.


It's a cool idea to explore. The only problem I can foresee is in
relation with reporting errors. If you look at the
ExecutionContext.addError method, it accesses the current
org.xml.sax.Locator to accurately log the line and column numbers at
the time ErrorItems are added to the ExecutionContext (independently
of the errors reported by the SAX parser itself). If you replay the
information, then you'd need to replay the Locator information as
well. Maybe this would be trivial to do, but may be not.

With regards to namespaces, I am embarrassed to admit that
joran.Interpreter is not namespace aware. I think you'd need to change
many (all?) Actions to get them working in a namespace aware
manner. It would mean at least half a day of work, it not more.

> I think that if you use SaxParser.parse(File) and
> SaxParser.parse(String url) (as appropriate), you will get even better
> messages and it will push some of the complexity off into the parser.
> To avoid having unnecessary duplicate code, you could either have an
> anonymous inner class that is used to do just the parse step or
> collect all the surrounding code into a few private methods so the
> body of doConfigure(URL) is only 7 lines or so.

I don't sure I fully grasp everything you say but I am very curious to
see the code.

Perhaps you'd like to tackle this piece by piece, starting with
SaxParser.parse(File) and SaxParser.parse(String url), and proceeding
from there.



--
Ceki G�lc�

The complete log4j manual: http://qos.ch/eclm
Professional log4j support: http://qos.ch/log4jSupport




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to