001: // SAX DTD handler.
002: // No warranty; no copyright -- use this as you will.
003: // $Id$
004:
005: package 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: */
046: public interface DTDHandler {
047:
048: /**
049: * Receive notification of a notation declaration event.
050: *
051: * <p>It is up to the application to record the notation for later
052: * reference, if necessary.</p>
053: *
054: * <p>At least one of publicId and systemId must be non-null.
055: * If a system identifier is present, and it is a URL, the SAX
056: * parser must resolve it fully before passing it to the
057: * application through this event.</p>
058: *
059: * <p>There is no guarantee that the notation declaration will be
060: * reported before any unparsed entities that use it.</p>
061: *
062: * @param name The notation name.
063: * @param publicId The notation's public identifier, or null if
064: * none was given.
065: * @param systemId The notation's system identifier, or null if
066: * none was given.
067: * @exception org.xml.sax.SAXException Any SAX exception, possibly
068: * wrapping another exception.
069: * @see #unparsedEntityDecl
070: * @see org.xml.sax.AttributeList
071: */
072: public abstract void notationDecl(String name, String publicId,
073: String systemId) throws SAXException;
074:
075: /**
076: * Receive notification of an unparsed entity declaration event.
077: *
078: * <p>Note that the notation name corresponds to a notation
079: * reported by the {@link #notationDecl notationDecl} event.
080: * It is up to the application to record the entity for later
081: * reference, if necessary.</p>
082: *
083: * <p>If the system identifier is a URL, the parser must resolve it
084: * fully before passing it to the application.</p>
085: *
086: * @exception org.xml.sax.SAXException Any SAX exception, possibly
087: * wrapping another exception.
088: * @param name The unparsed entity's name.
089: * @param publicId The entity's public identifier, or null if none
090: * was given.
091: * @param systemId The entity's system identifier.
092: * @param notation name The name of the associated notation.
093: * @see #notationDecl
094: * @see org.xml.sax.AttributeList
095: */
096: public abstract void unparsedEntityDecl(String name,
097: String publicId, String systemId, String notationName)
098: throws SAXException;
099:
100: }
101:
102: // end of DTDHandler.java
|