KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > directwebremoting > util > EmptyEntityResolver


1 package org.directwebremoting.util;
2
3 import java.io.IOException JavaDoc;
4 import java.io.StringReader JavaDoc;
5
6 import org.directwebremoting.impl.DefaultPageNormalizer;
7 import org.xml.sax.EntityResolver JavaDoc;
8 import org.xml.sax.InputSource JavaDoc;
9 import org.xml.sax.SAXException JavaDoc;
10
11 /**
12  * An EntityResolver for use when you don't want to do any entity resolving.
13  * <p>I think this is technically a violation of all sorts of things because the
14  * DTD affects how a document is parsed, and this just dumps all DTDs. However
15  * when you are not interested in validity, you just want to get informaion when
16  * you know that the DTD won't affect the documnent, this could be useful.
17  * @author Joe Walker [joe at getahead dot ltd dot uk]
18  */

19 public class EmptyEntityResolver implements EntityResolver JavaDoc
20 {
21     /* (non-Javadoc)
22      * @see org.xml.sax.EntityResolver#resolveEntity(java.lang.String, java.lang.String)
23      */

24     public InputSource JavaDoc resolveEntity(String JavaDoc publicId, String JavaDoc systemId) throws SAXException JavaDoc, IOException JavaDoc
25     {
26         log.debug("resolveEntity(publicId=" + publicId + ", systemId=" + systemId + ") returning null");
27
28         InputSource JavaDoc is = new InputSource JavaDoc(new StringReader JavaDoc(""));
29         is.setPublicId(publicId);
30         is.setSystemId(systemId);
31
32         return is;
33     }
34
35     /**
36      * The log stream
37      */

38     private static final Logger log = Logger.getLogger(DefaultPageNormalizer.class);
39 }
40
Popular Tags