68 *
69 * public class MyResolver implements EntityResolver {
70 * public InputSource resolveEntity (String publicId, String systemId)
71 * {
72 * if (systemId.equals("http://www.myhost.com/today")) {
73 * // return a special input source
74 * MyReader reader = new MyReader();
75 * return new InputSource(reader);
76 * } else {
77 * // use the default behaviour
78 * return null;
79 * }
80 * }
81 * }
82 * </pre>
83 *
84 * <p>The application can also use this interface to redirect system
85 * identifiers to local URIs or to look up replacements in a catalog
86 * (possibly by using the public identifier).</p>
87 *
88 * @since SAX 1.0
89 * @author David Megginson
90 * @see org.xml.sax.XMLReader#setEntityResolver
91 * @see org.xml.sax.InputSource
92 */
93 public interface EntityResolver {
94
95
96 /**
97 * Allow the application to resolve external entities.
98 *
99 * <p>The parser will call this method before opening any external
100 * entity except the top-level document entity. Such entities include
101 * the external DTD subset and external parameter entities referenced
102 * within the DTD (in either case, only if the parser reads external
103 * parameter entities), and external general entities referenced
104 * within the document element (if the parser reads external general
105 * entities). The application may request that the parser locate
106 * the entity itself, that it use an alternative URI, or that it
107 * use data provided by the application (as a character or byte
108 * input stream).</p>
|
68 *
69 * public class MyResolver implements EntityResolver {
70 * public InputSource resolveEntity (String publicId, String systemId)
71 * {
72 * if (systemId.equals("http://www.myhost.com/today")) {
73 * // return a special input source
74 * MyReader reader = new MyReader();
75 * return new InputSource(reader);
76 * } else {
77 * // use the default behaviour
78 * return null;
79 * }
80 * }
81 * }
82 * </pre>
83 *
84 * <p>The application can also use this interface to redirect system
85 * identifiers to local URIs or to look up replacements in a catalog
86 * (possibly by using the public identifier).</p>
87 *
88 * @since 1.4, SAX 1.0
89 * @author David Megginson
90 * @see org.xml.sax.XMLReader#setEntityResolver
91 * @see org.xml.sax.InputSource
92 */
93 public interface EntityResolver {
94
95
96 /**
97 * Allow the application to resolve external entities.
98 *
99 * <p>The parser will call this method before opening any external
100 * entity except the top-level document entity. Such entities include
101 * the external DTD subset and external parameter entities referenced
102 * within the DTD (in either case, only if the parser reads external
103 * parameter entities), and external general entities referenced
104 * within the document element (if the parser reads external general
105 * entities). The application may request that the parser locate
106 * the entity itself, that it use an alternative URI, or that it
107 * use data provided by the application (as a character or byte
108 * input stream).</p>
|