286N/A/*
286N/A * Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved.
286N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
286N/A *
286N/A * This code is free software; you can redistribute it and/or modify it
286N/A * under the terms of the GNU General Public License version 2 only, as
286N/A * published by the Free Software Foundation. Oracle designates this
286N/A * particular file as subject to the "Classpath" exception as provided
286N/A * by Oracle in the LICENSE file that accompanied this code.
286N/A *
286N/A * This code is distributed in the hope that it will be useful, but WITHOUT
286N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
286N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
286N/A * version 2 for more details (a copy is included in the LICENSE file that
286N/A * accompanied this code).
286N/A *
286N/A * You should have received a copy of the GNU General Public License version
286N/A * 2 along with this work; if not, write to the Free Software Foundation,
286N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
286N/A *
286N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
286N/A * or visit www.oracle.com if you need additional information or have any
286N/A * questions.
286N/A */
286N/A
286N/A// DeclHandler.java - Optional handler for DTD declaration events.
286N/A// http://www.saxproject.org
286N/A// Public Domain: no warranty.
286N/A// $Id: DeclHandler.java,v 1.2 2004/11/03 22:49:08 jsuttor Exp $
286N/A
286N/Apackage org.xml.sax.ext;
286N/A
286N/Aimport org.xml.sax.SAXException;
286N/A
286N/A
286N/A/**
286N/A * SAX2 extension handler for DTD declaration events.
286N/A *
286N/A * <blockquote>
286N/A * <em>This module, both source code and documentation, is in the
286N/A * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
286N/A * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
286N/A * for further information.
286N/A * </blockquote>
286N/A *
286N/A * <p>This is an optional extension handler for SAX2 to provide more
286N/A * complete information about DTD declarations in an XML document.
286N/A * XML readers are not required to recognize this handler, and it
286N/A * is not part of core-only SAX2 distributions.</p>
286N/A *
286N/A * <p>Note that data-related DTD declarations (unparsed entities and
286N/A * notations) are already reported through the {@link
286N/A * org.xml.sax.DTDHandler DTDHandler} interface.</p>
286N/A *
286N/A * <p>If you are using the declaration handler together with a lexical
286N/A * handler, all of the events will occur between the
286N/A * {@link org.xml.sax.ext.LexicalHandler#startDTD startDTD} and the
286N/A * {@link org.xml.sax.ext.LexicalHandler#endDTD endDTD} events.</p>
286N/A *
286N/A * <p>To set the DeclHandler for an XML reader, use the
286N/A * {@link org.xml.sax.XMLReader#setProperty setProperty} method
286N/A * with the property name
286N/A * <code>http://xml.org/sax/properties/declaration-handler</code>
286N/A * and an object implementing this interface (or null) as the value.
286N/A * If the reader does not report declaration events, it will throw a
286N/A * {@link org.xml.sax.SAXNotRecognizedException SAXNotRecognizedException}
286N/A * when you attempt to register the handler.</p>
286N/A *
286N/A * @since SAX 2.0 (extensions 1.0)
286N/A * @author David Megginson
286N/A */
286N/Apublic interface DeclHandler
286N/A{
286N/A
286N/A /**
286N/A * Report an element type declaration.
286N/A *
286N/A * <p>The content model will consist of the string "EMPTY", the
286N/A * string "ANY", or a parenthesised group, optionally followed
286N/A * by an occurrence indicator. The model will be normalized so
286N/A * that all parameter entities are fully resolved and all whitespace
286N/A * is removed,and will include the enclosing parentheses. Other
286N/A * normalization (such as removing redundant parentheses or
286N/A * simplifying occurrence indicators) is at the discretion of the
286N/A * parser.</p>
286N/A *
286N/A * @param name The element type name.
286N/A * @param model The content model as a normalized string.
286N/A * @exception SAXException The application may raise an exception.
286N/A */
286N/A public abstract void elementDecl (String name, String model)
286N/A throws SAXException;
286N/A
286N/A
286N/A /**
286N/A * Report an attribute type declaration.
286N/A *
286N/A * <p>Only the effective (first) declaration for an attribute will
286N/A * be reported. The type will be one of the strings "CDATA",
286N/A * "ID", "IDREF", "IDREFS", "NMTOKEN", "NMTOKENS", "ENTITY",
286N/A * "ENTITIES", a parenthesized token group with
286N/A * the separator "|" and all whitespace removed, or the word
286N/A * "NOTATION" followed by a space followed by a parenthesized
286N/A * token group with all whitespace removed.</p>
286N/A *
286N/A * <p>The value will be the value as reported to applications,
286N/A * appropriately normalized and with entity and character
286N/A * references expanded. </p>
286N/A *
286N/A * @param eName The name of the associated element.
286N/A * @param aName The name of the attribute.
286N/A * @param type A string representing the attribute type.
286N/A * @param mode A string representing the attribute defaulting mode
286N/A * ("#IMPLIED", "#REQUIRED", or "#FIXED") or null if
286N/A * none of these applies.
286N/A * @param value A string representing the attribute's default value,
286N/A * or null if there is none.
286N/A * @exception SAXException The application may raise an exception.
286N/A */
286N/A public abstract void attributeDecl (String eName,
286N/A String aName,
286N/A String type,
286N/A String mode,
286N/A String value)
286N/A throws SAXException;
286N/A
286N/A
286N/A /**
286N/A * Report an internal entity declaration.
286N/A *
286N/A * <p>Only the effective (first) declaration for each entity
286N/A * will be reported. All parameter entities in the value
286N/A * will be expanded, but general entities will not.</p>
286N/A *
286N/A * @param name The name of the entity. If it is a parameter
286N/A * entity, the name will begin with '%'.
286N/A * @param value The replacement text of the entity.
286N/A * @exception SAXException The application may raise an exception.
286N/A * @see #externalEntityDecl
286N/A * @see org.xml.sax.DTDHandler#unparsedEntityDecl
286N/A */
286N/A public abstract void internalEntityDecl (String name, String value)
286N/A throws SAXException;
286N/A
286N/A
286N/A /**
286N/A * Report a parsed external entity declaration.
286N/A *
286N/A * <p>Only the effective (first) declaration for each entity
286N/A * will be reported.</p>
286N/A *
286N/A * <p>If the system identifier is a URL, the parser must resolve it
286N/A * fully before passing it to the application.</p>
286N/A *
286N/A * @param name The name of the entity. If it is a parameter
286N/A * entity, the name will begin with '%'.
286N/A * @param publicId The entity's public identifier, or null if none
286N/A * was given.
286N/A * @param systemId The entity's system identifier.
286N/A * @exception SAXException The application may raise an exception.
286N/A * @see #internalEntityDecl
286N/A * @see org.xml.sax.DTDHandler#unparsedEntityDecl
286N/A */
286N/A public abstract void externalEntityDecl (String name, String publicId,
286N/A String systemId)
286N/A throws SAXException;
286N/A
286N/A}
286N/A
286N/A// end of DeclHandler.java