Source Code Cross Referenced for CharacterDataImpl.java in  » Database-JDBC-Connection-Pool » octopus » org » enhydra » xml » 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 » Database JDBC Connection Pool » octopus » org.enhydra.xml 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:            Copyright (C) 2003  Together
003:
004:            This library is free software; you can redistribute it and/or
005:            modify it under the terms of the GNU Lesser General Public
006:            License as published by the Free Software Foundation; either
007:            version 2.1 of the License, or (at your option) any later version.
008:
009:            This library is distributed in the hope that it will be useful,
010:            but WITHOUT ANY WARRANTY; without even the implied warranty of
011:            MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
012:            Lesser General Public License for more details.
013:
014:            You should have received a copy of the GNU Lesser General Public
015:            License along with this library; if not, write to the Free Software
016:            Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
017:         */
018:
019:        package org.enhydra.xml;
020:
021:        import org.w3c.dom.DOMException;
022:        import org.w3c.dom.Node;
023:        import org.w3c.dom.CharacterData;
024:
025:        /**
026:         * @author Tweety
027:         *
028:         * A class representing a node in a meta-data tree, which implements
029:         * the <a href="../../../../api/org/w3c/dom/CharacterData.html">
030:         *
031:         * @version 1.0
032:         */
033:        public class CharacterDataImpl extends NodeImpl implements 
034:                CharacterData {
035:
036:            /**
037:             * Constructs an empty <code>CharacterDataImpl</code>.
038:             */
039:            public CharacterDataImpl() {
040:            }
041:
042:            /**
043:             * Constructs a <code>CharacterDataImpl</code> from the
044:             * given node as <code>Node</code>.
045:             *
046:             * @param node , as a <code>Node</code>.
047:             */
048:            public CharacterDataImpl(Node node) {
049:                super (node);
050:            }
051:
052:            /**
053:             * Returns node value.
054:             *
055:             * @return node value, as <code>String</code>.
056:             *
057:             * @see org.w3c.dom.CharacterData#getData().
058:             * @throws DOMException
059:             */
060:            public String getData() throws DOMException {
061:                return nodeValue;
062:            }
063:
064:            /**
065:             * Sets the new value of this node.
066:             *
067:             * @param data the new data
068:             *
069:             * @see org.w3c.dom.CharacterData#setData(String).
070:             * @throws DOMException
071:             */
072:            public void setData(String data) throws DOMException {
073:                nodeValue = data;
074:            }
075:
076:            /**
077:             * Returns the substring from the node's value.
078:             *
079:             * @param offset the begin index of the substring.
080:             * @param count the number of characters.
081:             *
082:             * @return substring of the node's value.
083:             *
084:             * @see org.w3c.dom.CharacterData#substringData(int, int).
085:             * @throws DOMException
086:             */
087:            public String substringData(int offset, int count)
088:                    throws DOMException {
089:                int length = nodeValue.length();
090:                if (count < 0 || offset < 0 || offset > length - 1)
091:                    throw new DOMException(DOMException.INDEX_SIZE_ERR,
092:                            "Index out of bounds");
093:
094:                int tailIndex = length;
095:                if (offset + count < length)
096:                    tailIndex = offset + count;
097:                return nodeValue.substring(offset, tailIndex);
098:            }
099:
100:            /**
101:             * Appends data to the node's value.
102:             *
103:             * @param arg the data to append to the node's value.
104:             *
105:             * @see org.w3c.dom.CharacterData#appendData(String).
106:             */
107:            public void appendData(String arg) {
108:                nodeValue += arg;
109:            }
110:
111:            /**
112:             * Inserts substring into node's value string.
113:             *
114:             * @param offset the begin index of the substring.
115:             * @param arg the <code>String</code> to insert.
116:             *
117:             * @see org.w3c.dom.CharacterData#insertData(int, String).
118:             * @throws DOMException
119:             */
120:            public void insertData(int offset, String arg) throws DOMException {
121:                try {
122:                    nodeValue = new StringBuffer(nodeValue).insert(offset, arg)
123:                            .toString();
124:                } catch (StringIndexOutOfBoundsException e) {
125:                    throw new DOMException(DOMException.INDEX_SIZE_ERR,
126:                            "Index out of bounds");
127:                }
128:            }
129:
130:            /**
131:             * Deletes characters from the node's value string.
132:             *
133:             * @param offset the begin index of the substring.
134:             * @param count the number of characters.
135:             *
136:             * @see org.w3c.dom.CharacterData#deleteData(int, int).
137:             * @throws DOMException
138:             */
139:            public void deleteData(int offset, int count) throws DOMException {
140:                int tailLength = nodeValue.length() - count - offset;
141:                if (nodeValue.length() - count - offset < 0)
142:                    tailLength = 0;
143:                try {
144:                    nodeValue = nodeValue.substring(0, offset)
145:                            + (tailLength > 0 ? nodeValue.substring(offset
146:                                    + count, offset + count + tailLength) : "");
147:                } catch (StringIndexOutOfBoundsException e) {
148:                    throw new DOMException(DOMException.INDEX_SIZE_ERR,
149:                            "Index out of bounds");
150:                }
151:            }
152:
153:            /**
154:             * Replaces characters in the node's value string.
155:             *
156:             * @param offset the begin index of the substring.
157:             * @param count the number of characters.
158:             * @param arg the <code>String</code> to insert.
159:             *
160:             * @see org.w3c.dom.CharacterData#replaceData(int, int, String).
161:             * @throws DOMException
162:             */
163:            public void replaceData(int offset, int count, String arg)
164:                    throws DOMException {
165:                deleteData(offset, count);
166:                insertData(offset, arg);
167:            }
168:
169:            /**
170:             * Returns the namespace of the node.
171:             *
172:             * @return the namespace of the node.
173:             *
174:             * @see org.w3c.dom.Node#getNamespaceURI().
175:             */
176:            public String getNamespaceURI() {
177:                return super.getNamespaceURI();
178:            }
179:
180:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.