Path: blob/aarch64-shenandoah-jdk8u272-b10/jaxp/src/org/xml/sax/DTDHandler.java
48534 views
/*1* Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425// SAX DTD handler.26// http://www.saxproject.org27// No warranty; no copyright -- use this as you will.28// $Id: DTDHandler.java,v 1.2 2004/11/03 22:44:51 jsuttor Exp $2930package org.xml.sax;3132/**33* Receive notification of basic DTD-related events.34*35* <blockquote>36* <em>This module, both source code and documentation, is in the37* Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>38* See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>39* for further information.40* </blockquote>41*42* <p>If a SAX application needs information about notations and43* unparsed entities, then the application implements this44* interface and registers an instance with the SAX parser using45* the parser's setDTDHandler method. The parser uses the46* instance to report notation and unparsed entity declarations to47* the application.</p>48*49* <p>Note that this interface includes only those DTD events that50* the XML recommendation <em>requires</em> processors to report:51* notation and unparsed entity declarations.</p>52*53* <p>The SAX parser may report these events in any order, regardless54* of the order in which the notations and unparsed entities were55* declared; however, all DTD events must be reported after the56* document handler's startDocument event, and before the first57* startElement event.58* (If the {@link org.xml.sax.ext.LexicalHandler LexicalHandler} is59* used, these events must also be reported before the endDTD event.)60* </p>61*62* <p>It is up to the application to store the information for63* future use (perhaps in a hash table or object tree).64* If the application encounters attributes of type "NOTATION",65* "ENTITY", or "ENTITIES", it can use the information that it66* obtained through this interface to find the entity and/or67* notation corresponding with the attribute value.</p>68*69* @since SAX 1.070* @author David Megginson71* @see org.xml.sax.XMLReader#setDTDHandler72*/73public interface DTDHandler {747576/**77* Receive notification of a notation declaration event.78*79* <p>It is up to the application to record the notation for later80* reference, if necessary;81* notations may appear as attribute values and in unparsed entity82* declarations, and are sometime used with processing instruction83* target names.</p>84*85* <p>At least one of publicId and systemId must be non-null.86* If a system identifier is present, and it is a URL, the SAX87* parser must resolve it fully before passing it to the88* application through this event.</p>89*90* <p>There is no guarantee that the notation declaration will be91* reported before any unparsed entities that use it.</p>92*93* @param name The notation name.94* @param publicId The notation's public identifier, or null if95* none was given.96* @param systemId The notation's system identifier, or null if97* none was given.98* @exception org.xml.sax.SAXException Any SAX exception, possibly99* wrapping another exception.100* @see #unparsedEntityDecl101* @see org.xml.sax.Attributes102*/103public abstract void notationDecl (String name,104String publicId,105String systemId)106throws SAXException;107108109/**110* Receive notification of an unparsed entity declaration event.111*112* <p>Note that the notation name corresponds to a notation113* reported by the {@link #notationDecl notationDecl} event.114* It is up to the application to record the entity for later115* reference, if necessary;116* unparsed entities may appear as attribute values.117* </p>118*119* <p>If the system identifier is a URL, the parser must resolve it120* fully before passing it to the application.</p>121*122* @exception org.xml.sax.SAXException Any SAX exception, possibly123* wrapping another exception.124* @param name The unparsed entity's name.125* @param publicId The entity's public identifier, or null if none126* was given.127* @param systemId The entity's system identifier.128* @param notationName The name of the associated notation.129* @see #notationDecl130* @see org.xml.sax.Attributes131*/132public abstract void unparsedEntityDecl (String name,133String publicId,134String systemId,135String notationName)136throws SAXException;137138}139140// end of DTDHandler.java141142143