Path: blob/aarch64-shenandoah-jdk8u272-b10/jaxp/src/org/xml/sax/ext/Attributes2.java
48576 views
/*1* Copyright (c) 2004, 2005, 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*/2425// Attributes2.java - extended Attributes26// http://www.saxproject.org27// Public Domain: no warranty.28// $Id: Attributes2.java,v 1.2 2004/11/03 22:49:07 jsuttor Exp $2930package org.xml.sax.ext;3132import org.xml.sax.Attributes;333435/**36* SAX2 extension to augment the per-attribute information37* provided though {@link Attributes}.38* If an implementation supports this extension, the attributes39* provided in {@link org.xml.sax.ContentHandler#startElement40* ContentHandler.startElement() } will implement this interface,41* and the <em>http://xml.org/sax/features/use-attributes2</em>42* feature flag will have the value <em>true</em>.43*44* <blockquote>45* <em>This module, both source code and documentation, is in the46* Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>47* </blockquote>48*49* <p> XMLReader implementations are not required to support this50* information, and it is not part of core-only SAX2 distributions.</p>51*52* <p>Note that if an attribute was defaulted (<em>!isSpecified()</em>)53* it will of necessity also have been declared (<em>isDeclared()</em>)54* in the DTD.55* Similarly if an attribute's type is anything except CDATA, then it56* must have been declared.57* </p>58*59* @since SAX 2.0 (extensions 1.1 alpha)60* @author David Brownell61*/62public interface Attributes2 extends Attributes63{64/**65* Returns false unless the attribute was declared in the DTD.66* This helps distinguish two kinds of attributes that SAX reports67* as CDATA: ones that were declared (and hence are usually valid),68* and those that were not (and which are never valid).69*70* @param index The attribute index (zero-based).71* @return true if the attribute was declared in the DTD,72* false otherwise.73* @exception java.lang.ArrayIndexOutOfBoundsException When the74* supplied index does not identify an attribute.75*/76public boolean isDeclared (int index);7778/**79* Returns false unless the attribute was declared in the DTD.80* This helps distinguish two kinds of attributes that SAX reports81* as CDATA: ones that were declared (and hence are usually valid),82* and those that were not (and which are never valid).83*84* @param qName The XML qualified (prefixed) name.85* @return true if the attribute was declared in the DTD,86* false otherwise.87* @exception java.lang.IllegalArgumentException When the88* supplied name does not identify an attribute.89*/90public boolean isDeclared (String qName);9192/**93* Returns false unless the attribute was declared in the DTD.94* This helps distinguish two kinds of attributes that SAX reports95* as CDATA: ones that were declared (and hence are usually valid),96* and those that were not (and which are never valid).97*98* <p>Remember that since DTDs do not "understand" namespaces, the99* namespace URI associated with an attribute may not have come from100* the DTD. The declaration will have applied to the attribute's101* <em>qName</em>.102*103* @param uri The Namespace URI, or the empty string if104* the name has no Namespace URI.105* @param localName The attribute's local name.106* @return true if the attribute was declared in the DTD,107* false otherwise.108* @exception java.lang.IllegalArgumentException When the109* supplied names do not identify an attribute.110*/111public boolean isDeclared (String uri, String localName);112113/**114* Returns true unless the attribute value was provided115* by DTD defaulting.116*117* @param index The attribute index (zero-based).118* @return true if the value was found in the XML text,119* false if the value was provided by DTD defaulting.120* @exception java.lang.ArrayIndexOutOfBoundsException When the121* supplied index does not identify an attribute.122*/123public boolean isSpecified (int index);124125/**126* Returns true unless the attribute value was provided127* by DTD defaulting.128*129* <p>Remember that since DTDs do not "understand" namespaces, the130* namespace URI associated with an attribute may not have come from131* the DTD. The declaration will have applied to the attribute's132* <em>qName</em>.133*134* @param uri The Namespace URI, or the empty string if135* the name has no Namespace URI.136* @param localName The attribute's local name.137* @return true if the value was found in the XML text,138* false if the value was provided by DTD defaulting.139* @exception java.lang.IllegalArgumentException When the140* supplied names do not identify an attribute.141*/142public boolean isSpecified (String uri, String localName);143144/**145* Returns true unless the attribute value was provided146* by DTD defaulting.147*148* @param qName The XML qualified (prefixed) name.149* @return true if the value was found in the XML text,150* false if the value was provided by DTD defaulting.151* @exception java.lang.IllegalArgumentException When the152* supplied name does not identify an attribute.153*/154public boolean isSpecified (String qName);155}156157158