286N/A/*
286N/A * Copyright (c) 2004, 2005, Oracle and/or its affiliates. All rights reserved.
286N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
286N/A *
286N/A * This code is free software; you can redistribute it and/or modify it
286N/A * under the terms of the GNU General Public License version 2 only, as
286N/A * published by the Free Software Foundation. Oracle designates this
286N/A * particular file as subject to the "Classpath" exception as provided
286N/A * by Oracle in the LICENSE file that accompanied this code.
286N/A *
286N/A * This code is distributed in the hope that it will be useful, but WITHOUT
286N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
286N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
286N/A * version 2 for more details (a copy is included in the LICENSE file that
286N/A * accompanied this code).
286N/A *
286N/A * You should have received a copy of the GNU General Public License version
286N/A * 2 along with this work; if not, write to the Free Software Foundation,
286N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
286N/A *
286N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
286N/A * or visit www.oracle.com if you need additional information or have any
286N/A * questions.
286N/A */
286N/A
286N/A// DefaultHandler2.java - extended DefaultHandler
286N/A// http://www.saxproject.org
286N/A// Public Domain: no warranty.
286N/A// $Id: DefaultHandler2.java,v 1.2 2004/11/03 22:49:08 jsuttor Exp $
286N/A
286N/Apackage org.xml.sax.ext;
286N/A
286N/Aimport java.io.IOException;
286N/Aimport org.xml.sax.InputSource;
286N/Aimport org.xml.sax.SAXException;
286N/Aimport org.xml.sax.helpers.DefaultHandler;
286N/A
286N/A
286N/A/**
286N/A * This class extends the SAX2 base handler class to support the
286N/A * SAX2 {@link LexicalHandler}, {@link DeclHandler}, and
286N/A * {@link EntityResolver2} extensions. Except for overriding the
286N/A * original SAX1 {@link DefaultHandler#resolveEntity resolveEntity()}
286N/A * method the added handler methods just return. Subclassers may
286N/A * override everything on a method-by-method basis.
286N/A *
286N/A * <blockquote>
286N/A * <em>This module, both source code and documentation, is in the
286N/A * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
286N/A * </blockquote>
286N/A *
286N/A * <p> <em>Note:</em> this class might yet learn that the
286N/A * <em>ContentHandler.setDocumentLocator()</em> call might be passed a
286N/A * {@link Locator2} object, and that the
286N/A * <em>ContentHandler.startElement()</em> call might be passed a
286N/A * {@link Attributes2} object.
286N/A *
286N/A * @since SAX 2.0 (extensions 1.1 alpha)
286N/A * @author David Brownell
286N/A */
286N/Apublic class DefaultHandler2 extends DefaultHandler
286N/A implements LexicalHandler, DeclHandler, EntityResolver2
286N/A{
286N/A /** Constructs a handler which ignores all parsing events. */
286N/A public DefaultHandler2 () { }
286N/A
286N/A
286N/A // SAX2 ext-1.0 LexicalHandler
286N/A
286N/A public void startCDATA ()
286N/A throws SAXException
286N/A {}
286N/A
286N/A public void endCDATA ()
286N/A throws SAXException
286N/A {}
286N/A
286N/A public void startDTD (String name, String publicId, String systemId)
286N/A throws SAXException
286N/A {}
286N/A
286N/A public void endDTD ()
286N/A throws SAXException
286N/A {}
286N/A
286N/A public void startEntity (String name)
286N/A throws SAXException
286N/A {}
286N/A
286N/A public void endEntity (String name)
286N/A throws SAXException
286N/A {}
286N/A
286N/A public void comment (char ch [], int start, int length)
286N/A throws SAXException
286N/A { }
286N/A
286N/A
286N/A // SAX2 ext-1.0 DeclHandler
286N/A
286N/A public void attributeDecl (String eName, String aName,
286N/A String type, String mode, String value)
286N/A throws SAXException
286N/A {}
286N/A
286N/A public void elementDecl (String name, String model)
286N/A throws SAXException
286N/A {}
286N/A
286N/A public void externalEntityDecl (String name,
286N/A String publicId, String systemId)
286N/A throws SAXException
286N/A {}
286N/A
286N/A public void internalEntityDecl (String name, String value)
286N/A throws SAXException
286N/A {}
286N/A
286N/A // SAX2 ext-1.1 EntityResolver2
286N/A
286N/A /**
286N/A * Tells the parser that if no external subset has been declared
286N/A * in the document text, none should be used.
286N/A */
286N/A public InputSource getExternalSubset (String name, String baseURI)
286N/A throws SAXException, IOException
286N/A { return null; }
286N/A
286N/A /**
286N/A * Tells the parser to resolve the systemId against the baseURI
286N/A * and read the entity text from that resulting absolute URI.
286N/A * Note that because the older
286N/A * {@link DefaultHandler#resolveEntity DefaultHandler.resolveEntity()},
286N/A * method is overridden to call this one, this method may sometimes
286N/A * be invoked with null <em>name</em> and <em>baseURI</em>, and
286N/A * with the <em>systemId</em> already absolutized.
286N/A */
286N/A public InputSource resolveEntity (String name, String publicId,
286N/A String baseURI, String systemId)
286N/A throws SAXException, IOException
286N/A { return null; }
286N/A
286N/A // SAX1 EntityResolver
286N/A
286N/A /**
286N/A * Invokes
286N/A * {@link EntityResolver2#resolveEntity EntityResolver2.resolveEntity()}
286N/A * with null entity name and base URI.
286N/A * You only need to override that method to use this class.
286N/A */
286N/A public InputSource resolveEntity (String publicId, String systemId)
286N/A throws SAXException, IOException
286N/A { return resolveEntity (null, publicId, null, systemId); }
286N/A}