X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=unused%2Fxml%2Fsax%2Fext%2FDefaultHandler2.java;fp=unused%2Fxml%2Fsax%2Fext%2FDefaultHandler2.java;h=f2096ad71dd5ac0cf86df60491d71bcdaa04d701;hb=ec8f3cedf60fb1feed6d34de6b49f6bfa78b9dd8;hp=0000000000000000000000000000000000000000;hpb=056dad85a910551cc95e44d451a61f6b8c4dd35d;p=jalview.git diff --git a/unused/xml/sax/ext/DefaultHandler2.java b/unused/xml/sax/ext/DefaultHandler2.java new file mode 100644 index 0000000..f2096ad --- /dev/null +++ b/unused/xml/sax/ext/DefaultHandler2.java @@ -0,0 +1,144 @@ +// DefaultHandler2.java - extended DefaultHandler +// http://www.saxproject.org +// Public Domain: no warranty. +// $Id: DefaultHandler2.java,v 1.3 2002/01/12 19:04:19 dbrownell Exp $ + +package org.xml.sax.ext; + +import java.io.IOException; +import org.xml.sax.InputSource; +import org.xml.sax.SAXException; +import org.xml.sax.helpers.DefaultHandler; + + +/** + * This class extends the SAX2 base handler class to support the + * SAX2 {@link LexicalHandler}, {@link DeclHandler}, and + * {@link EntityResolver2} extensions. Except for overriding the + * original SAX1 {@link DefaultHandler#resolveEntity resolveEntity()} + * method the added handler methods just return. Subclassers may + * override everything on a method-by-method basis. + * + *
+ * This module, both source code and documentation, is in the + * Public Domain, and comes with NO WARRANTY. + *
+ * + *

Note: this class might yet learn that the + * ContentHandler.setDocumentLocator() call might be passed a + * {@link Locator2} object, and that the + * ContentHandler.startElement() call might be passed a + * {@link Attributes2} object. + * + * @since SAX 2.0 (extensions 1.1 alpha) + * @author David Brownell + * @version TBS + */ +public class DefaultHandler2 extends DefaultHandler + implements LexicalHandler, DeclHandler, EntityResolver2 +{ + /** Constructs a handler which ignores all parsing events. */ + public DefaultHandler2 () { } + + + // SAX2 ext-1.0 LexicalHandler + + @Override + public void startCDATA () + throws SAXException + {} + + @Override + public void endCDATA () + throws SAXException + {} + + @Override + public void startDTD (String name, String publicId, String systemId) + throws SAXException + {} + + @Override + public void endDTD () + throws SAXException + {} + + @Override + public void startEntity (String name) + throws SAXException + {} + + @Override + public void endEntity (String name) + throws SAXException + {} + + @Override + public void comment (char ch [], int start, int length) + throws SAXException + { } + + + // SAX2 ext-1.0 DeclHandler + + @Override + public void attributeDecl (String eName, String aName, + String type, String mode, String value) + throws SAXException + {} + + @Override + public void elementDecl (String name, String model) + throws SAXException + {} + + @Override + public void externalEntityDecl (String name, + String publicId, String systemId) + throws SAXException + {} + + @Override + public void internalEntityDecl (String name, String value) + throws SAXException + {} + + // SAX2 ext-1.1 EntityResolver2 + + /** + * Tells the parser that if no external subset has been declared + * in the document text, none should be used. + */ + @Override + public InputSource getExternalSubset (String name, String baseURI) + throws SAXException, IOException + { return null; } + + /** + * Tells the parser to resolve the systemId against the baseURI + * and read the entity text from that resulting absolute URI. + * Note that because the older + * {@link DefaultHandler#resolveEntity DefaultHandler.resolveEntity()}, + * method is overridden to call this one, this method may sometimes + * be invoked with null name and baseURI, and + * with the systemId already absolutized. + */ + @Override + public InputSource resolveEntity (String name, String publicId, + String baseURI, String systemId) + throws SAXException, IOException + { return null; } + + // SAX1 EntityResolver + + /** + * Invokes + * {@link EntityResolver2#resolveEntity EntityResolver2.resolveEntity()} + * with null entity name and base URI. + * You only need to override that method to use this class. + */ + @Override + public InputSource resolveEntity (String publicId, String systemId) + throws SAXException, IOException + { return resolveEntity (null, publicId, null, systemId); } +}