286N/A/*
286N/A * Copyright (c) 2004, 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// Attributes2.java - extended Attributes
286N/A// http://www.saxproject.org
286N/A// Public Domain: no warranty.
286N/A// $Id: Attributes2.java,v 1.2 2004/11/03 22:49:07 jsuttor Exp $
286N/A
286N/Apackage org.xml.sax.ext;
286N/A
286N/Aimport org.xml.sax.Attributes;
286N/A
286N/A
286N/A/**
286N/A * SAX2 extension to augment the per-attribute information
286N/A * provided though {@link Attributes}.
286N/A * If an implementation supports this extension, the attributes
286N/A * provided in {@link org.xml.sax.ContentHandler#startElement
286N/A * ContentHandler.startElement() } will implement this interface,
286N/A * and the <em>http://xml.org/sax/features/use-attributes2</em>
286N/A * feature flag will have the value <em>true</em>.
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 * </blockquote>
286N/A *
286N/A * <p> XMLReader implementations are not required to support this
286N/A * information, and it is not part of core-only SAX2 distributions.</p>
286N/A *
286N/A * <p>Note that if an attribute was defaulted (<em>!isSpecified()</em>)
286N/A * it will of necessity also have been declared (<em>isDeclared()</em>)
286N/A * in the DTD.
286N/A * Similarly if an attribute's type is anything except CDATA, then it
286N/A * must have been declared.
286N/A * </p>
286N/A *
286N/A * @since SAX 2.0 (extensions 1.1 alpha)
286N/A * @author David Brownell
286N/A */
286N/Apublic interface Attributes2 extends Attributes
286N/A{
286N/A /**
286N/A * Returns false unless the attribute was declared in the DTD.
286N/A * This helps distinguish two kinds of attributes that SAX reports
286N/A * as CDATA: ones that were declared (and hence are usually valid),
286N/A * and those that were not (and which are never valid).
286N/A *
286N/A * @param index The attribute index (zero-based).
286N/A * @return true if the attribute was declared in the DTD,
286N/A * false otherwise.
286N/A * @exception java.lang.ArrayIndexOutOfBoundsException When the
286N/A * supplied index does not identify an attribute.
286N/A */
286N/A public boolean isDeclared (int index);
286N/A
286N/A /**
286N/A * Returns false unless the attribute was declared in the DTD.
286N/A * This helps distinguish two kinds of attributes that SAX reports
286N/A * as CDATA: ones that were declared (and hence are usually valid),
286N/A * and those that were not (and which are never valid).
286N/A *
286N/A * @param qName The XML qualified (prefixed) name.
286N/A * @return true if the attribute was declared in the DTD,
286N/A * false otherwise.
286N/A * @exception java.lang.IllegalArgumentException When the
286N/A * supplied name does not identify an attribute.
286N/A */
286N/A public boolean isDeclared (String qName);
286N/A
286N/A /**
286N/A * Returns false unless the attribute was declared in the DTD.
286N/A * This helps distinguish two kinds of attributes that SAX reports
286N/A * as CDATA: ones that were declared (and hence are usually valid),
286N/A * and those that were not (and which are never valid).
286N/A *
286N/A * <p>Remember that since DTDs do not "understand" namespaces, the
286N/A * namespace URI associated with an attribute may not have come from
286N/A * the DTD. The declaration will have applied to the attribute's
286N/A * <em>qName</em>.
286N/A *
286N/A * @param uri The Namespace URI, or the empty string if
286N/A * the name has no Namespace URI.
286N/A * @param localName The attribute's local name.
286N/A * @return true if the attribute was declared in the DTD,
286N/A * false otherwise.
286N/A * @exception java.lang.IllegalArgumentException When the
286N/A * supplied names do not identify an attribute.
286N/A */
286N/A public boolean isDeclared (String uri, String localName);
286N/A
286N/A /**
286N/A * Returns true unless the attribute value was provided
286N/A * by DTD defaulting.
286N/A *
286N/A * @param index The attribute index (zero-based).
286N/A * @return true if the value was found in the XML text,
286N/A * false if the value was provided by DTD defaulting.
286N/A * @exception java.lang.ArrayIndexOutOfBoundsException When the
286N/A * supplied index does not identify an attribute.
286N/A */
286N/A public boolean isSpecified (int index);
286N/A
286N/A /**
286N/A * Returns true unless the attribute value was provided
286N/A * by DTD defaulting.
286N/A *
286N/A * <p>Remember that since DTDs do not "understand" namespaces, the
286N/A * namespace URI associated with an attribute may not have come from
286N/A * the DTD. The declaration will have applied to the attribute's
286N/A * <em>qName</em>.
286N/A *
286N/A * @param uri The Namespace URI, or the empty string if
286N/A * the name has no Namespace URI.
286N/A * @param localName The attribute's local name.
286N/A * @return true if the value was found in the XML text,
286N/A * false if the value was provided by DTD defaulting.
286N/A * @exception java.lang.IllegalArgumentException When the
286N/A * supplied names do not identify an attribute.
286N/A */
286N/A public boolean isSpecified (String uri, String localName);
286N/A
286N/A /**
286N/A * Returns true unless the attribute value was provided
286N/A * by DTD defaulting.
286N/A *
286N/A * @param qName The XML qualified (prefixed) name.
286N/A * @return true if the value was found in the XML text,
286N/A * false if the value was provided by DTD defaulting.
286N/A * @exception java.lang.IllegalArgumentException When the
286N/A * supplied name does not identify an attribute.
286N/A */
286N/A public boolean isSpecified (String qName);
286N/A}