Source Code Cross Referenced for TextImpl.java in  » Web-Server » Rimfaxe-Web-Server » org » apache » xerces » dom » 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 » Web Server » Rimfaxe Web Server » org.apache.xerces.dom 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * The Apache Software License, Version 1.1
003:         *
004:         *
005:         * Copyright (c) 1999 The Apache Software Foundation.  All rights 
006:         * reserved.
007:         *
008:         * Redistribution and use in source and binary forms, with or without
009:         * modification, are permitted provided that the following conditions
010:         * are met:
011:         *
012:         * 1. Redistributions of source code must retain the above copyright
013:         *    notice, this list of conditions and the following disclaimer. 
014:         *
015:         * 2. Redistributions in binary form must reproduce the above copyright
016:         *    notice, this list of conditions and the following disclaimer in
017:         *    the documentation and/or other materials provided with the
018:         *    distribution.
019:         *
020:         * 3. The end-user documentation included with the redistribution,
021:         *    if any, must include the following acknowledgment:  
022:         *       "This product includes software developed by the
023:         *        Apache Software Foundation (http://www.apache.org/)."
024:         *    Alternately, this acknowledgment may appear in the software itself,
025:         *    if and wherever such third-party acknowledgments normally appear.
026:         *
027:         * 4. The names "Xerces" and "Apache Software Foundation" must
028:         *    not be used to endorse or promote products derived from this
029:         *    software without prior written permission. For written 
030:         *    permission, please contact apache@apache.org.
031:         *
032:         * 5. Products derived from this software may not be called "Apache",
033:         *    nor may "Apache" appear in their name, without prior written
034:         *    permission of the Apache Software Foundation.
035:         *
036:         * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
037:         * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
038:         * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
039:         * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
040:         * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
041:         * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
042:         * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
043:         * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
044:         * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
045:         * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
046:         * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
047:         * SUCH DAMAGE.
048:         * ====================================================================
049:         *
050:         * This software consists of voluntary contributions made by many
051:         * individuals on behalf of the Apache Software Foundation and was
052:         * originally based on software copyright (c) 1999, International
053:         * Business Machines, Inc., http://www.apache.org.  For more
054:         * information on the Apache Software Foundation, please see
055:         * <http://www.apache.org/>.
056:         */
057:
058:        package org.apache.xerces.dom;
059:
060:        import org.w3c.dom.CharacterData;
061:        import org.w3c.dom.DOMException;
062:        import org.w3c.dom.Node;
063:        import org.w3c.dom.Text;
064:
065:        /**
066:         * Text nodes hold the non-markup, non-Entity content of
067:         * an Element or Attribute.
068:         * <P>
069:         * When a document is first made available to the DOM, there is only
070:         * one Text object for each block of adjacent plain-text. Users (ie,
071:         * applications) may create multiple adjacent Texts during editing --
072:         * see {@link Element#normalize} for discussion.
073:         * <P>
074:         * Note that CDATASection is a subclass of Text. This is conceptually
075:         * valid, since they're really just two different ways of quoting
076:         * characters when they're written out as part of an XML stream.
077:         *
078:         * @version
079:         * @since  PR-DOM-Level-1-19980818.
080:         */
081:        public class TextImpl extends CharacterDataImpl implements 
082:                CharacterData, Text {
083:
084:            //
085:            // Constants
086:            //
087:
088:            /** Serialization version. */
089:            static final long serialVersionUID = -5294980852957403469L;
090:
091:            //
092:            // Constructors
093:            //
094:
095:            /** Factory constructor. */
096:            public TextImpl(CoreDocumentImpl ownerDoc, String data) {
097:                super (ownerDoc, data);
098:            }
099:
100:            //
101:            // Node methods
102:            //
103:
104:            /** 
105:             * A short integer indicating what type of node this is. The named
106:             * constants for this value are defined in the org.w3c.dom.Node interface.
107:             */
108:            public short getNodeType() {
109:                return Node.TEXT_NODE;
110:            }
111:
112:            /** Returns the node name. */
113:            public String getNodeName() {
114:                return "#text";
115:            }
116:
117:            /**
118:             * NON-DOM: Set whether this Text is ignorable whitespace.
119:             */
120:            public void setIgnorableWhitespace(boolean ignore) {
121:
122:                if (needsSyncData()) {
123:                    synchronizeData();
124:                }
125:                isIgnorableWhitespace(ignore);
126:
127:            } // setIgnorableWhitespace(boolean)
128:
129:            /**
130:             * NON-DOM: Returns whether this Text is ignorable whitespace.
131:             */
132:            public boolean isIgnorableWhitespace() {
133:
134:                if (needsSyncData()) {
135:                    synchronizeData();
136:                }
137:                return internalIsIgnorableWhitespace();
138:
139:            } // isIgnorableWhitespace():boolean
140:
141:            //
142:            // Text methods
143:            //
144:
145:            /** 
146:             * Break a text node into two sibling nodes.  (Note that if the
147:             * current node has no parent, they won't wind up as "siblings" --
148:             * they'll both be orphans.)
149:             *
150:             * @param offset The offset at which to split. If offset is at the
151:             * end of the available data, the second node will be empty.
152:             *
153:             * @returns A reference to the new node (containing data after the
154:             * offset point). The original node will contain data up to that
155:             * point.
156:             *
157:             * @throws DOMException(INDEX_SIZE_ERR) if offset is <0 or >length.
158:             *
159:             * @throws DOMException(NO_MODIFICATION_ALLOWED_ERR) if node is read-only.
160:             */
161:            public Text splitText(int offset) throws DOMException {
162:
163:                if (isReadOnly()) {
164:                    throw new DOMException(
165:                            DOMException.NO_MODIFICATION_ALLOWED_ERR,
166:                            "DOM001 Modification not allowed");
167:                }
168:
169:                if (needsSyncData()) {
170:                    synchronizeData();
171:                }
172:                if (offset < 0 || offset > data.length()) {
173:                    throw new DOMException(DOMException.INDEX_SIZE_ERR,
174:                            "DOM004 Index out of bounds");
175:                }
176:
177:                // split text into two separate nodes
178:                Text newText = getOwnerDocument().createTextNode(
179:                        data.substring(offset));
180:                setNodeValue(data.substring(0, offset));
181:
182:                // insert new text node
183:                Node parentNode = getParentNode();
184:                if (parentNode != null) {
185:                    parentNode.insertBefore(newText, nextSibling);
186:                }
187:
188:                return newText;
189:
190:            } // splitText(int):Text
191:
192:        } // class TextImpl
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.