001 // SAX DTD handler.
002 // http://www.saxproject.org
003 // No warranty; no copyright -- use this as you will.
004 // $Id: DTDHandler.java,v 1.1 2004/12/23 22:38:42 mark Exp $
005
006 package org.xml.sax;
007
008 /**
009 * Receive notification of basic DTD-related events.
010 *
011 * <blockquote>
012 * <em>This module, both source code and documentation, is in the
013 * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
014 * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
015 * for further information.
016 * </blockquote>
017 *
018 * <p>If a SAX application needs information about notations and
019 * unparsed entities, then the application implements this
020 * interface and registers an instance with the SAX parser using
021 * the parser's setDTDHandler method. The parser uses the
022 * instance to report notation and unparsed entity declarations to
023 * the application.</p>
024 *
025 * <p>Note that this interface includes only those DTD events that
026 * the XML recommendation <em>requires</em> processors to report:
027 * notation and unparsed entity declarations.</p>
028 *
029 * <p>The SAX parser may report these events in any order, regardless
030 * of the order in which the notations and unparsed entities were
031 * declared; however, all DTD events must be reported after the
032 * document handler's startDocument event, and before the first
033 * startElement event.
034 * (If the {@link org.xml.sax.ext.LexicalHandler LexicalHandler} is
035 * used, these events must also be reported before the endDTD event.)
036 * </p>
037 *
038 * <p>It is up to the application to store the information for
039 * future use (perhaps in a hash table or object tree).
040 * If the application encounters attributes of type "NOTATION",
041 * "ENTITY", or "ENTITIES", it can use the information that it
042 * obtained through this interface to find the entity and/or
043 * notation corresponding with the attribute value.</p>
044 *
045 * @since SAX 1.0
046 * @author David Megginson
047 * @version 2.0.1 (sax2r2)
048 * @see org.xml.sax.XMLReader#setDTDHandler
049 */
050 public interface DTDHandler {
051
052
053 /**
054 * Receive notification of a notation declaration event.
055 *
056 * <p>It is up to the application to record the notation for later
057 * reference, if necessary;
058 * notations may appear as attribute values and in unparsed entity
059 * declarations, and are sometime used with processing instruction
060 * target names.</p>
061 *
062 * <p>At least one of publicId and systemId must be non-null.
063 * If a system identifier is present, and it is a URL, the SAX
064 * parser must resolve it fully before passing it to the
065 * application through this event.</p>
066 *
067 * <p>There is no guarantee that the notation declaration will be
068 * reported before any unparsed entities that use it.</p>
069 *
070 * @param name The notation name.
071 * @param publicId The notation's public identifier, or null if
072 * none was given.
073 * @param systemId The notation's system identifier, or null if
074 * none was given.
075 * @exception org.xml.sax.SAXException Any SAX exception, possibly
076 * wrapping another exception.
077 * @see #unparsedEntityDecl
078 * @see org.xml.sax.Attributes
079 */
080 public abstract void notationDecl (String name,
081 String publicId,
082 String systemId)
083 throws SAXException;
084
085
086 /**
087 * Receive notification of an unparsed entity declaration event.
088 *
089 * <p>Note that the notation name corresponds to a notation
090 * reported by the {@link #notationDecl notationDecl} event.
091 * It is up to the application to record the entity for later
092 * reference, if necessary;
093 * unparsed entities may appear as attribute values.
094 * </p>
095 *
096 * <p>If the system identifier is a URL, the parser must resolve it
097 * fully before passing it to the application.</p>
098 *
099 * @exception org.xml.sax.SAXException Any SAX exception, possibly
100 * wrapping another exception.
101 * @param name The unparsed entity's name.
102 * @param publicId The entity's public identifier, or null if none
103 * was given.
104 * @param systemId The entity's system identifier.
105 * @param notationName The name of the associated notation.
106 * @see #notationDecl
107 * @see org.xml.sax.Attributes
108 */
109 public abstract void unparsedEntityDecl (String name,
110 String publicId,
111 String systemId,
112 String notationName)
113 throws SAXException;
114
115 }
116
117 // end of DTDHandler.java