Source Code Cross Referenced for AttributeList.java in  » 6.0-JDK-Core » xml » org » xml » sax » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Home
Java Source Code / Java Documentation
1.6.0 JDK Core
2.6.0 JDK Modules
3.6.0 JDK Modules com.sun
4.6.0 JDK Modules com.sun.java
5.6.0 JDK Modules sun
6.6.0 JDK Platform
7.Ajax
8.Apache Harmony Java SE
9.Aspect oriented
10.Authentication Authorization
11.Blogger System
12.Build
13.Byte Code
14.Cache
15.Chart
16.Chat
17.Code Analyzer
18.Collaboration
19.Content Management System
20.Database Client
21.Database DBMS
22.Database JDBC Connection Pool
23.Database ORM
24.Development
25.EJB Server
26.ERP CRM Financial
27.ESB
28.Forum
29.Game
30.GIS
31.Graphic 3D
32.Graphic Library
33.Groupware
34.HTML Parser
35.IDE
36.IDE Eclipse
37.IDE Netbeans
38.Installer
39.Internationalization Localization
40.Inversion of Control
41.Issue Tracking
42.J2EE
43.J2ME
44.JBoss
45.JMS
46.JMX
47.Library
48.Mail Clients
49.Music
50.Net
51.Parser
52.PDF
53.Portal
54.Profiler
55.Project Management
56.Report
57.RSS RDF
58.Rule Engine
59.Science
60.Scripting
61.Search Engine
62.Security
63.Sevlet Container
64.Source Control
65.Swing Library
66.Template Engine
67.Test Coverage
68.Testing
69.UML
70.Web Crawler
71.Web Framework
72.Web Mail
73.Web Server
74.Web Services
75.Web Services apache cxf 2.2.6
76.Web Services AXIS2
77.Wiki Engine
78.Workflow Engines
79.XML
80.XML UI
Java Source Code / Java Documentation » 6.0 JDK Core » xml » org.xml.sax 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001        /*
002         * Copyright 2000-2005 Sun Microsystems, Inc.  All Rights Reserved.
003         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004         *
005         * This code is free software; you can redistribute it and/or modify it
006         * under the terms of the GNU General Public License version 2 only, as
007         * published by the Free Software Foundation.  Sun designates this
008         * particular file as subject to the "Classpath" exception as provided
009         * by Sun in the LICENSE file that accompanied this code.
010         *
011         * This code is distributed in the hope that it will be useful, but WITHOUT
012         * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
013         * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
014         * version 2 for more details (a copy is included in the LICENSE file that
015         * accompanied this code).
016         *
017         * You should have received a copy of the GNU General Public License version
018         * 2 along with this work; if not, write to the Free Software Foundation,
019         * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
020         *
021         * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
022         * CA 95054 USA or visit www.sun.com if you need additional information or
023         * have any questions.
024         */
025
026        // SAX Attribute List Interface.
027        // http://www.saxproject.org
028        // No warranty; no copyright -- use this as you will.
029        // $Id: AttributeList.java,v 1.3 2004/11/03 22:44:51 jsuttor Exp $
030        package org.xml.sax;
031
032        /**
033         * Interface for an element's attribute specifications.
034         *
035         * <blockquote>
036         * <em>This module, both source code and documentation, is in the
037         * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
038         * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
039         * for further information.
040         * </blockquote>
041         *
042         * <p>This is the original SAX1 interface for reporting an element's
043         * attributes.  Unlike the new {@link org.xml.sax.Attributes Attributes}
044         * interface, it does not support Namespace-related information.</p>
045         *
046         * <p>When an attribute list is supplied as part of a
047         * {@link org.xml.sax.DocumentHandler#startElement startElement}
048         * event, the list will return valid results only during the
049         * scope of the event; once the event handler returns control
050         * to the parser, the attribute list is invalid.  To save a
051         * persistent copy of the attribute list, use the SAX1
052         * {@link org.xml.sax.helpers.AttributeListImpl AttributeListImpl}
053         * helper class.</p>
054         *
055         * <p>An attribute list includes only attributes that have been
056         * specified or defaulted: #IMPLIED attributes will not be included.</p>
057         *
058         * <p>There are two ways for the SAX application to obtain information
059         * from the AttributeList.  First, it can iterate through the entire
060         * list:</p>
061         *
062         * <pre>
063         * public void startElement (String name, AttributeList atts) {
064         *   for (int i = 0; i < atts.getLength(); i++) {
065         *     String name = atts.getName(i);
066         *     String type = atts.getType(i);
067         *     String value = atts.getValue(i);
068         *     [...]
069         *   }
070         * }
071         * </pre>
072         *
073         * <p>(Note that the result of getLength() will be zero if there
074         * are no attributes.)
075         *
076         * <p>As an alternative, the application can request the value or
077         * type of specific attributes:</p>
078         *
079         * <pre>
080         * public void startElement (String name, AttributeList atts) {
081         *   String identifier = atts.getValue("id");
082         *   String label = atts.getValue("label");
083         *   [...]
084         * }
085         * </pre>
086         *
087         * @deprecated This interface has been replaced by the SAX2
088         *             {@link org.xml.sax.Attributes Attributes}
089         *             interface, which includes Namespace support.
090         * @since SAX 1.0
091         * @author David Megginson
092         * @version 2.0.1 (sax2r2)
093         * @see org.xml.sax.DocumentHandler#startElement startElement
094         * @see org.xml.sax.helpers.AttributeListImpl AttributeListImpl
095         */
096        public interface AttributeList {
097
098            ////////////////////////////////////////////////////////////////////
099            // Iteration methods.
100            ////////////////////////////////////////////////////////////////////
101
102            /**
103             * Return the number of attributes in this list.
104             *
105             * <p>The SAX parser may provide attributes in any
106             * arbitrary order, regardless of the order in which they were
107             * declared or specified.  The number of attributes may be
108             * zero.</p>
109             *
110             * @return The number of attributes in the list.  
111             */
112            public abstract int getLength();
113
114            /**
115             * Return the name of an attribute in this list (by position).
116             *
117             * <p>The names must be unique: the SAX parser shall not include the
118             * same attribute twice.  Attributes without values (those declared
119             * #IMPLIED without a value specified in the start tag) will be
120             * omitted from the list.</p>
121             *
122             * <p>If the attribute name has a namespace prefix, the prefix
123             * will still be attached.</p>
124             *
125             * @param i The index of the attribute in the list (starting at 0).
126             * @return The name of the indexed attribute, or null
127             *         if the index is out of range.
128             * @see #getLength 
129             */
130            public abstract String getName(int i);
131
132            /**
133             * Return the type of an attribute in the list (by position).
134             *
135             * <p>The attribute type is one of the strings "CDATA", "ID",
136             * "IDREF", "IDREFS", "NMTOKEN", "NMTOKENS", "ENTITY", "ENTITIES",
137             * or "NOTATION" (always in upper case).</p>
138             *
139             * <p>If the parser has not read a declaration for the attribute,
140             * or if the parser does not report attribute types, then it must
141             * return the value "CDATA" as stated in the XML 1.0 Recommentation
142             * (clause 3.3.3, "Attribute-Value Normalization").</p>
143             *
144             * <p>For an enumerated attribute that is not a notation, the
145             * parser will report the type as "NMTOKEN".</p>
146             *
147             * @param i The index of the attribute in the list (starting at 0).
148             * @return The attribute type as a string, or
149             *         null if the index is out of range.
150             * @see #getLength 
151             * @see #getType(java.lang.String)
152             */
153            public abstract String getType(int i);
154
155            /**
156             * Return the value of an attribute in the list (by position).
157             *
158             * <p>If the attribute value is a list of tokens (IDREFS,
159             * ENTITIES, or NMTOKENS), the tokens will be concatenated
160             * into a single string separated by whitespace.</p>
161             *
162             * @param i The index of the attribute in the list (starting at 0).
163             * @return The attribute value as a string, or
164             *         null if the index is out of range.
165             * @see #getLength
166             * @see #getValue(java.lang.String)
167             */
168            public abstract String getValue(int i);
169
170            ////////////////////////////////////////////////////////////////////
171            // Lookup methods.
172            ////////////////////////////////////////////////////////////////////
173
174            /**
175             * Return the type of an attribute in the list (by name).
176             *
177             * <p>The return value is the same as the return value for
178             * getType(int).</p>
179             *
180             * <p>If the attribute name has a namespace prefix in the document,
181             * the application must include the prefix here.</p>
182             *
183             * @param name The name of the attribute.
184             * @return The attribute type as a string, or null if no
185             *         such attribute exists.
186             * @see #getType(int)
187             */
188            public abstract String getType(String name);
189
190            /**
191             * Return the value of an attribute in the list (by name).
192             *
193             * <p>The return value is the same as the return value for
194             * getValue(int).</p>
195             *
196             * <p>If the attribute name has a namespace prefix in the document,
197             * the application must include the prefix here.</p>
198             *
199             * @param name the name of the attribute to return
200             * @return The attribute value as a string, or null if
201             *         no such attribute exists.
202             * @see #getValue(int)
203             */
204            public abstract String getValue(String name);
205
206        }
207
208        // end of AttributeList.java
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.