325N/A * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. 325N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 325N/A * This code is free software; you can redistribute it and/or modify it 325N/A * under the terms of the GNU General Public License version 2 only, as 325N/A * published by the Free Software Foundation. Oracle designates this 325N/A * particular file as subject to the "Classpath" exception as provided 325N/A * by Oracle in the LICENSE file that accompanied this code. 325N/A * This code is distributed in the hope that it will be useful, but WITHOUT 325N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 325N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 325N/A * version 2 for more details (a copy is included in the LICENSE file that 325N/A * accompanied this code). 325N/A * You should have received a copy of the GNU General Public License version 325N/A * 2 along with this work; if not, write to the Free Software Foundation, 325N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 325N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 325N/A * or visit www.oracle.com if you need additional information or have any 325N/A// Written by David Megginson, sax@megginson.com 325N/A// NO WARRANTY! This class is in the public domain. 325N/A//fixed bug at removeAttribute!! by Daisuke OKAJIMA 2002.4.21 325N/A * Default implementation of the Attributes interface. 325N/A * <em>This module, both source code and documentation, is in the 325N/A * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em> 325N/A * <p>This class provides a default implementation of the SAX2 325N/A * {@link org.xml.sax.Attributes Attributes} interface, with the 325N/A * addition of manipulators so that the list can be modified or 325N/A * <p>There are two typical uses of this class:</p> 325N/A * <li>to take a persistent snapshot of an Attributes object 325N/A * in a {@link org.xml.sax.ContentHandler#startElement startElement} event; or</li> 325N/A * <li>to construct or modify an Attributes object in a SAX2 driver or filter.</li> 325N/A * <p>This class replaces the now-deprecated SAX1 {@link 325N/A * org.xml.sax.helpers.AttributeListImpl AttributeListImpl} 325N/A * class; in addition to supporting the updated Attributes 325N/A * interface rather than the deprecated {@link org.xml.sax.AttributeList 325N/A * AttributeList} interface, it also includes a much more efficient 325N/A * implementation using a single array rather than a set of Vectors.</p> 325N/A * @author David Megginson, 325N/A * <a href="mailto:sax@megginson.com">sax@megginson.com</a> 325N/A //////////////////////////////////////////////////////////////////// 325N/A //////////////////////////////////////////////////////////////////// 325N/A * Construct a new, empty AttributesImpl object. 325N/A * Copy an existing Attributes object. 325N/A * <p>This constructor is especially useful inside a 325N/A * {@link org.xml.sax.ContentHandler#startElement startElement} event.</p> 325N/A * @param atts The existing Attributes object. 325N/A //////////////////////////////////////////////////////////////////// 325N/A //////////////////////////////////////////////////////////////////// 325N/A * Return the number of attributes in the list. 325N/A * @return The number of attributes in the list. 325N/A * Return an attribute's Namespace URI. 325N/A * @param index The attribute's index (zero-based). 325N/A * @return The Namespace URI, the empty string if none is 325N/A * available, or null if the index is out of range. 325N/A * Return an attribute's local name. 325N/A * @param index The attribute's index (zero-based). 325N/A * @return The attribute's local name, the empty string if 325N/A * none is available, or null if the index if out of range. 325N/A * Return an attribute's qualified (prefixed) name. 325N/A * @param index The attribute's index (zero-based). 325N/A * @return The attribute's qualified name, the empty string if 325N/A * none is available, or null if the index is out of bounds. 325N/A * Return an attribute's type by index. 325N/A * @param index The attribute's index (zero-based). 325N/A * @return The attribute's type, "CDATA" if the type is unknown, or null 325N/A * if the index is out of bounds. 325N/A * Return an attribute's value by index. 325N/A * @param index The attribute's index (zero-based). 325N/A * @return The attribute's value or null if the index is out of bounds. 325N/A * Look up an attribute's index by Namespace name. 325N/A * <p>In many cases, it will be more efficient to look up the name once and 325N/A * use the index query methods rather than using the name query methods 325N/A * @param uri The attribute's Namespace URI, or the empty 325N/A * string if none is available. 325N/A * @param localName The attribute's local name. 325N/A * @return The attribute's index, or -1 if none matches. 325N/A * @see org.xml.sax.Attributes#getIndex(java.lang.String,java.lang.String) 325N/A * Look up an attribute's index by qualified (prefixed) name. 325N/A * @param qName The qualified name. 325N/A * @return The attribute's index, or -1 if none matches. 325N/A * Look up an attribute's type by Namespace-qualified name. 325N/A * @param uri The Namespace URI, or the empty string for a name 325N/A * with no explicit Namespace URI. 325N/A * @param localName The local name. 325N/A * @return The attribute's type, or null if there is no 325N/A * @see org.xml.sax.Attributes#getType(java.lang.String,java.lang.String) 325N/A * Look up an attribute's type by qualified (prefixed) name. 325N/A * @param qName The qualified name. 325N/A * @return The attribute's type, or null if there is no 325N/A * Look up an attribute's value by Namespace-qualified name. 325N/A * @param uri The Namespace URI, or the empty string for a name 325N/A * with no explicit Namespace URI. 325N/A * @param localName The local name. 325N/A * @return The attribute's value, or null if there is no 325N/A * @see org.xml.sax.Attributes#getValue(java.lang.String,java.lang.String) 325N/A * Look up an attribute's value by qualified (prefixed) name. 325N/A * @param qName The qualified name. 325N/A * @return The attribute's value, or null if there is no 325N/A //////////////////////////////////////////////////////////////////// 325N/A //////////////////////////////////////////////////////////////////// 325N/A * Clear the attribute list for reuse. 325N/A * <p>Note that no memory is actually freed by this call: 325N/A * the current arrays are kept so that they can be 325N/A * Copy an entire Attributes object. 325N/A * <p>It may be more efficient to reuse an existing object 325N/A * rather than constantly allocating new ones.</p> 325N/A * @param atts The attributes to copy. 325N/A * Add an attribute to the end of the list. 325N/A * <p>For the sake of speed, this method does no checking 325N/A * to see if the attribute is already in the list: that is 325N/A * the responsibility of the application.</p> 325N/A * @param uri The Namespace URI, or the empty string if 325N/A * none is available or Namespace processing is not 325N/A * @param localName The local name, or the empty string if 325N/A * Namespace processing is not being performed. 325N/A * @param qName The qualified (prefixed) name, or the empty string 325N/A * if qualified names are not available. 325N/A * @param type The attribute type as a string. 325N/A * @param value The attribute value. 325N/A * Set an attribute in the list. 325N/A * <p>For the sake of speed, this method does no checking 325N/A * for name conflicts or well-formedness: such checks are the 325N/A * responsibility of the application.</p> 325N/A * @param index The index of the attribute (zero-based). 325N/A * @param uri The Namespace URI, or the empty string if 325N/A * none is available or Namespace processing is not 325N/A * @param localName The local name, or the empty string if 325N/A * Namespace processing is not being performed. 325N/A * @param qName The qualified name, or the empty string 325N/A * if qualified names are not available. 325N/A * @param type The attribute type as a string. 325N/A * @param value The attribute value. 325N/A * @exception java.lang.ArrayIndexOutOfBoundsException When the 325N/A * supplied index does not point to an attribute 325N/A * Remove an attribute from the list. 325N/A * @param index The index of the attribute (zero-based). 325N/A * @exception java.lang.ArrayIndexOutOfBoundsException When the 325N/A * supplied index does not point to an attribute 325N/A * Set the Namespace URI of a specific attribute. 325N/A * @param index The index of the attribute (zero-based). 325N/A * @param uri The attribute's Namespace URI, or the empty 325N/A * @exception java.lang.ArrayIndexOutOfBoundsException When the 325N/A * supplied index does not point to an attribute 325N/A * Set the local name of a specific attribute. 325N/A * @param index The index of the attribute (zero-based). 325N/A * @param localName The attribute's local name, or the empty 325N/A * @exception java.lang.ArrayIndexOutOfBoundsException When the 325N/A * supplied index does not point to an attribute 325N/A * Set the qualified name of a specific attribute. 325N/A * @param index The index of the attribute (zero-based). 325N/A * @param qName The attribute's qualified name, or the empty 325N/A * @exception java.lang.ArrayIndexOutOfBoundsException When the 325N/A * supplied index does not point to an attribute 325N/A * Set the type of a specific attribute. 325N/A * @param index The index of the attribute (zero-based). 325N/A * @param type The attribute's type. 325N/A * @exception java.lang.ArrayIndexOutOfBoundsException When the 325N/A * supplied index does not point to an attribute 325N/A * Set the value of a specific attribute. 325N/A * @param index The index of the attribute (zero-based). 325N/A * @param value The attribute's value. 325N/A * @exception java.lang.ArrayIndexOutOfBoundsException When the 325N/A * supplied index does not point to an attribute 325N/A //////////////////////////////////////////////////////////////////// 325N/A //////////////////////////////////////////////////////////////////// 325N/A * Ensure the internal array's capacity. 325N/A * @param n The minimum number of attributes that the array must 325N/A * Report a bad array index in a manipulator. 325N/A * @param index The index to report. 325N/A * @exception java.lang.ArrayIndexOutOfBoundsException Always. 325N/A "Attempt to modify attribute at illegal index: " +
index;
325N/A //////////////////////////////////////////////////////////////////// 325N/A ////////////////////////////////////////////////////////////////////