Path: blob/master/src/java.xml/share/classes/org/xml/sax/DTDHandler.java
40948 views
/*1* Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425package org.xml.sax;2627/**28* Receive notification of basic DTD-related events.29*30* <p>If a SAX application needs information about notations and31* unparsed entities, then the application implements this32* interface and registers an instance with the SAX parser using33* the parser's setDTDHandler method. The parser uses the34* instance to report notation and unparsed entity declarations to35* the application.</p>36*37* <p>Note that this interface includes only those DTD events that38* the XML recommendation <em>requires</em> processors to report:39* notation and unparsed entity declarations.</p>40*41* <p>The SAX parser may report these events in any order, regardless42* of the order in which the notations and unparsed entities were43* declared; however, all DTD events must be reported after the44* document handler's startDocument event, and before the first45* startElement event.46* (If the {@link org.xml.sax.ext.LexicalHandler LexicalHandler} is47* used, these events must also be reported before the endDTD event.)48* </p>49*50* <p>It is up to the application to store the information for51* future use (perhaps in a hash table or object tree).52* If the application encounters attributes of type "NOTATION",53* "ENTITY", or "ENTITIES", it can use the information that it54* obtained through this interface to find the entity and/or55* notation corresponding with the attribute value.</p>56*57* @since 1.4, SAX 1.058* @author David Megginson59* @see org.xml.sax.XMLReader#setDTDHandler60*/61public interface DTDHandler {626364/**65* Receive notification of a notation declaration event.66*67* <p>It is up to the application to record the notation for later68* reference, if necessary;69* notations may appear as attribute values and in unparsed entity70* declarations, and are sometime used with processing instruction71* target names.</p>72*73* <p>At least one of publicId and systemId must be non-null.74* If a system identifier is present, and it is a URL, the SAX75* parser must resolve it fully before passing it to the76* application through this event.</p>77*78* <p>There is no guarantee that the notation declaration will be79* reported before any unparsed entities that use it.</p>80*81* @param name The notation name.82* @param publicId The notation's public identifier, or null if83* none was given.84* @param systemId The notation's system identifier, or null if85* none was given.86* @throws org.xml.sax.SAXException Any SAX exception, possibly87* wrapping another exception.88* @see #unparsedEntityDecl89* @see org.xml.sax.Attributes90*/91public abstract void notationDecl (String name,92String publicId,93String systemId)94throws SAXException;959697/**98* Receive notification of an unparsed entity declaration event.99*100* <p>Note that the notation name corresponds to a notation101* reported by the {@link #notationDecl notationDecl} event.102* It is up to the application to record the entity for later103* reference, if necessary;104* unparsed entities may appear as attribute values.105* </p>106*107* <p>If the system identifier is a URL, the parser must resolve it108* fully before passing it to the application.</p>109*110* @throws org.xml.sax.SAXException Any SAX exception, possibly111* wrapping another exception.112* @param name The unparsed entity's name.113* @param publicId The entity's public identifier, or null if none114* was given.115* @param systemId The entity's system identifier.116* @param notationName The name of the associated notation.117* @see #notationDecl118* @see org.xml.sax.Attributes119*/120public abstract void unparsedEntityDecl (String name,121String publicId,122String systemId,123String notationName)124throws SAXException;125126}127128// end of DTDHandler.java129130131