On Dec 1, 2004, at 1:22 PM, Ceki G�lc� wrote:

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.

I've updated the bug report with a shot at replaying location information.



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.

The JoranConfigurator normalizes everything so all JoranInterpreter sees is local names ("configuration", "logger") etc in the "http://jakarta.apache.org/log4j/"; namespace.



> 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.


I think doConfigure should return a boolean to relay whether the configuration was successful. You couldn't rely on getErrorList.size() > 0 to indicate failure since a warning would go in the error list, but would not cause doConfigure to fail.



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



Reply via email to