jaxp/src/share/classes/org/xml/sax/AttributeList.java
author kvn
Fri, 20 Jun 2008 11:10:05 -0700
changeset 762 1b26adb5fea1
parent 6 7f561c08de6b
permissions -rw-r--r--
6715633: when matching a memory node the adr_type should not change Summary: verify the adr_type of a mach node was not changed Reviewed-by: rasbold, never
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6
7f561c08de6b Initial load
duke
parents:
diff changeset
     1
/*
7f561c08de6b Initial load
duke
parents:
diff changeset
     2
 * Copyright 2000-2005 Sun Microsystems, Inc.  All Rights Reserved.
7f561c08de6b Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
7f561c08de6b Initial load
duke
parents:
diff changeset
     4
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
7f561c08de6b Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
7f561c08de6b Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Sun designates this
7f561c08de6b Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
7f561c08de6b Initial load
duke
parents:
diff changeset
     9
 * by Sun in the LICENSE file that accompanied this code.
7f561c08de6b Initial load
duke
parents:
diff changeset
    10
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
7f561c08de6b Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
7f561c08de6b Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
7f561c08de6b Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
7f561c08de6b Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
7f561c08de6b Initial load
duke
parents:
diff changeset
    16
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
7f561c08de6b Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
7f561c08de6b Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
7f561c08de6b Initial load
duke
parents:
diff changeset
    20
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    21
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
7f561c08de6b Initial load
duke
parents:
diff changeset
    22
 * CA 95054 USA or visit www.sun.com if you need additional information or
7f561c08de6b Initial load
duke
parents:
diff changeset
    23
 * have any questions.
7f561c08de6b Initial load
duke
parents:
diff changeset
    24
 */
7f561c08de6b Initial load
duke
parents:
diff changeset
    25
7f561c08de6b Initial load
duke
parents:
diff changeset
    26
// SAX Attribute List Interface.
7f561c08de6b Initial load
duke
parents:
diff changeset
    27
// http://www.saxproject.org
7f561c08de6b Initial load
duke
parents:
diff changeset
    28
// No warranty; no copyright -- use this as you will.
7f561c08de6b Initial load
duke
parents:
diff changeset
    29
// $Id: AttributeList.java,v 1.3 2004/11/03 22:44:51 jsuttor Exp $
7f561c08de6b Initial load
duke
parents:
diff changeset
    30
7f561c08de6b Initial load
duke
parents:
diff changeset
    31
package org.xml.sax;
7f561c08de6b Initial load
duke
parents:
diff changeset
    32
7f561c08de6b Initial load
duke
parents:
diff changeset
    33
/**
7f561c08de6b Initial load
duke
parents:
diff changeset
    34
 * Interface for an element's attribute specifications.
7f561c08de6b Initial load
duke
parents:
diff changeset
    35
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    36
 * <blockquote>
7f561c08de6b Initial load
duke
parents:
diff changeset
    37
 * <em>This module, both source code and documentation, is in the
7f561c08de6b Initial load
duke
parents:
diff changeset
    38
 * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
7f561c08de6b Initial load
duke
parents:
diff changeset
    39
 * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
7f561c08de6b Initial load
duke
parents:
diff changeset
    40
 * for further information.
7f561c08de6b Initial load
duke
parents:
diff changeset
    41
 * </blockquote>
7f561c08de6b Initial load
duke
parents:
diff changeset
    42
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    43
 * <p>This is the original SAX1 interface for reporting an element's
7f561c08de6b Initial load
duke
parents:
diff changeset
    44
 * attributes.  Unlike the new {@link org.xml.sax.Attributes Attributes}
7f561c08de6b Initial load
duke
parents:
diff changeset
    45
 * interface, it does not support Namespace-related information.</p>
7f561c08de6b Initial load
duke
parents:
diff changeset
    46
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    47
 * <p>When an attribute list is supplied as part of a
7f561c08de6b Initial load
duke
parents:
diff changeset
    48
 * {@link org.xml.sax.DocumentHandler#startElement startElement}
7f561c08de6b Initial load
duke
parents:
diff changeset
    49
 * event, the list will return valid results only during the
7f561c08de6b Initial load
duke
parents:
diff changeset
    50
 * scope of the event; once the event handler returns control
7f561c08de6b Initial load
duke
parents:
diff changeset
    51
 * to the parser, the attribute list is invalid.  To save a
7f561c08de6b Initial load
duke
parents:
diff changeset
    52
 * persistent copy of the attribute list, use the SAX1
7f561c08de6b Initial load
duke
parents:
diff changeset
    53
 * {@link org.xml.sax.helpers.AttributeListImpl AttributeListImpl}
7f561c08de6b Initial load
duke
parents:
diff changeset
    54
 * helper class.</p>
7f561c08de6b Initial load
duke
parents:
diff changeset
    55
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    56
 * <p>An attribute list includes only attributes that have been
7f561c08de6b Initial load
duke
parents:
diff changeset
    57
 * specified or defaulted: #IMPLIED attributes will not be included.</p>
7f561c08de6b Initial load
duke
parents:
diff changeset
    58
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    59
 * <p>There are two ways for the SAX application to obtain information
7f561c08de6b Initial load
duke
parents:
diff changeset
    60
 * from the AttributeList.  First, it can iterate through the entire
7f561c08de6b Initial load
duke
parents:
diff changeset
    61
 * list:</p>
7f561c08de6b Initial load
duke
parents:
diff changeset
    62
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    63
 * <pre>
7f561c08de6b Initial load
duke
parents:
diff changeset
    64
 * public void startElement (String name, AttributeList atts) {
7f561c08de6b Initial load
duke
parents:
diff changeset
    65
 *   for (int i = 0; i < atts.getLength(); i++) {
7f561c08de6b Initial load
duke
parents:
diff changeset
    66
 *     String name = atts.getName(i);
7f561c08de6b Initial load
duke
parents:
diff changeset
    67
 *     String type = atts.getType(i);
7f561c08de6b Initial load
duke
parents:
diff changeset
    68
 *     String value = atts.getValue(i);
7f561c08de6b Initial load
duke
parents:
diff changeset
    69
 *     [...]
7f561c08de6b Initial load
duke
parents:
diff changeset
    70
 *   }
7f561c08de6b Initial load
duke
parents:
diff changeset
    71
 * }
7f561c08de6b Initial load
duke
parents:
diff changeset
    72
 * </pre>
7f561c08de6b Initial load
duke
parents:
diff changeset
    73
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    74
 * <p>(Note that the result of getLength() will be zero if there
7f561c08de6b Initial load
duke
parents:
diff changeset
    75
 * are no attributes.)
7f561c08de6b Initial load
duke
parents:
diff changeset
    76
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    77
 * <p>As an alternative, the application can request the value or
7f561c08de6b Initial load
duke
parents:
diff changeset
    78
 * type of specific attributes:</p>
7f561c08de6b Initial load
duke
parents:
diff changeset
    79
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    80
 * <pre>
7f561c08de6b Initial load
duke
parents:
diff changeset
    81
 * public void startElement (String name, AttributeList atts) {
7f561c08de6b Initial load
duke
parents:
diff changeset
    82
 *   String identifier = atts.getValue("id");
7f561c08de6b Initial load
duke
parents:
diff changeset
    83
 *   String label = atts.getValue("label");
7f561c08de6b Initial load
duke
parents:
diff changeset
    84
 *   [...]
7f561c08de6b Initial load
duke
parents:
diff changeset
    85
 * }
7f561c08de6b Initial load
duke
parents:
diff changeset
    86
 * </pre>
7f561c08de6b Initial load
duke
parents:
diff changeset
    87
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    88
 * @deprecated This interface has been replaced by the SAX2
7f561c08de6b Initial load
duke
parents:
diff changeset
    89
 *             {@link org.xml.sax.Attributes Attributes}
7f561c08de6b Initial load
duke
parents:
diff changeset
    90
 *             interface, which includes Namespace support.
7f561c08de6b Initial load
duke
parents:
diff changeset
    91
 * @since SAX 1.0
7f561c08de6b Initial load
duke
parents:
diff changeset
    92
 * @author David Megginson
7f561c08de6b Initial load
duke
parents:
diff changeset
    93
 * @see org.xml.sax.DocumentHandler#startElement startElement
7f561c08de6b Initial load
duke
parents:
diff changeset
    94
 * @see org.xml.sax.helpers.AttributeListImpl AttributeListImpl
7f561c08de6b Initial load
duke
parents:
diff changeset
    95
 */
7f561c08de6b Initial load
duke
parents:
diff changeset
    96
public interface AttributeList {
7f561c08de6b Initial load
duke
parents:
diff changeset
    97
7f561c08de6b Initial load
duke
parents:
diff changeset
    98
7f561c08de6b Initial load
duke
parents:
diff changeset
    99
    ////////////////////////////////////////////////////////////////////
7f561c08de6b Initial load
duke
parents:
diff changeset
   100
    // Iteration methods.
7f561c08de6b Initial load
duke
parents:
diff changeset
   101
    ////////////////////////////////////////////////////////////////////
7f561c08de6b Initial load
duke
parents:
diff changeset
   102
7f561c08de6b Initial load
duke
parents:
diff changeset
   103
7f561c08de6b Initial load
duke
parents:
diff changeset
   104
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   105
     * Return the number of attributes in this list.
7f561c08de6b Initial load
duke
parents:
diff changeset
   106
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   107
     * <p>The SAX parser may provide attributes in any
7f561c08de6b Initial load
duke
parents:
diff changeset
   108
     * arbitrary order, regardless of the order in which they were
7f561c08de6b Initial load
duke
parents:
diff changeset
   109
     * declared or specified.  The number of attributes may be
7f561c08de6b Initial load
duke
parents:
diff changeset
   110
     * zero.</p>
7f561c08de6b Initial load
duke
parents:
diff changeset
   111
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   112
     * @return The number of attributes in the list.
7f561c08de6b Initial load
duke
parents:
diff changeset
   113
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
   114
    public abstract int getLength ();
7f561c08de6b Initial load
duke
parents:
diff changeset
   115
7f561c08de6b Initial load
duke
parents:
diff changeset
   116
7f561c08de6b Initial load
duke
parents:
diff changeset
   117
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   118
     * Return the name of an attribute in this list (by position).
7f561c08de6b Initial load
duke
parents:
diff changeset
   119
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   120
     * <p>The names must be unique: the SAX parser shall not include the
7f561c08de6b Initial load
duke
parents:
diff changeset
   121
     * same attribute twice.  Attributes without values (those declared
7f561c08de6b Initial load
duke
parents:
diff changeset
   122
     * #IMPLIED without a value specified in the start tag) will be
7f561c08de6b Initial load
duke
parents:
diff changeset
   123
     * omitted from the list.</p>
7f561c08de6b Initial load
duke
parents:
diff changeset
   124
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   125
     * <p>If the attribute name has a namespace prefix, the prefix
7f561c08de6b Initial load
duke
parents:
diff changeset
   126
     * will still be attached.</p>
7f561c08de6b Initial load
duke
parents:
diff changeset
   127
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   128
     * @param i The index of the attribute in the list (starting at 0).
7f561c08de6b Initial load
duke
parents:
diff changeset
   129
     * @return The name of the indexed attribute, or null
7f561c08de6b Initial load
duke
parents:
diff changeset
   130
     *         if the index is out of range.
7f561c08de6b Initial load
duke
parents:
diff changeset
   131
     * @see #getLength
7f561c08de6b Initial load
duke
parents:
diff changeset
   132
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
   133
    public abstract String getName (int i);
7f561c08de6b Initial load
duke
parents:
diff changeset
   134
7f561c08de6b Initial load
duke
parents:
diff changeset
   135
7f561c08de6b Initial load
duke
parents:
diff changeset
   136
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   137
     * Return the type of an attribute in the list (by position).
7f561c08de6b Initial load
duke
parents:
diff changeset
   138
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   139
     * <p>The attribute type is one of the strings "CDATA", "ID",
7f561c08de6b Initial load
duke
parents:
diff changeset
   140
     * "IDREF", "IDREFS", "NMTOKEN", "NMTOKENS", "ENTITY", "ENTITIES",
7f561c08de6b Initial load
duke
parents:
diff changeset
   141
     * or "NOTATION" (always in upper case).</p>
7f561c08de6b Initial load
duke
parents:
diff changeset
   142
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   143
     * <p>If the parser has not read a declaration for the attribute,
7f561c08de6b Initial load
duke
parents:
diff changeset
   144
     * or if the parser does not report attribute types, then it must
7f561c08de6b Initial load
duke
parents:
diff changeset
   145
     * return the value "CDATA" as stated in the XML 1.0 Recommentation
7f561c08de6b Initial load
duke
parents:
diff changeset
   146
     * (clause 3.3.3, "Attribute-Value Normalization").</p>
7f561c08de6b Initial load
duke
parents:
diff changeset
   147
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   148
     * <p>For an enumerated attribute that is not a notation, the
7f561c08de6b Initial load
duke
parents:
diff changeset
   149
     * parser will report the type as "NMTOKEN".</p>
7f561c08de6b Initial load
duke
parents:
diff changeset
   150
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   151
     * @param i The index of the attribute in the list (starting at 0).
7f561c08de6b Initial load
duke
parents:
diff changeset
   152
     * @return The attribute type as a string, or
7f561c08de6b Initial load
duke
parents:
diff changeset
   153
     *         null if the index is out of range.
7f561c08de6b Initial load
duke
parents:
diff changeset
   154
     * @see #getLength
7f561c08de6b Initial load
duke
parents:
diff changeset
   155
     * @see #getType(java.lang.String)
7f561c08de6b Initial load
duke
parents:
diff changeset
   156
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
   157
    public abstract String getType (int i);
7f561c08de6b Initial load
duke
parents:
diff changeset
   158
7f561c08de6b Initial load
duke
parents:
diff changeset
   159
7f561c08de6b Initial load
duke
parents:
diff changeset
   160
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   161
     * Return the value of an attribute in the list (by position).
7f561c08de6b Initial load
duke
parents:
diff changeset
   162
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   163
     * <p>If the attribute value is a list of tokens (IDREFS,
7f561c08de6b Initial load
duke
parents:
diff changeset
   164
     * ENTITIES, or NMTOKENS), the tokens will be concatenated
7f561c08de6b Initial load
duke
parents:
diff changeset
   165
     * into a single string separated by whitespace.</p>
7f561c08de6b Initial load
duke
parents:
diff changeset
   166
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   167
     * @param i The index of the attribute in the list (starting at 0).
7f561c08de6b Initial load
duke
parents:
diff changeset
   168
     * @return The attribute value as a string, or
7f561c08de6b Initial load
duke
parents:
diff changeset
   169
     *         null if the index is out of range.
7f561c08de6b Initial load
duke
parents:
diff changeset
   170
     * @see #getLength
7f561c08de6b Initial load
duke
parents:
diff changeset
   171
     * @see #getValue(java.lang.String)
7f561c08de6b Initial load
duke
parents:
diff changeset
   172
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
   173
    public abstract String getValue (int i);
7f561c08de6b Initial load
duke
parents:
diff changeset
   174
7f561c08de6b Initial load
duke
parents:
diff changeset
   175
7f561c08de6b Initial load
duke
parents:
diff changeset
   176
7f561c08de6b Initial load
duke
parents:
diff changeset
   177
    ////////////////////////////////////////////////////////////////////
7f561c08de6b Initial load
duke
parents:
diff changeset
   178
    // Lookup methods.
7f561c08de6b Initial load
duke
parents:
diff changeset
   179
    ////////////////////////////////////////////////////////////////////
7f561c08de6b Initial load
duke
parents:
diff changeset
   180
7f561c08de6b Initial load
duke
parents:
diff changeset
   181
7f561c08de6b Initial load
duke
parents:
diff changeset
   182
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   183
     * Return the type of an attribute in the list (by name).
7f561c08de6b Initial load
duke
parents:
diff changeset
   184
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   185
     * <p>The return value is the same as the return value for
7f561c08de6b Initial load
duke
parents:
diff changeset
   186
     * getType(int).</p>
7f561c08de6b Initial load
duke
parents:
diff changeset
   187
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   188
     * <p>If the attribute name has a namespace prefix in the document,
7f561c08de6b Initial load
duke
parents:
diff changeset
   189
     * the application must include the prefix here.</p>
7f561c08de6b Initial load
duke
parents:
diff changeset
   190
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   191
     * @param name The name of the attribute.
7f561c08de6b Initial load
duke
parents:
diff changeset
   192
     * @return The attribute type as a string, or null if no
7f561c08de6b Initial load
duke
parents:
diff changeset
   193
     *         such attribute exists.
7f561c08de6b Initial load
duke
parents:
diff changeset
   194
     * @see #getType(int)
7f561c08de6b Initial load
duke
parents:
diff changeset
   195
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
   196
    public abstract String getType (String name);
7f561c08de6b Initial load
duke
parents:
diff changeset
   197
7f561c08de6b Initial load
duke
parents:
diff changeset
   198
7f561c08de6b Initial load
duke
parents:
diff changeset
   199
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   200
     * Return the value of an attribute in the list (by name).
7f561c08de6b Initial load
duke
parents:
diff changeset
   201
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   202
     * <p>The return value is the same as the return value for
7f561c08de6b Initial load
duke
parents:
diff changeset
   203
     * getValue(int).</p>
7f561c08de6b Initial load
duke
parents:
diff changeset
   204
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   205
     * <p>If the attribute name has a namespace prefix in the document,
7f561c08de6b Initial load
duke
parents:
diff changeset
   206
     * the application must include the prefix here.</p>
7f561c08de6b Initial load
duke
parents:
diff changeset
   207
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   208
     * @param name the name of the attribute to return
7f561c08de6b Initial load
duke
parents:
diff changeset
   209
     * @return The attribute value as a string, or null if
7f561c08de6b Initial load
duke
parents:
diff changeset
   210
     *         no such attribute exists.
7f561c08de6b Initial load
duke
parents:
diff changeset
   211
     * @see #getValue(int)
7f561c08de6b Initial load
duke
parents:
diff changeset
   212
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
   213
    public abstract String getValue (String name);
7f561c08de6b Initial load
duke
parents:
diff changeset
   214
7f561c08de6b Initial load
duke
parents:
diff changeset
   215
}
7f561c08de6b Initial load
duke
parents:
diff changeset
   216
7f561c08de6b Initial load
duke
parents:
diff changeset
   217
// end of AttributeList.java