01: /*
02: * Copyright 2005 Joe Walker
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16: package org.directwebremoting.util;
17:
18: import java.io.IOException;
19: import java.io.StringReader;
20:
21: import org.apache.commons.logging.Log;
22: import org.apache.commons.logging.LogFactory;
23: import org.directwebremoting.impl.DefaultPageNormalizer;
24: import org.xml.sax.EntityResolver;
25: import org.xml.sax.InputSource;
26: import org.xml.sax.SAXException;
27:
28: /**
29: * An EntityResolver for use when you don't want to do any entity resolving.
30: * <p>I think this is technically a violation of all sorts of things because the
31: * DTD affects how a document is parsed, and this just dumps all DTDs. However
32: * when you are not interested in validity, you just want to get informaion when
33: * you know that the DTD won't affect the documnent, this could be useful.
34: * @author Joe Walker [joe at getahead dot ltd dot uk]
35: */
36: public class EmptyEntityResolver implements EntityResolver {
37: /* (non-Javadoc)
38: * @see org.xml.sax.EntityResolver#resolveEntity(java.lang.String, java.lang.String)
39: */
40: public InputSource resolveEntity(String publicId, String systemId)
41: throws SAXException, IOException {
42: log.debug("resolveEntity(publicId=" + publicId + ", systemId="
43: + systemId + ") returning null");
44:
45: InputSource is = new InputSource(new StringReader(""));
46: is.setPublicId(publicId);
47: is.setSystemId(systemId);
48:
49: return is;
50: }
51:
52: /**
53: * The log stream
54: */
55: private static final Log log = LogFactory
56: .getLog(DefaultPageNormalizer.class);
57: }
|