Source Code Cross Referenced for AttributeList.java in  » Science » javolution-5.2 » org » xml » sax » Java Source Code / Java DocumentationJava Source Code and Java Documentation

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 geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Science » javolution 5.2 » org.xml.sax 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        // SAX Attribute List Interface.
002:        // http://www.saxproject.org
003:        // No warranty; no copyright -- use this as you will.
004:
005:        package org.xml.sax;
006:
007:        /**
008:         * Interface for an element's attribute specifications.
009:         *
010:         * <blockquote>
011:         * <em>This module, both source code and documentation, is in the
012:         * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
013:         * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
014:         * for further information.
015:         * </blockquote>
016:         *
017:         * <p>This is the original SAX1 interface for reporting an element's
018:         * attributes.  Unlike the new {@link org.xml.sax.Attributes Attributes}
019:         * interface, it does not support Namespace-related information.</p>
020:         *
021:         * <p>When an attribute list is supplied as part of a
022:         * {@link org.xml.sax.DocumentHandler#startElement startElement}
023:         * event, the list will return valid results only during the
024:         * scope of the event; once the event handler returns control
025:         * to the parser, the attribute list is invalid.  To save a
026:         * persistent copy of the attribute list, use the SAX1
027:         * {@link org.xml.sax.helpers.AttributeListImpl AttributeListImpl}
028:         * helper class.</p>
029:         *
030:         * <p>An attribute list includes only attributes that have been
031:         * specified or defaulted: #IMPLIED attributes will not be included.</p>
032:         *
033:         * <p>There are two ways for the SAX application to obtain information
034:         * from the AttributeList.  First, it can iterate through the entire
035:         * list:</p>
036:         *
037:         * <pre>
038:         * public void startElement (String name, AttributeList atts) {
039:         *   for (int i = 0; i < atts.getLength(); i++) {
040:         *     String name = atts.getName(i);
041:         *     String type = atts.getType(i);
042:         *     String value = atts.getValue(i);
043:         *     [...]
044:         *   }
045:         * }
046:         * </pre>
047:         *
048:         * <p>(Note that the result of getLength() will be zero if there
049:         * are no attributes.)
050:         *
051:         * <p>As an alternative, the application can request the value or
052:         * type of specific attributes:</p>
053:         *
054:         * <pre>
055:         * public void startElement (String name, AttributeList atts) {
056:         *   String identifier = atts.getValue("id");
057:         *   String label = atts.getValue("label");
058:         *   [...]
059:         * }
060:         * </pre>
061:         *
062:         * @since SAX 1.0
063:         * @author David Megginson
064:         * @version 2.0.1 (sax2r2)
065:         * @see org.xml.sax.DocumentHandler#startElement startElement
066:         * @see org.xml.sax.helpers.AttributeListImpl AttributeListImpl
067:         */
068:        public interface AttributeList {
069:
070:            ////////////////////////////////////////////////////////////////////
071:            // Iteration methods.
072:            ////////////////////////////////////////////////////////////////////
073:
074:            /**
075:             * Return the number of attributes in this list.
076:             *
077:             * <p>The SAX parser may provide attributes in any
078:             * arbitrary order, regardless of the order in which they were
079:             * declared or specified.  The number of attributes may be
080:             * zero.</p>
081:             *
082:             * @return The number of attributes in the list.  
083:             */
084:            public abstract int getLength();
085:
086:            /**
087:             * Return the name of an attribute in this list (by position).
088:             *
089:             * <p>The names must be unique: the SAX parser shall not include the
090:             * same attribute twice.  Attributes without values (those declared
091:             * #IMPLIED without a value specified in the start tag) will be
092:             * omitted from the list.</p>
093:             *
094:             * <p>If the attribute name has a namespace prefix, the prefix
095:             * will still be attached.</p>
096:             *
097:             * @param i The index of the attribute in the list (starting at 0).
098:             * @return The name of the indexed attribute, or null
099:             *         if the index is out of range.
100:             * @see #getLength 
101:             */
102:            public abstract String getName(int i);
103:
104:            /**
105:             * Return the type of an attribute in the list (by position).
106:             *
107:             * <p>The attribute type is one of the strings "CDATA", "ID",
108:             * "IDREF", "IDREFS", "NMTOKEN", "NMTOKENS", "ENTITY", "ENTITIES",
109:             * or "NOTATION" (always in upper case).</p>
110:             *
111:             * <p>If the parser has not read a declaration for the attribute,
112:             * or if the parser does not report attribute types, then it must
113:             * return the value "CDATA" as stated in the XML 1.0 Recommentation
114:             * (clause 3.3.3, "Attribute-Value Normalization").</p>
115:             *
116:             * <p>For an enumerated attribute that is not a notation, the
117:             * parser will report the type as "NMTOKEN".</p>
118:             *
119:             * @param i The index of the attribute in the list (starting at 0).
120:             * @return The attribute type as a string, or
121:             *         null if the index is out of range.
122:             * @see #getLength 
123:             * @see #getType(j2me.lang.String)
124:             */
125:            public abstract String getType(int i);
126:
127:            /**
128:             * Return the value of an attribute in the list (by position).
129:             *
130:             * <p>If the attribute value is a list of tokens (IDREFS,
131:             * ENTITIES, or NMTOKENS), the tokens will be concatenated
132:             * into a single string separated by whitespace.</p>
133:             *
134:             * @param i The index of the attribute in the list (starting at 0).
135:             * @return The attribute value as a string, or
136:             *         null if the index is out of range.
137:             * @see #getLength
138:             * @see #getValue(j2me.lang.String)
139:             */
140:            public abstract String getValue(int i);
141:
142:            ////////////////////////////////////////////////////////////////////
143:            // Lookup methods.
144:            ////////////////////////////////////////////////////////////////////
145:
146:            /**
147:             * Return the type of an attribute in the list (by name).
148:             *
149:             * <p>The return value is the same as the return value for
150:             * getType(int).</p>
151:             *
152:             * <p>If the attribute name has a namespace prefix in the document,
153:             * the application must include the prefix here.</p>
154:             *
155:             * @param name The name of the attribute.
156:             * @return The attribute type as a string, or null if no
157:             *         such attribute exists.
158:             * @see #getType(int)
159:             */
160:            public abstract String getType(String name);
161:
162:            /**
163:             * Return the value of an attribute in the list (by name).
164:             *
165:             * <p>The return value is the same as the return value for
166:             * getValue(int).</p>
167:             *
168:             * <p>If the attribute name has a namespace prefix in the document,
169:             * the application must include the prefix here.</p>
170:             *
171:             * @param name the name of the attribute to return
172:             * @return The attribute value as a string, or null if
173:             *         no such attribute exists.
174:             * @see #getValue(int)
175:             */
176:            public abstract String getValue(String name);
177:
178:        }
179:
180:        // 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.