< prev index next >

src/java.base/share/classes/jdk/internal/org/xml/sax/DTDHandler.java

Print this page


   1 /*
   2  * Copyright (c) 2000, 2012, 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


  56  * declared; however, all DTD events must be reported after the
  57  * document handler's startDocument event, and before the first
  58  * startElement event.
  59  * (If the {@link org.xml.sax.ext.LexicalHandler LexicalHandler} is
  60  * used, these events must also be reported before the endDTD event.)
  61  * </p>
  62  *
  63  * <p>It is up to the application to store the information for
  64  * future use (perhaps in a hash table or object tree).
  65  * If the application encounters attributes of type "NOTATION",
  66  * "ENTITY", or "ENTITIES", it can use the information that it
  67  * obtained through this interface to find the entity and/or
  68  * notation corresponding with the attribute value.</p>
  69  *
  70  * @since SAX 1.0
  71  * @author David Megginson
  72  * @see org.xml.sax.XMLReader#setDTDHandler
  73  */
  74 public interface DTDHandler {
  75 
  76 
  77     /**
  78      * Receive notification of a notation declaration event.
  79      *
  80      * <p>It is up to the application to record the notation for later
  81      * reference, if necessary;
  82      * notations may appear as attribute values and in unparsed entity
  83      * declarations, and are sometime used with processing instruction
  84      * target names.</p>
  85      *
  86      * <p>At least one of publicId and systemId must be non-null.
  87      * If a system identifier is present, and it is a URL, the SAX
  88      * parser must resolve it fully before passing it to the
  89      * application through this event.</p>
  90      *
  91      * <p>There is no guarantee that the notation declaration will be
  92      * reported before any unparsed entities that use it.</p>
  93      *
  94      * @param name The notation name.
  95      * @param publicId The notation's public identifier, or null if
  96      *        none was given.


 119      *
 120      * <p>If the system identifier is a URL, the parser must resolve it
 121      * fully before passing it to the application.</p>
 122      *
 123      * @exception org.xml.sax.SAXException Any SAX exception, possibly
 124      *            wrapping another exception.
 125      * @param name The unparsed entity's name.
 126      * @param publicId The entity's public identifier, or null if none
 127      *        was given.
 128      * @param systemId The entity's system identifier.
 129      * @param notationName The name of the associated notation.
 130      * @see #notationDecl
 131      * @see org.xml.sax.Attributes
 132      */
 133     public abstract void unparsedEntityDecl (String name,
 134                                              String publicId,
 135                                              String systemId,
 136                                              String notationName)
 137         throws SAXException;
 138 












































 139 }
 140 
 141 // end of DTDHandler.java
   1 /*
   2  * Copyright (c) 2000, 2018, 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


  56  * declared; however, all DTD events must be reported after the
  57  * document handler's startDocument event, and before the first
  58  * startElement event.
  59  * (If the {@link org.xml.sax.ext.LexicalHandler LexicalHandler} is
  60  * used, these events must also be reported before the endDTD event.)
  61  * </p>
  62  *
  63  * <p>It is up to the application to store the information for
  64  * future use (perhaps in a hash table or object tree).
  65  * If the application encounters attributes of type "NOTATION",
  66  * "ENTITY", or "ENTITIES", it can use the information that it
  67  * obtained through this interface to find the entity and/or
  68  * notation corresponding with the attribute value.</p>
  69  *
  70  * @since SAX 1.0
  71  * @author David Megginson
  72  * @see org.xml.sax.XMLReader#setDTDHandler
  73  */
  74 public interface DTDHandler {
  75 

  76     /**
  77      * Receive notification of a notation declaration event.
  78      *
  79      * <p>It is up to the application to record the notation for later
  80      * reference, if necessary;
  81      * notations may appear as attribute values and in unparsed entity
  82      * declarations, and are sometime used with processing instruction
  83      * target names.</p>
  84      *
  85      * <p>At least one of publicId and systemId must be non-null.
  86      * If a system identifier is present, and it is a URL, the SAX
  87      * parser must resolve it fully before passing it to the
  88      * application through this event.</p>
  89      *
  90      * <p>There is no guarantee that the notation declaration will be
  91      * reported before any unparsed entities that use it.</p>
  92      *
  93      * @param name The notation name.
  94      * @param publicId The notation's public identifier, or null if
  95      *        none was given.


 118      *
 119      * <p>If the system identifier is a URL, the parser must resolve it
 120      * fully before passing it to the application.</p>
 121      *
 122      * @exception org.xml.sax.SAXException Any SAX exception, possibly
 123      *            wrapping another exception.
 124      * @param name The unparsed entity's name.
 125      * @param publicId The entity's public identifier, or null if none
 126      *        was given.
 127      * @param systemId The entity's system identifier.
 128      * @param notationName The name of the associated notation.
 129      * @see #notationDecl
 130      * @see org.xml.sax.Attributes
 131      */
 132     public abstract void unparsedEntityDecl (String name,
 133                                              String publicId,
 134                                              String systemId,
 135                                              String notationName)
 136         throws SAXException;
 137 
 138     // from SAX2 extension DeclHandler
 139     /**
 140      * Receive notification of the start of DTD declarations.
 141      *
 142      * The start/endDTD events appear within the start/endDocument events
 143      * from ContentHandler.
 144      *
 145      * @param name The document type name.
 146      * @param publicId The declared public identifier for the
 147      *        external DTD subset, or null if none was declared.
 148      * @param systemId The declared system identifier for the
 149      *        external DTD subset, or null if none was declared.
 150      *        (Note that this is not resolved against the document
 151      *        base URI.)
 152      * @throws SAXException the event receiver may throw an exception during processing
 153      */
 154     default public void startDTD (String name, String publicId, String systemId)
 155         throws SAXException
 156     {
 157         // no op
 158     }
 159 
 160 
 161     /**
 162      * Receive notification of the end of DTD declarations.
 163      *
 164      * @throws SAXException the event receiver may throw an exception during processing
 165      */
 166     default public void endDTD () throws SAXException
 167     {
 168         // no op
 169     }
 170 
 171     // Custom API for the Properties
 172 
 173     /**
 174      * Receive notification of the start of DTD internal subset.
 175      *
 176      * @throws SAXException the event receiver may throw an exception during processing
 177      */
 178     default public void startInternalSub ()  throws SAXException
 179     {
 180         // no op
 181     }
 182 }
 183 
 184 // end of DTDHandler.java
< prev index next >