1 /*
   2  * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 // SAX DTD handler.
  27 // http://www.saxproject.org
  28 // No warranty; no copyright -- use this as you will.
  29 // $Id: DTDHandler.java,v 1.2 2004/11/03 22:44:51 jsuttor Exp $
  30 
  31 package jdk.internal.org.xml.sax;
  32 
  33 /**
  34  * Receive notification of basic DTD-related events.
  35  *
  36  * <blockquote>
  37  * <em>This module, both source code and documentation, is in the
  38  * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
  39  * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
  40  * for further information.
  41  * </blockquote>
  42  *
  43  * <p>If a SAX application needs information about notations and
  44  * unparsed entities, then the application implements this
  45  * interface and registers an instance with the SAX parser using
  46  * the parser's setDTDHandler method.  The parser uses the
  47  * instance to report notation and unparsed entity declarations to
  48  * the application.</p>
  49  *
  50  * <p>Note that this interface includes only those DTD events that
  51  * the XML recommendation <em>requires</em> processors to report:
  52  * notation and unparsed entity declarations.</p>
  53  *
  54  * <p>The SAX parser may report these events in any order, regardless
  55  * of the order in which the notations and unparsed entities were
  56  * declared; however, all DTD events must be reported after the
  57  * document handler's startDocument event, and before the first
  58  * startElement event.
  59  * (If the {@link org.xml.sax.ext.LexicalHandler LexicalHandler} is
  60  * used, these events must also be reported before the endDTD event.)
  61  * </p>
  62  *
  63  * <p>It is up to the application to store the information for
  64  * future use (perhaps in a hash table or object tree).
  65  * If the application encounters attributes of type "NOTATION",
  66  * "ENTITY", or "ENTITIES", it can use the information that it
  67  * obtained through this interface to find the entity and/or
  68  * notation corresponding with the attribute value.</p>
  69  *
  70  * @since SAX 1.0
  71  * @author David Megginson
  72  * @see org.xml.sax.XMLReader#setDTDHandler
  73  */
  74 public interface DTDHandler {
  75 
  76 
  77     /**
  78      * Receive notification of a notation declaration event.
  79      *
  80      * <p>It is up to the application to record the notation for later
  81      * reference, if necessary;
  82      * notations may appear as attribute values and in unparsed entity
  83      * declarations, and are sometime used with processing instruction
  84      * target names.</p>
  85      *
  86      * <p>At least one of publicId and systemId must be non-null.
  87      * If a system identifier is present, and it is a URL, the SAX
  88      * parser must resolve it fully before passing it to the
  89      * application through this event.</p>
  90      *
  91      * <p>There is no guarantee that the notation declaration will be
  92      * reported before any unparsed entities that use it.</p>
  93      *
  94      * @param name The notation name.
  95      * @param publicId The notation's public identifier, or null if
  96      *        none was given.
  97      * @param systemId The notation's system identifier, or null if
  98      *        none was given.
  99      * @exception org.xml.sax.SAXException Any SAX exception, possibly
 100      *            wrapping another exception.
 101      * @see #unparsedEntityDecl
 102      * @see org.xml.sax.Attributes
 103      */
 104     public abstract void notationDecl (String name,
 105                                        String publicId,
 106                                        String systemId)
 107         throws SAXException;
 108 
 109 
 110     /**
 111      * Receive notification of an unparsed entity declaration event.
 112      *
 113      * <p>Note that the notation name corresponds to a notation
 114      * reported by the {@link #notationDecl notationDecl} event.
 115      * It is up to the application to record the entity for later
 116      * reference, if necessary;
 117      * unparsed entities may appear as attribute values.
 118      * </p>
 119      *
 120      * <p>If the system identifier is a URL, the parser must resolve it
 121      * fully before passing it to the application.</p>
 122      *
 123      * @exception org.xml.sax.SAXException Any SAX exception, possibly
 124      *            wrapping another exception.
 125      * @param name The unparsed entity's name.
 126      * @param publicId The entity's public identifier, or null if none
 127      *        was given.
 128      * @param systemId The entity's system identifier.
 129      * @param notationName The name of the associated notation.
 130      * @see #notationDecl
 131      * @see org.xml.sax.Attributes
 132      */
 133     public abstract void unparsedEntityDecl (String name,
 134                                              String publicId,
 135                                              String systemId,
 136                                              String notationName)
 137         throws SAXException;
 138 
 139 }
 140 
 141 // end of DTDHandler.java