You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by Ceki Gulcu <cg...@urbanet.ch> on 2000/12/19 14:17:56 UTC
Re: XML parsing problem..
Endre,
Just committed your "hack". The DOMConfigurator is now compatible with
JAXP-1.0.1 and the DOM Level 2 dependence is gone. Thanks, Ceki
At 15:45 18.12.2000 +0100, Endre Stølsvik wrote:
>On Mon, 18 Dec 2000, Ceki Gulcu wrote:
>
>| Endre,
>|
>| The DOMConfigurator requires the DOM Level 2 API which is not provided by
>| Sun's implementation of JAXP. So you need the Apache Xerces parser which
>| surprisingly also contains Sun's JAXP API... I hope this helps, Ceki
>
>Thanks!
>
>But it is a bit weird, since this is jaxp1.1 (Early Release, mind you!),
>and it says in the doc:
>
>" This release aims to be conformant to the following specifications:
>
> JAXP 1.1 JSR-63
> XML 1.0 Second Edition
> XML Namespaces
> SAX 2.0
> SAX2 Extensions version 1.0
> DOM Level 2 Core Recommendation
> XSLT 1.0 "
>
>But I hacked my way around it with this crude thing. I mean, it's just in
>the _configuration_ that this is a problem, so it won't degrade the actual
>logging performance anyway.
>
> /**
> Used internally to parse appenders by IDREF.
> */
> protected
> Appender findAppenderByReference(Element appenderRef) {
> String appenderName = appenderRef.getAttribute(REF_ATTR);
> Appender appender = (Appender) appenderBag.get(appenderName);
> if(appender != null) {
> return appender;
> } else {
> Document doc = appenderRef.getOwnerDocument();
>
> // DOESN'T WORK!! :
> // Element element =
> doc.getElementById(appenderName);
>
> // Endre's hack:
> Element element = null;
> NodeList list = doc.getElementsByTagName("appender");
> for (int t=0; t<list.getLength(); t++) {
> Node node = list.item(t);
> NamedNodeMap map= node.getAttributes();
> Node attrNode = map.getNamedItem("name");
> if
> (appenderName.equals(attrNode.getNodeValue())) {
> element = (Element) node;
> break;
> }
> }
> // Hack finished.
>
> if(element == null) {
> LogLog.error("No appender named
> ["+appenderName+"] could be found.");
> return null;
> } else {
> appender = parseAppender(element);
> appenderBag.put(appenderName, appender);
> return appender;
> }
> }
> }
>
>
>--
>Mvh,
>Endre
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: log4j-user-help@jakarta.apache.org