001: // DefaultHandler2.java - extended DefaultHandler
002: // http://www.saxproject.org
003: // Public Domain: no warranty.
004: // $Id: DefaultHandler2.java,v 1.4 2002/02/01 20:06:20 db Exp $
005:
006: package org.xml.sax.ext;
007:
008: import java.io.IOException;
009: import org.xml.sax.InputSource;
010: import org.xml.sax.SAXException;
011: import org.xml.sax.helpers.DefaultHandler;
012:
013: /**
014: * This class extends the SAX2 base handler class to support the
015: * SAX2 {@link LexicalHandler}, {@link DeclHandler}, and
016: * {@link EntityResolver2} extensions. Except for overriding the
017: * original SAX1 {@link DefaultHandler#resolveEntity resolveEntity()}
018: * method the added handler methods just return. Subclassers may
019: * override everything on a method-by-method basis.
020: *
021: * <blockquote>
022: * <em>This module, both source code and documentation, is in the
023: * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
024: * </blockquote>
025: *
026: * <p> <em>Note:</em> this class might yet learn that the
027: * <em>ContentHandler.setDocumentLocator()</em> call might be passed a
028: * {@link Locator2} object, and that the
029: * <em>ContentHandler.startElement()</em> call might be passed a
030: * {@link Attributes2} object.
031: *
032: * @since SAX 2.0 (extensions 1.1 alpha)
033: * @author David Brownell
034: * @version TBS
035: */
036: public class DefaultHandler2 extends DefaultHandler implements
037: LexicalHandler, DeclHandler, EntityResolver2 {
038: /** Constructs a handler which ignores all parsing events. */
039: public DefaultHandler2() {
040: }
041:
042: // SAX2 ext-1.0 LexicalHandler
043:
044: public void startCDATA() throws SAXException {
045: }
046:
047: public void endCDATA() throws SAXException {
048: }
049:
050: public void startDTD(String name, String publicId, String systemId)
051: throws SAXException {
052: }
053:
054: public void endDTD() throws SAXException {
055: }
056:
057: public void startEntity(String name) throws SAXException {
058: }
059:
060: public void endEntity(String name) throws SAXException {
061: }
062:
063: public void comment(char ch[], int start, int length)
064: throws SAXException {
065: }
066:
067: // SAX2 ext-1.0 DeclHandler
068:
069: public void attributeDecl(String eName, String aName, String type,
070: String mode, String value) throws SAXException {
071: }
072:
073: public void elementDecl(String name, String model)
074: throws SAXException {
075: }
076:
077: public void externalEntityDecl(String name, String publicId,
078: String systemId) throws SAXException {
079: }
080:
081: public void internalEntityDecl(String name, String value)
082: throws SAXException {
083: }
084:
085: // SAX2 ext-1.1 EntityResolver2
086:
087: /**
088: * Tells the parser that if no external subset has been declared
089: * in the document text, none should be used.
090: */
091: public InputSource getExternalSubset(String name, String baseURI)
092: throws SAXException, IOException {
093: return null;
094: }
095:
096: /**
097: * Tells the parser to resolve the systemId against the baseURI
098: * and read the entity text from that resulting absolute URI.
099: * Note that because the older
100: * {@link DefaultHandler#resolveEntity DefaultHandler.resolveEntity()},
101: * method is overridden to call this one, this method may sometimes
102: * be invoked with null <em>name</em> and <em>baseURI</em>, and
103: * with the <em>systemId</em> already absolutized.
104: */
105: public InputSource resolveEntity(String name, String publicId,
106: String baseURI, String systemId) throws SAXException,
107: IOException {
108: return null;
109: }
110:
111: // SAX1 EntityResolver
112:
113: /**
114: * Invokes
115: * {@link EntityResolver2#resolveEntity EntityResolver2.resolveEntity()}
116: * with null entity name and base URI.
117: * You only need to override that method to use this class.
118: */
119: public InputSource resolveEntity(String publicId, String systemId)
120: throws SAXException, IOException {
121: return resolveEntity(null, publicId, null, systemId);
122: }
123: }
|