1 /* 2 * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. Oracle designates this 8 * particular file as subject to the "Classpath" exception as provided 9 * by Oracle in the LICENSE file that accompanied this code. 10 * 11 * This code is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License version 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 26 package org.xml.sax; 27 28 /** 29 * Receive notification of basic DTD-related events. 30 * 31 * <p>If a SAX application needs information about notations and 32 * unparsed entities, then the application implements this 33 * interface and registers an instance with the SAX parser using 34 * the parser's setDTDHandler method. The parser uses the 35 * instance to report notation and unparsed entity declarations to 36 * the application.</p> 37 * 38 * <p>Note that this interface includes only those DTD events that 39 * the XML recommendation <em>requires</em> processors to report: 40 * notation and unparsed entity declarations.</p> 41 * 42 * <p>The SAX parser may report these events in any order, regardless 43 * of the order in which the notations and unparsed entities were 44 * declared; however, all DTD events must be reported after the 45 * document handler's startDocument event, and before the first 46 * startElement event. 47 * (If the {@link org.xml.sax.ext.LexicalHandler LexicalHandler} is 48 * used, these events must also be reported before the endDTD event.) 49 * </p> 50 * 51 * <p>It is up to the application to store the information for 52 * future use (perhaps in a hash table or object tree). 53 * If the application encounters attributes of type "NOTATION", 54 * "ENTITY", or "ENTITIES", it can use the information that it 55 * obtained through this interface to find the entity and/or 56 * notation corresponding with the attribute value.</p> 57 * 58 * @since 1.4, SAX 1.0 59 * @author David Megginson 60 * @see org.xml.sax.XMLReader#setDTDHandler 61 */ 62 public interface DTDHandler { 63 64 65 /** 66 * Receive notification of a notation declaration event. 67 * 68 * <p>It is up to the application to record the notation for later 69 * reference, if necessary; 70 * notations may appear as attribute values and in unparsed entity 71 * declarations, and are sometime used with processing instruction 72 * target names.</p> 73 * 74 * <p>At least one of publicId and systemId must be non-null. 75 * If a system identifier is present, and it is a URL, the SAX 76 * parser must resolve it fully before passing it to the 77 * application through this event.</p> 78 * 79 * <p>There is no guarantee that the notation declaration will be 80 * reported before any unparsed entities that use it.</p> 81 * 82 * @param name The notation name. 83 * @param publicId The notation's public identifier, or null if 84 * none was given. 85 * @param systemId The notation's system identifier, or null if 86 * none was given. 87 * @exception org.xml.sax.SAXException Any SAX exception, possibly 88 * wrapping another exception. 89 * @see #unparsedEntityDecl 90 * @see org.xml.sax.Attributes 91 */ 92 public abstract void notationDecl (String name, 93 String publicId, 94 String systemId) 95 throws SAXException; 96 97 98 /** 99 * Receive notification of an unparsed entity declaration event. 100 * 101 * <p>Note that the notation name corresponds to a notation 102 * reported by the {@link #notationDecl notationDecl} event. 103 * It is up to the application to record the entity for later 104 * reference, if necessary; 105 * unparsed entities may appear as attribute values. 106 * </p> 107 * 108 * <p>If the system identifier is a URL, the parser must resolve it 109 * fully before passing it to the application.</p> 110 * 111 * @exception org.xml.sax.SAXException Any SAX exception, possibly 112 * wrapping another exception. 113 * @param name The unparsed entity's name. 114 * @param publicId The entity's public identifier, or null if none 115 * was given. 116 * @param systemId The entity's system identifier. 117 * @param notationName The name of the associated notation. 118 * @see #notationDecl 119 * @see org.xml.sax.Attributes 120 */ 121 public abstract void unparsedEntityDecl (String name, 122 String publicId, 123 String systemId, 124 String notationName) 125 throws SAXException; 126 127 } 128 129 // end of DTDHandler.java