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