]> oss.titaniummirror.com Git - msp430-gcc.git/blobdiff - libjava/org/xml/sax/helpers/AttributeListImpl.java
Imported gcc-4.4.3
[msp430-gcc.git] / libjava / org / xml / sax / helpers / AttributeListImpl.java
diff --git a/libjava/org/xml/sax/helpers/AttributeListImpl.java b/libjava/org/xml/sax/helpers/AttributeListImpl.java
deleted file mode 100644 (file)
index 6975472..0000000
+++ /dev/null
@@ -1,310 +0,0 @@
-// SAX default implementation for AttributeList.\r
-// No warranty; no copyright -- use this as you will.\r
-// $Id: AttributeListImpl.java,v 1.1 2000/10/02 02:43:20 sboag Exp $\r
-\r
-package org.xml.sax.helpers;\r
-\r
-import org.xml.sax.AttributeList;\r
-\r
-import java.util.Vector;\r
-\r
-\r
-/**\r
- * Default implementation for AttributeList.\r
- *\r
- * <blockquote>\r
- * <em>This module, both source code and documentation, is in the\r
- * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>\r
- * </blockquote>\r
- *\r
- * <p>AttributeList implements the deprecated SAX1 {@link\r
- * org.xml.sax.AttributeList AttributeList} interface, and has been\r
- * replaced by the new SAX2 {@link org.xml.sax.helpers.AttributesImpl\r
- * AttributesImpl} interface.</p>\r
- *\r
- * <p>This class provides a convenience implementation of the SAX\r
- * {@link org.xml.sax.AttributeList AttributeList} interface.  This \r
- * implementation is useful both for SAX parser writers, who can use \r
- * it to provide attributes to the application, and for SAX application \r
- * writers, who can use it to create a persistent copy of an element's \r
- * attribute specifications:</p>\r
- *\r
- * <pre>\r
- * private AttributeList myatts;\r
- *\r
- * public void startElement (String name, AttributeList atts)\r
- * {\r
- *              // create a persistent copy of the attribute list\r
- *              // for use outside this method\r
- *   myatts = new AttributeListImpl(atts);\r
- *   [...]\r
- * }\r
- * </pre>\r
- *\r
- * <p>Please note that SAX parsers are not required to use this\r
- * class to provide an implementation of AttributeList; it is\r
- * supplied only as an optional convenience.  In particular, \r
- * parser writers are encouraged to invent more efficient\r
- * implementations.</p>\r
- *\r
- * @deprecated This class implements a deprecated interface,\r
- *             {@link org.xml.sax.AttributeList AttributeList};\r
- *             that interface has been replaced by\r
- *             {@link org.xml.sax.Attributes Attributes},\r
- *             which is implemented in the\r
- *             {@link org.xml.sax.helpers.AttributesImpl \r
- *            AttributesImpl} helper class.\r
- * @since SAX 1.0\r
- * @author David Megginson, \r
- *         <a href="mailto:sax@megginson.com">sax@megginson.com</a>\r
- * @version 2.0\r
- * @see org.xml.sax.AttributeList\r
- * @see org.xml.sax.DocumentHandler#startElement \r
- */\r
-public class AttributeListImpl implements AttributeList\r
-{\r
-    \r
-    /**\r
-     * Create an empty attribute list.\r
-     *\r
-     * <p>This constructor is most useful for parser writers, who\r
-     * will use it to create a single, reusable attribute list that\r
-     * can be reset with the clear method between elements.</p>\r
-     *\r
-     * @see #addAttribute\r
-     * @see #clear\r
-     */\r
-    public AttributeListImpl ()\r
-    {\r
-    }\r
-    \r
-    \r
-    /**\r
-     * Construct a persistent copy of an existing attribute list.\r
-     *\r
-     * <p>This constructor is most useful for application writers,\r
-     * who will use it to create a persistent copy of an existing\r
-     * attribute list.</p>\r
-     *\r
-     * @param atts The attribute list to copy\r
-     * @see org.xml.sax.DocumentHandler#startElement\r
-     */\r
-    public AttributeListImpl (AttributeList atts)\r
-    {\r
-       setAttributeList(atts);\r
-    }\r
-    \r
-    \r
-\f\r
-    ////////////////////////////////////////////////////////////////////\r
-    // Methods specific to this class.\r
-    ////////////////////////////////////////////////////////////////////\r
-    \r
-    \r
-    /**\r
-     * Set the attribute list, discarding previous contents.\r
-     *\r
-     * <p>This method allows an application writer to reuse an\r
-     * attribute list easily.</p>\r
-     *\r
-     * @param atts The attribute list to copy.\r
-     */\r
-    public void setAttributeList (AttributeList atts)\r
-    {\r
-       int count = atts.getLength();\r
-       \r
-       clear();\r
-       \r
-       for (int i = 0; i < count; i++) {\r
-           addAttribute(atts.getName(i), atts.getType(i), atts.getValue(i));\r
-       }\r
-    }\r
-    \r
-    \r
-    /**\r
-     * Add an attribute to an attribute list.\r
-     *\r
-     * <p>This method is provided for SAX parser writers, to allow them\r
-     * to build up an attribute list incrementally before delivering\r
-     * it to the application.</p>\r
-     *\r
-     * @param name The attribute name.\r
-     * @param type The attribute type ("NMTOKEN" for an enumeration).\r
-     * @param value The attribute value (must not be null).\r
-     * @see #removeAttribute\r
-     * @see org.xml.sax.DocumentHandler#startElement\r
-     */\r
-    public void addAttribute (String name, String type, String value)\r
-    {\r
-       names.addElement(name);\r
-       types.addElement(type);\r
-       values.addElement(value);\r
-    }\r
-    \r
-    \r
-    /**\r
-     * Remove an attribute from the list.\r
-     *\r
-     * <p>SAX application writers can use this method to filter an\r
-     * attribute out of an AttributeList.  Note that invoking this\r
-     * method will change the length of the attribute list and\r
-     * some of the attribute's indices.</p>\r
-     *\r
-     * <p>If the requested attribute is not in the list, this is\r
-     * a no-op.</p>\r
-     *\r
-     * @param name The attribute name.\r
-     * @see #addAttribute\r
-     */\r
-    public void removeAttribute (String name)\r
-    {\r
-       int i = names.indexOf(name);\r
-       \r
-       if (i >= 0) {\r
-           names.removeElementAt(i);\r
-           types.removeElementAt(i);\r
-           values.removeElementAt(i);\r
-       }\r
-    }\r
-    \r
-    \r
-    /**\r
-     * Clear the attribute list.\r
-     *\r
-     * <p>SAX parser writers can use this method to reset the attribute\r
-     * list between DocumentHandler.startElement events.  Normally,\r
-     * it will make sense to reuse the same AttributeListImpl object\r
-     * rather than allocating a new one each time.</p>\r
-     *\r
-     * @see org.xml.sax.DocumentHandler#startElement\r
-     */\r
-    public void clear ()\r
-    {\r
-       names.removeAllElements();\r
-       types.removeAllElements();\r
-       values.removeAllElements();\r
-    }\r
-    \r
-    \r
-\f\r
-    ////////////////////////////////////////////////////////////////////\r
-    // Implementation of org.xml.sax.AttributeList\r
-    ////////////////////////////////////////////////////////////////////\r
-    \r
-    \r
-    /**\r
-     * Return the number of attributes in the list.\r
-     *\r
-     * @return The number of attributes in the list.\r
-     * @see org.xml.sax.AttributeList#getLength\r
-     */\r
-    public int getLength ()\r
-    {\r
-       return names.size();\r
-    }\r
-    \r
-    \r
-    /**\r
-     * Get the name of an attribute (by position).\r
-     *\r
-     * @param i The position of the attribute in the list.\r
-     * @return The attribute name as a string, or null if there\r
-     *         is no attribute at that position.\r
-     * @see org.xml.sax.AttributeList#getName(int)\r
-     */\r
-    public String getName (int i)\r
-    {\r
-       if (i < 0) {\r
-           return null;\r
-       }\r
-       try {\r
-           return (String)names.elementAt(i);\r
-       } catch (ArrayIndexOutOfBoundsException e) {\r
-           return null;\r
-       }\r
-    }\r
-    \r
-    \r
-    /**\r
-     * Get the type of an attribute (by position).\r
-     *\r
-     * @param i The position of the attribute in the list.\r
-     * @return The attribute type as a string ("NMTOKEN" for an\r
-     *         enumeration, and "CDATA" if no declaration was\r
-     *         read), or null if there is no attribute at\r
-     *         that position.\r
-     * @see org.xml.sax.AttributeList#getType(int)\r
-     */\r
-    public String getType (int i)\r
-    {\r
-       if (i < 0) {\r
-           return null;\r
-       }\r
-       try {\r
-           return (String)types.elementAt(i);\r
-       } catch (ArrayIndexOutOfBoundsException e) {\r
-           return null;\r
-       }\r
-    }\r
-    \r
-    \r
-    /**\r
-     * Get the value of an attribute (by position).\r
-     *\r
-     * @param i The position of the attribute in the list.\r
-     * @return The attribute value as a string, or null if\r
-     *         there is no attribute at that position.\r
-     * @see org.xml.sax.AttributeList#getValue(int)\r
-     */\r
-    public String getValue (int i)\r
-    {\r
-       if (i < 0) {\r
-           return null;\r
-       }\r
-       try {\r
-           return (String)values.elementAt(i);\r
-       } catch (ArrayIndexOutOfBoundsException e) {\r
-           return null;\r
-       }\r
-    }\r
-    \r
-    \r
-    /**\r
-     * Get the type of an attribute (by name).\r
-     *\r
-     * @param name The attribute name.\r
-     * @return The attribute type as a string ("NMTOKEN" for an\r
-     *         enumeration, and "CDATA" if no declaration was\r
-     *         read).\r
-     * @see org.xml.sax.AttributeList#getType(java.lang.String)\r
-     */\r
-    public String getType (String name)\r
-    {\r
-       return getType(names.indexOf(name));\r
-    }\r
-    \r
-    \r
-    /**\r
-     * Get the value of an attribute (by name).\r
-     *\r
-     * @param name The attribute name.\r
-     * @see org.xml.sax.AttributeList#getValue(java.lang.String)\r
-     */\r
-    public String getValue (String name)\r
-    {\r
-       return getValue(names.indexOf(name));\r
-    }\r
-    \r
-    \r
-\f\r
-    ////////////////////////////////////////////////////////////////////\r
-    // Internal state.\r
-    ////////////////////////////////////////////////////////////////////\r
-\r
-    Vector names = new Vector();\r
-    Vector types = new Vector();\r
-    Vector values = new Vector();\r
-\r
-}\r
-\r
-// end of AttributeListImpl.java\r