[logback-dev] [Bug 14] HTMLLayoutTest fails if there is no network or if the user is behind a firewall

bugzilla-daemon at pixie.qos.ch bugzilla-daemon at pixie.qos.ch
Mon Oct 16 10:51:44 CEST 2006


http://bugzilla.qos.ch/show_bug.cgi?id=14





------- Comment #3 from noreply.ceki at qos.ch  2006-10-16 10:51 -------
Here is an EntityResolver which should do the trick.

import java.io.InputStream;
import java.util.HashMap;
import java.util.Map;
import org.xml.sax.EntityResolver;
import org.xml.sax.InputSource;


public class XHTMLEntityResolver implements EntityResolver {


  // key: public id, value: relative path to DTD file
  static Map entityMap = new HashMap();

  static {
    entityMap.put("-//W3C//DTD XHTML 1.0 Transitional//EN", 
"/dtd/xhtml1-transitional.dtd");
    entityMap.put("-//W3C//ENTITIES Latin 1 for XHTML//EN",
"/dtd/xhtml-lat1.ent");
    entityMap.put("-//W3C//ENTITIES Symbols for XHTML//EN",
"/dtd/xhtml-symbol.ent");
    entityMap.put("-//W3C//ENTITIES Special for XHTML//EN",
"/dtd/xhtml-special.ent");
  }

  public InputSource resolveEntity(String publicId, String systemId) {
    final String relativePath = (String)entityMap.get(publicId);

    if (relativePath != null) {
      Class clazz = getClass();
      InputStream in =
        clazz.getResourceAsStream(relativePath);

      if (in == null) {
        return null;
      } else {
        return new InputSource(in);
      }
    } else {
      return null;
    }
  }
}


-- 
Configure bugmail: http://bugzilla.qos.ch/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.



More information about the logback-dev mailing list