Source Code Cross Referenced for AttributesProxy.java in  » XML » xerces-2_9_1 » org » apache » xerces » util » 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 » XML » xerces 2_9_1 » org.apache.xerces.util 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Licensed to the Apache Software Foundation (ASF) under one or more
003:         * contributor license agreements.  See the NOTICE file distributed with
004:         * this work for additional information regarding copyright ownership.
005:         * The ASF licenses this file to You under the Apache License, Version 2.0
006:         * (the "License"); you may not use this file except in compliance with
007:         * the License.  You may obtain a copy of the License at
008:         * 
009:         *      http://www.apache.org/licenses/LICENSE-2.0
010:         * 
011:         * Unless required by applicable law or agreed to in writing, software
012:         * distributed under the License is distributed on an "AS IS" BASIS,
013:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014:         * See the License for the specific language governing permissions and
015:         * limitations under the License.
016:         */
017:
018:        package org.apache.xerces.util;
019:
020:        import org.apache.xerces.impl.Constants;
021:        import org.apache.xerces.xni.XMLAttributes;
022:        import org.xml.sax.AttributeList;
023:        import org.xml.sax.ext.Attributes2;
024:
025:        /**
026:         * Wraps {@link XMLAttributes} and makes it look like
027:         * {@link AttributeList} and {@link Attributes2}.
028:         *
029:         * @author Arnaud Le Hors, IBM
030:         * @author Andy Clark, IBM
031:         *
032:         * @version $Id: AttributesProxy.java 449487 2006-09-24 21:11:28Z mrglavas $
033:         */
034:        public final class AttributesProxy implements  AttributeList,
035:                Attributes2 {
036:
037:            //
038:            // Data
039:            //
040:
041:            /** XML attributes. */
042:            private XMLAttributes fAttributes;
043:
044:            //
045:            // Constructors
046:            //
047:
048:            public AttributesProxy(XMLAttributes attributes) {
049:                fAttributes = attributes;
050:            }
051:
052:            //
053:            // Public methods
054:            //
055:
056:            /** Sets the XML attributes to be wrapped. */
057:            public void setAttributes(XMLAttributes attributes) {
058:                fAttributes = attributes;
059:            } // setAttributes(XMLAttributes)
060:
061:            public XMLAttributes getAttributes() {
062:                return fAttributes;
063:            }
064:
065:            /*
066:             * Attributes methods
067:             */
068:
069:            public int getLength() {
070:                return fAttributes.getLength();
071:            }
072:
073:            public String getQName(int index) {
074:                return fAttributes.getQName(index);
075:            }
076:
077:            public String getURI(int index) {
078:                // This hides the fact that internally we use null instead of empty string
079:                // SAX requires the URI to be a string or an empty string
080:                String uri = fAttributes.getURI(index);
081:                return uri != null ? uri : XMLSymbols.EMPTY_STRING;
082:            }
083:
084:            public String getLocalName(int index) {
085:                return fAttributes.getLocalName(index);
086:            }
087:
088:            public String getType(int i) {
089:                return fAttributes.getType(i);
090:            }
091:
092:            public String getType(String name) {
093:                return fAttributes.getType(name);
094:            }
095:
096:            public String getType(String uri, String localName) {
097:                return uri.equals(XMLSymbols.EMPTY_STRING) ? fAttributes
098:                        .getType(null, localName) : fAttributes.getType(uri,
099:                        localName);
100:            }
101:
102:            public String getValue(int i) {
103:                return fAttributes.getValue(i);
104:            }
105:
106:            public String getValue(String name) {
107:                return fAttributes.getValue(name);
108:            }
109:
110:            public String getValue(String uri, String localName) {
111:                return uri.equals(XMLSymbols.EMPTY_STRING) ? fAttributes
112:                        .getValue(null, localName) : fAttributes.getValue(uri,
113:                        localName);
114:            }
115:
116:            public int getIndex(String qName) {
117:                return fAttributes.getIndex(qName);
118:            }
119:
120:            public int getIndex(String uri, String localPart) {
121:                return uri.equals(XMLSymbols.EMPTY_STRING) ? fAttributes
122:                        .getIndex(null, localPart) : fAttributes.getIndex(uri,
123:                        localPart);
124:            }
125:
126:            /*
127:             * Attributes2 methods
128:             */
129:
130:            public boolean isDeclared(int index) {
131:                if (index < 0 || index >= fAttributes.getLength()) {
132:                    throw new ArrayIndexOutOfBoundsException(index);
133:                }
134:                return Boolean.TRUE.equals(fAttributes.getAugmentations(index)
135:                        .getItem(Constants.ATTRIBUTE_DECLARED));
136:            }
137:
138:            public boolean isDeclared(String qName) {
139:                int index = getIndex(qName);
140:                if (index == -1) {
141:                    throw new IllegalArgumentException(qName);
142:                }
143:                return Boolean.TRUE.equals(fAttributes.getAugmentations(index)
144:                        .getItem(Constants.ATTRIBUTE_DECLARED));
145:            }
146:
147:            public boolean isDeclared(String uri, String localName) {
148:                int index = getIndex(uri, localName);
149:                if (index == -1) {
150:                    throw new IllegalArgumentException(localName);
151:                }
152:                return Boolean.TRUE.equals(fAttributes.getAugmentations(index)
153:                        .getItem(Constants.ATTRIBUTE_DECLARED));
154:            }
155:
156:            public boolean isSpecified(int index) {
157:                if (index < 0 || index >= fAttributes.getLength()) {
158:                    throw new ArrayIndexOutOfBoundsException(index);
159:                }
160:                return fAttributes.isSpecified(index);
161:            }
162:
163:            public boolean isSpecified(String qName) {
164:                int index = getIndex(qName);
165:                if (index == -1) {
166:                    throw new IllegalArgumentException(qName);
167:                }
168:                return fAttributes.isSpecified(index);
169:            }
170:
171:            public boolean isSpecified(String uri, String localName) {
172:                int index = getIndex(uri, localName);
173:                if (index == -1) {
174:                    throw new IllegalArgumentException(localName);
175:                }
176:                return fAttributes.isSpecified(index);
177:            }
178:
179:            /*
180:             * AttributeList methods
181:             */
182:
183:            public String getName(int i) {
184:                return fAttributes.getQName(i);
185:            }
186:
187:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.