001 /*
002 * Copyright 2000-2005 Sun Microsystems, Inc. All Rights Reserved.
003 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004 *
005 * This code is free software; you can redistribute it and/or modify it
006 * under the terms of the GNU General Public License version 2 only, as
007 * published by the Free Software Foundation. Sun designates this
008 * particular file as subject to the "Classpath" exception as provided
009 * by Sun in the LICENSE file that accompanied this code.
010 *
011 * This code is distributed in the hope that it will be useful, but WITHOUT
012 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
013 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
014 * version 2 for more details (a copy is included in the LICENSE file that
015 * accompanied this code).
016 *
017 * You should have received a copy of the GNU General Public License version
018 * 2 along with this work; if not, write to the Free Software Foundation,
019 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
020 *
021 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
022 * CA 95054 USA or visit www.sun.com if you need additional information or
023 * have any questions.
024 */
025
026 // SAX DTD handler.
027 // http://www.saxproject.org
028 // No warranty; no copyright -- use this as you will.
029 // $Id: DTDHandler.java,v 1.2 2004/11/03 22:44:51 jsuttor Exp $
030 package org.xml.sax;
031
032 /**
033 * Receive notification of basic DTD-related events.
034 *
035 * <blockquote>
036 * <em>This module, both source code and documentation, is in the
037 * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
038 * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
039 * for further information.
040 * </blockquote>
041 *
042 * <p>If a SAX application needs information about notations and
043 * unparsed entities, then the application implements this
044 * interface and registers an instance with the SAX parser using
045 * the parser's setDTDHandler method. The parser uses the
046 * instance to report notation and unparsed entity declarations to
047 * the application.</p>
048 *
049 * <p>Note that this interface includes only those DTD events that
050 * the XML recommendation <em>requires</em> processors to report:
051 * notation and unparsed entity declarations.</p>
052 *
053 * <p>The SAX parser may report these events in any order, regardless
054 * of the order in which the notations and unparsed entities were
055 * declared; however, all DTD events must be reported after the
056 * document handler's startDocument event, and before the first
057 * startElement event.
058 * (If the {@link org.xml.sax.ext.LexicalHandler LexicalHandler} is
059 * used, these events must also be reported before the endDTD event.)
060 * </p>
061 *
062 * <p>It is up to the application to store the information for
063 * future use (perhaps in a hash table or object tree).
064 * If the application encounters attributes of type "NOTATION",
065 * "ENTITY", or "ENTITIES", it can use the information that it
066 * obtained through this interface to find the entity and/or
067 * notation corresponding with the attribute value.</p>
068 *
069 * @since SAX 1.0
070 * @author David Megginson
071 * @version 2.0.1 (sax2r2)
072 * @see org.xml.sax.XMLReader#setDTDHandler
073 */
074 public interface DTDHandler {
075
076 /**
077 * Receive notification of a notation declaration event.
078 *
079 * <p>It is up to the application to record the notation for later
080 * reference, if necessary;
081 * notations may appear as attribute values and in unparsed entity
082 * declarations, and are sometime used with processing instruction
083 * target names.</p>
084 *
085 * <p>At least one of publicId and systemId must be non-null.
086 * If a system identifier is present, and it is a URL, the SAX
087 * parser must resolve it fully before passing it to the
088 * application through this event.</p>
089 *
090 * <p>There is no guarantee that the notation declaration will be
091 * reported before any unparsed entities that use it.</p>
092 *
093 * @param name The notation name.
094 * @param publicId The notation's public identifier, or null if
095 * none was given.
096 * @param systemId The notation's system identifier, or null if
097 * none was given.
098 * @exception org.xml.sax.SAXException Any SAX exception, possibly
099 * wrapping another exception.
100 * @see #unparsedEntityDecl
101 * @see org.xml.sax.Attributes
102 */
103 public abstract void notationDecl(String name, String publicId,
104 String systemId) throws SAXException;
105
106 /**
107 * Receive notification of an unparsed entity declaration event.
108 *
109 * <p>Note that the notation name corresponds to a notation
110 * reported by the {@link #notationDecl notationDecl} event.
111 * It is up to the application to record the entity for later
112 * reference, if necessary;
113 * unparsed entities may appear as attribute values.
114 * </p>
115 *
116 * <p>If the system identifier is a URL, the parser must resolve it
117 * fully before passing it to the application.</p>
118 *
119 * @exception org.xml.sax.SAXException Any SAX exception, possibly
120 * wrapping another exception.
121 * @param name The unparsed entity's name.
122 * @param publicId The entity's public identifier, or null if none
123 * was given.
124 * @param systemId The entity's system identifier.
125 * @param notationName The name of the associated notation.
126 * @see #notationDecl
127 * @see org.xml.sax.Attributes
128 */
129 public abstract void unparsedEntityDecl(String name,
130 String publicId, String systemId, String notationName)
131 throws SAXException;
132
133 }
134
135 // end of DTDHandler.java
|