Source Code Cross Referenced for Attributes.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        // Attributes.java - attribute list with Namespace support
027        // http://www.saxproject.org
028        // Written by David Megginson
029        // NO WARRANTY!  This class is in the public domain.
030        // $Id: Attributes.java,v 1.2 2004/11/03 22:44:51 jsuttor Exp $
031        package org.xml.sax;
032
033        /**
034         * Interface for a list of XML attributes.
035         *
036         * <blockquote>
037         * <em>This module, both source code and documentation, is in the
038         * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
039         * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
040         * for further information.
041         * </blockquote>
042         *
043         * <p>This interface allows access to a list of attributes in
044         * three different ways:</p>
045         *
046         * <ol>
047         * <li>by attribute index;</li>
048         * <li>by Namespace-qualified name; or</li>
049         * <li>by qualified (prefixed) name.</li>
050         * </ol>
051         *
052         * <p>The list will not contain attributes that were declared
053         * #IMPLIED but not specified in the start tag.  It will also not
054         * contain attributes used as Namespace declarations (xmlns*) unless
055         * the <code>http://xml.org/sax/features/namespace-prefixes</code> 
056         * feature is set to <var>true</var> (it is <var>false</var> by 
057         * default).
058         * Because SAX2 conforms to the original "Namespaces in XML"
059         * recommendation, it normally does not
060         * give namespace declaration attributes a namespace URI.
061         * </p>
062         *
063         * <p>Some SAX2 parsers may support using an optional feature flag
064         * (<code>http://xml.org/sax/features/xmlns-uris</code>) to request
065         * that those attributes be given URIs, conforming to a later
066         * backwards-incompatible revision of that recommendation.  (The
067         * attribute's "local name" will be the prefix, or "xmlns" when
068         * defining a default element namespace.)  For portability, handler
069         * code should always resolve that conflict, rather than requiring
070         * parsers that can change the setting of that feature flag.  </p>
071         *
072         * <p>If the namespace-prefixes feature (see above) is
073         * <var>false</var>, access by qualified name may not be available; if
074         * the <code>http://xml.org/sax/features/namespaces</code> feature is
075         * <var>false</var>, access by Namespace-qualified names may not be
076         * available.</p>
077         *
078         * <p>This interface replaces the now-deprecated SAX1 {@link
079         * org.xml.sax.AttributeList AttributeList} interface, which does not 
080         * contain Namespace support.  In addition to Namespace support, it 
081         * adds the <var>getIndex</var> methods (below).</p>
082         *
083         * <p>The order of attributes in the list is unspecified, and will
084         * vary from implementation to implementation.</p>
085         *
086         * @since SAX 2.0
087         * @author David Megginson
088         * @version 2.0.1 (sax2r2)
089         * @see org.xml.sax.helpers.AttributesImpl
090         * @see org.xml.sax.ext.DeclHandler#attributeDecl
091         */
092        public interface Attributes {
093
094            ////////////////////////////////////////////////////////////////////
095            // Indexed access.
096            ////////////////////////////////////////////////////////////////////
097
098            /**
099             * Return the number of attributes in the list.
100             *
101             * <p>Once you know the number of attributes, you can iterate
102             * through the list.</p>
103             *
104             * @return The number of attributes in the list.
105             * @see #getURI(int)
106             * @see #getLocalName(int)
107             * @see #getQName(int)
108             * @see #getType(int)
109             * @see #getValue(int)
110             */
111            public abstract int getLength();
112
113            /**
114             * Look up an attribute's Namespace URI by index.
115             *
116             * @param index The attribute index (zero-based).
117             * @return The Namespace URI, or the empty string if none
118             *         is available, or null if the index is out of
119             *         range.
120             * @see #getLength
121             */
122            public abstract String getURI(int index);
123
124            /**
125             * Look up an attribute's local name by index.
126             *
127             * @param index The attribute index (zero-based).
128             * @return The local name, or the empty string if Namespace
129             *         processing is not being performed, or null
130             *         if the index is out of range.
131             * @see #getLength
132             */
133            public abstract String getLocalName(int index);
134
135            /**
136             * Look up an attribute's XML qualified (prefixed) name by index.
137             *
138             * @param index The attribute index (zero-based).
139             * @return The XML qualified name, or the empty string
140             *         if none is available, or null if the index
141             *         is out of range.
142             * @see #getLength
143             */
144            public abstract String getQName(int index);
145
146            /**
147             * Look up an attribute's type by index.
148             *
149             * <p>The attribute type is one of the strings "CDATA", "ID",
150             * "IDREF", "IDREFS", "NMTOKEN", "NMTOKENS", "ENTITY", "ENTITIES",
151             * or "NOTATION" (always in upper case).</p>
152             *
153             * <p>If the parser has not read a declaration for the attribute,
154             * or if the parser does not report attribute types, then it must
155             * return the value "CDATA" as stated in the XML 1.0 Recommendation
156             * (clause 3.3.3, "Attribute-Value Normalization").</p>
157             *
158             * <p>For an enumerated attribute that is not a notation, the
159             * parser will report the type as "NMTOKEN".</p>
160             *
161             * @param index The attribute index (zero-based).
162             * @return The attribute's type as a string, or null if the
163             *         index is out of range.
164             * @see #getLength
165             */
166            public abstract String getType(int index);
167
168            /**
169             * Look up an attribute's value by index.
170             *
171             * <p>If the attribute value is a list of tokens (IDREFS,
172             * ENTITIES, or NMTOKENS), the tokens will be concatenated
173             * into a single string with each token separated by a
174             * single space.</p>
175             *
176             * @param index The attribute index (zero-based).
177             * @return The attribute's value as a string, or null if the
178             *         index is out of range.
179             * @see #getLength
180             */
181            public abstract String getValue(int index);
182
183            ////////////////////////////////////////////////////////////////////
184            // Name-based query.
185            ////////////////////////////////////////////////////////////////////
186
187            /**
188             * Look up the index of an attribute by Namespace name.
189             *
190             * @param uri The Namespace URI, or the empty string if
191             *        the name has no Namespace URI.
192             * @param localName The attribute's local name.
193             * @return The index of the attribute, or -1 if it does not
194             *         appear in the list.
195             */
196            public int getIndex(String uri, String localName);
197
198            /**
199             * Look up the index of an attribute by XML qualified (prefixed) name.
200             *
201             * @param qName The qualified (prefixed) name.
202             * @return The index of the attribute, or -1 if it does not
203             *         appear in the list.
204             */
205            public int getIndex(String qName);
206
207            /**
208             * Look up an attribute's type by Namespace name.
209             *
210             * <p>See {@link #getType(int) getType(int)} for a description
211             * of the possible types.</p>
212             *
213             * @param uri The Namespace URI, or the empty String if the
214             *        name has no Namespace URI.
215             * @param localName The local name of the attribute.
216             * @return The attribute type as a string, or null if the
217             *         attribute is not in the list or if Namespace
218             *         processing is not being performed.
219             */
220            public abstract String getType(String uri, String localName);
221
222            /**
223             * Look up an attribute's type by XML qualified (prefixed) name.
224             *
225             * <p>See {@link #getType(int) getType(int)} for a description
226             * of the possible types.</p>
227             *
228             * @param qName The XML qualified name.
229             * @return The attribute type as a string, or null if the
230             *         attribute is not in the list or if qualified names
231             *         are not available.
232             */
233            public abstract String getType(String qName);
234
235            /**
236             * Look up an attribute's value by Namespace name.
237             *
238             * <p>See {@link #getValue(int) getValue(int)} for a description
239             * of the possible values.</p>
240             *
241             * @param uri The Namespace URI, or the empty String if the
242             *        name has no Namespace URI.
243             * @param localName The local name of the attribute.
244             * @return The attribute value as a string, or null if the
245             *         attribute is not in the list.
246             */
247            public abstract String getValue(String uri, String localName);
248
249            /**
250             * Look up an attribute's value by XML qualified (prefixed) name.
251             *
252             * <p>See {@link #getValue(int) getValue(int)} for a description
253             * of the possible values.</p>
254             *
255             * @param qName The XML qualified name.
256             * @return The attribute value as a string, or null if the
257             *         attribute is not in the list or if qualified names
258             *         are not available.
259             */
260            public abstract String getValue(String qName);
261
262        }
263
264        // end of Attributes.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.