Source Code Cross Referenced for QName.java in  » XML » xerces-2_9_1 » org » apache » xerces » xni » 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.xni 
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.xni;
019:
020:        /**
021:         * A structure that holds the components of an XML Namespaces qualified
022:         * name.
023:         * <p>
024:         * To be used correctly, the strings must be identical references for
025:         * equal strings. Within the parser, these values are considered symbols
026:         * and should always be retrieved from the <code>SymbolTable</code>.
027:         *
028:         * @see <a href="../../../../../xerces2/org/apache/xerces/util/SymbolTable.html">org.apache.xerces.util.SymbolTable</a>
029:         *
030:         * @author Andy Clark, IBM
031:         *
032:         * @version $Id: QName.java 447247 2006-09-18 05:23:52Z mrglavas $
033:         */
034:        public class QName implements  Cloneable {
035:
036:            //
037:            // Data
038:            //
039:
040:            /** 
041:             * The qname prefix. For example, the prefix for the qname "a:foo"
042:             * is "a".
043:             */
044:            public String prefix;
045:
046:            /** 
047:             * The qname localpart. For example, the localpart for the qname "a:foo"
048:             * is "foo".
049:             */
050:            public String localpart;
051:
052:            /** 
053:             * The qname rawname. For example, the rawname for the qname "a:foo"
054:             * is "a:foo".
055:             */
056:            public String rawname;
057:
058:            /** 
059:             * The URI to which the qname prefix is bound. This binding must be
060:             * performed by a XML Namespaces aware processor.
061:             */
062:            public String uri;
063:
064:            //
065:            // Constructors
066:            //
067:
068:            /** Default constructor. */
069:            public QName() {
070:                clear();
071:            } // <init>()
072:
073:            /** Constructs a QName with the specified values. */
074:            public QName(String prefix, String localpart, String rawname,
075:                    String uri) {
076:                setValues(prefix, localpart, rawname, uri);
077:            } // <init>(String,String,String,String)
078:
079:            /** Constructs a copy of the specified QName. */
080:            public QName(QName qname) {
081:                setValues(qname);
082:            } // <init>(QName)
083:
084:            //
085:            // Public methods
086:            //
087:
088:            /**
089:             * Convenience method to set the values of the qname components.
090:             * 
091:             * @param qname The qualified name to be copied.
092:             */
093:            public void setValues(QName qname) {
094:                prefix = qname.prefix;
095:                localpart = qname.localpart;
096:                rawname = qname.rawname;
097:                uri = qname.uri;
098:            } // setValues(QName)
099:
100:            /**
101:             * Convenience method to set the values of the qname components.
102:             * 
103:             * @param prefix    The qname prefix. (e.g. "a")
104:             * @param localpart The qname localpart. (e.g. "foo")
105:             * @param rawname   The qname rawname. (e.g. "a:foo")
106:             * @param uri       The URI binding. (e.g. "http://foo.com/mybinding")
107:             */
108:            public void setValues(String prefix, String localpart,
109:                    String rawname, String uri) {
110:                this .prefix = prefix;
111:                this .localpart = localpart;
112:                this .rawname = rawname;
113:                this .uri = uri;
114:            } // setValues(String,String,String,String)
115:
116:            /** Clears the values of the qname components. */
117:            public void clear() {
118:                prefix = null;
119:                localpart = null;
120:                rawname = null;
121:                uri = null;
122:            } // clear()
123:
124:            //
125:            // Cloneable methods
126:            //
127:
128:            /** Returns a clone of this object. */
129:            public Object clone() {
130:                return new QName(this );
131:            } // clone():Object
132:
133:            //
134:            // Object methods
135:            //
136:
137:            /** Returns the hashcode for this object. */
138:            public int hashCode() {
139:                if (uri != null) {
140:                    return uri.hashCode()
141:                            + ((localpart != null) ? localpart.hashCode() : 0);
142:                }
143:                return (rawname != null) ? rawname.hashCode() : 0;
144:            } // hashCode():int
145:
146:            /** Returns true if the two objects are equal. */
147:            public boolean equals(Object object) {
148:                if (object instanceof  QName) {
149:                    QName qname = (QName) object;
150:                    if (qname.uri != null) {
151:                        return uri == qname.uri && localpart == qname.localpart;
152:                    } else if (uri == null) {
153:                        return rawname == qname.rawname;
154:                    }
155:                    // fall through and return not equal
156:                }
157:                return false;
158:            } // equals(Object):boolean
159:
160:            /** Returns a string representation of this object. */
161:            public String toString() {
162:
163:                StringBuffer str = new StringBuffer();
164:                boolean comma = false;
165:                if (prefix != null) {
166:                    str.append("prefix=\"").append(prefix).append('"');
167:                    comma = true;
168:                }
169:                if (localpart != null) {
170:                    if (comma) {
171:                        str.append(',');
172:                    }
173:                    str.append("localpart=\"").append(localpart).append('"');
174:                    comma = true;
175:                }
176:                if (rawname != null) {
177:                    if (comma) {
178:                        str.append(',');
179:                    }
180:                    str.append("rawname=\"").append(rawname).append('"');
181:                    comma = true;
182:                }
183:                if (uri != null) {
184:                    if (comma) {
185:                        str.append(',');
186:                    }
187:                    str.append("uri=\"").append(uri).append('"');
188:                }
189:                return str.toString();
190:
191:            } // toString():String
192:
193:        } // class QName
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.