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 * 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 * 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 * 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 * 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// Written by David Megginson 286N/A// NO WARRANTY! This class is in the public domain. 286N/A * Default implementation of the Attributes interface. 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 * for further information. 286N/A * <p>This class provides a default implementation of the SAX2 286N/A * {@link org.xml.sax.Attributes Attributes} interface, with the 286N/A * addition of manipulators so that the list can be modified or 286N/A * <p>There are two typical uses of this class:</p> 286N/A * <li>to take a persistent snapshot of an Attributes object 286N/A * in a {@link org.xml.sax.ContentHandler#startElement startElement} event; or</li> 286N/A * <li>to construct or modify an Attributes object in a SAX2 driver or filter.</li> 286N/A * <p>This class replaces the now-deprecated SAX1 {@link 286N/A * org.xml.sax.helpers.AttributeListImpl AttributeListImpl} 286N/A * class; in addition to supporting the updated Attributes 286N/A * interface rather than the deprecated {@link org.xml.sax.AttributeList 286N/A * AttributeList} interface, it also includes a much more efficient 286N/A * implementation using a single array rather than a set of Vectors.</p> 286N/A * @author David Megginson 286N/A //////////////////////////////////////////////////////////////////// 286N/A //////////////////////////////////////////////////////////////////// 286N/A * Construct a new, empty AttributesImpl object. 286N/A * Copy an existing Attributes object. 286N/A * <p>This constructor is especially useful inside a 286N/A * {@link org.xml.sax.ContentHandler#startElement startElement} event.</p> 286N/A * @param atts The existing Attributes object. 286N/A //////////////////////////////////////////////////////////////////// 286N/A //////////////////////////////////////////////////////////////////// 286N/A * Return the number of attributes in the list. 286N/A * @return The number of attributes in the list. 286N/A * Return an attribute's Namespace URI. 286N/A * @param index The attribute's index (zero-based). 286N/A * @return The Namespace URI, the empty string if none is 286N/A * available, or null if the index is out of range. 286N/A * Return an attribute's local name. 286N/A * @param index The attribute's index (zero-based). 286N/A * @return The attribute's local name, the empty string if 286N/A * none is available, or null if the index if out of range. 286N/A * Return an attribute's qualified (prefixed) name. 286N/A * @param index The attribute's index (zero-based). 286N/A * @return The attribute's qualified name, the empty string if 286N/A * none is available, or null if the index is out of bounds. 286N/A * Return an attribute's type by index. 286N/A * @param index The attribute's index (zero-based). 286N/A * @return The attribute's type, "CDATA" if the type is unknown, or null 286N/A * if the index is out of bounds. 286N/A * Return an attribute's value by index. 286N/A * @param index The attribute's index (zero-based). 286N/A * @return The attribute's value or null if the index is out of bounds. 286N/A * Look up an attribute's index by Namespace name. 286N/A * <p>In many cases, it will be more efficient to look up the name once and 286N/A * use the index query methods rather than using the name query methods 286N/A * @param uri The attribute's Namespace URI, or the empty 286N/A * string if none is available. 286N/A * @param localName The attribute's local name. 286N/A * @return The attribute's index, or -1 if none matches. 286N/A * @see org.xml.sax.Attributes#getIndex(java.lang.String,java.lang.String) 286N/A * Look up an attribute's index by qualified (prefixed) name. 286N/A * @param qName The qualified name. 286N/A * @return The attribute's index, or -1 if none matches. 286N/A * Look up an attribute's type by Namespace-qualified name. 286N/A * @param uri The Namespace URI, or the empty string for a name 286N/A * with no explicit Namespace URI. 286N/A * @param localName The local name. 286N/A * @return The attribute's type, or null if there is no 286N/A * @see org.xml.sax.Attributes#getType(java.lang.String,java.lang.String) 286N/A * Look up an attribute's type by qualified (prefixed) name. 286N/A * @param qName The qualified name. 286N/A * @return The attribute's type, or null if there is no 286N/A * Look up an attribute's value by Namespace-qualified name. 286N/A * @param uri The Namespace URI, or the empty string for a name 286N/A * with no explicit Namespace URI. 286N/A * @param localName The local name. 286N/A * @return The attribute's value, or null if there is no 286N/A * @see org.xml.sax.Attributes#getValue(java.lang.String,java.lang.String) 286N/A * Look up an attribute's value by qualified (prefixed) name. 286N/A * @param qName The qualified name. 286N/A * @return The attribute's value, or null if there is no 286N/A //////////////////////////////////////////////////////////////////// 286N/A //////////////////////////////////////////////////////////////////// 286N/A * Clear the attribute list for reuse. 286N/A * <p>Note that little memory is freed by this call: 286N/A * the current array is kept so it can be 286N/A * Copy an entire Attributes object. 286N/A * <p>It may be more efficient to reuse an existing object 286N/A * rather than constantly allocating new ones.</p> 286N/A * @param atts The attributes to copy. 286N/A * Add an attribute to the end of the list. 286N/A * <p>For the sake of speed, this method does no checking 286N/A * to see if the attribute is already in the list: that is 286N/A * the responsibility of the application.</p> 286N/A * @param uri The Namespace URI, or the empty string if 286N/A * none is available or Namespace processing is not 286N/A * @param localName The local name, or the empty string if 286N/A * Namespace processing is not being performed. 286N/A * @param qName The qualified (prefixed) name, or the empty string 286N/A * if qualified names are not available. 286N/A * @param type The attribute type as a string. 286N/A * @param value The attribute value. 286N/A * Set an attribute in the list. 286N/A * <p>For the sake of speed, this method does no checking 286N/A * for name conflicts or well-formedness: such checks are the 286N/A * responsibility of the application.</p> 286N/A * @param index The index of the attribute (zero-based). 286N/A * @param uri The Namespace URI, or the empty string if 286N/A * none is available or Namespace processing is not 286N/A * @param localName The local name, or the empty string if 286N/A * Namespace processing is not being performed. 286N/A * @param qName The qualified name, or the empty string 286N/A * if qualified names are not available. 286N/A * @param type The attribute type as a string. 286N/A * @param value The attribute value. 286N/A * @exception java.lang.ArrayIndexOutOfBoundsException When the 286N/A * supplied index does not point to an attribute 286N/A * Remove an attribute from the list. 286N/A * @param index The index of the attribute (zero-based). 286N/A * @exception java.lang.ArrayIndexOutOfBoundsException When the 286N/A * supplied index does not point to an attribute 286N/A * Set the Namespace URI of a specific attribute. 286N/A * @param index The index of the attribute (zero-based). 286N/A * @param uri The attribute's Namespace URI, or the empty 286N/A * @exception java.lang.ArrayIndexOutOfBoundsException When the 286N/A * supplied index does not point to an attribute 286N/A * Set the local name of a specific attribute. 286N/A * @param index The index of the attribute (zero-based). 286N/A * @param localName The attribute's local name, or the empty 286N/A * @exception java.lang.ArrayIndexOutOfBoundsException When the 286N/A * supplied index does not point to an attribute 286N/A * Set the qualified name of a specific attribute. 286N/A * @param index The index of the attribute (zero-based). 286N/A * @param qName The attribute's qualified name, or the empty 286N/A * @exception java.lang.ArrayIndexOutOfBoundsException When the 286N/A * supplied index does not point to an attribute 286N/A * Set the type of a specific attribute. 286N/A * @param index The index of the attribute (zero-based). 286N/A * @param type The attribute's type. 286N/A * @exception java.lang.ArrayIndexOutOfBoundsException When the 286N/A * supplied index does not point to an attribute 286N/A * Set the value of a specific attribute. 286N/A * @param index The index of the attribute (zero-based). 286N/A * @param value The attribute's value. 286N/A * @exception java.lang.ArrayIndexOutOfBoundsException When the 286N/A * supplied index does not point to an attribute 286N/A //////////////////////////////////////////////////////////////////// 286N/A //////////////////////////////////////////////////////////////////// 286N/A * Ensure the internal array's capacity. 286N/A * @param n The minimum number of attributes that the array must 286N/A * Report a bad array index in a manipulator. 286N/A * @param index The index to report. 286N/A * @exception java.lang.ArrayIndexOutOfBoundsException Always. 286N/A "Attempt to modify attribute at illegal index: " +
index;
286N/A //////////////////////////////////////////////////////////////////// 286N/A ////////////////////////////////////////////////////////////////////