Source Code Cross Referenced for Text.java in  » 6.0-JDK-Core » w3c » org » w3c » dom » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Home
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
26.ERP CRM Financial
27.ESB
28.Forum
29.Game
30.GIS
31.Graphic 3D
32.Graphic Library
33.Groupware
34.HTML Parser
35.IDE
36.IDE Eclipse
37.IDE Netbeans
38.Installer
39.Internationalization Localization
40.Inversion of Control
41.Issue Tracking
42.J2EE
43.J2ME
44.JBoss
45.JMS
46.JMX
47.Library
48.Mail Clients
49.Music
50.Net
51.Parser
52.PDF
53.Portal
54.Profiler
55.Project Management
56.Report
57.RSS RDF
58.Rule Engine
59.Science
60.Scripting
61.Search Engine
62.Security
63.Sevlet Container
64.Source Control
65.Swing Library
66.Template Engine
67.Test Coverage
68.Testing
69.UML
70.Web Crawler
71.Web Framework
72.Web Mail
73.Web Server
74.Web Services
75.Web Services apache cxf 2.2.6
76.Web Services AXIS2
77.Wiki Engine
78.Workflow Engines
79.XML
80.XML UI
Java Source Code / Java Documentation » 6.0 JDK Core » w3c » org.w3c.dom 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001        /*
002         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
003         *
004         * This code is free software; you can redistribute it and/or modify it
005         * under the terms of the GNU General Public License version 2 only, as
006         * published by the Free Software Foundation.  Sun designates this
007         * particular file as subject to the "Classpath" exception as provided
008         * by Sun in the LICENSE file that accompanied this code.
009         *
010         * This code is distributed in the hope that it will be useful, but WITHOUT
011         * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
012         * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
013         * version 2 for more details (a copy is included in the LICENSE file that
014         * accompanied this code).
015         *
016         * You should have received a copy of the GNU General Public License version
017         * 2 along with this work; if not, write to the Free Software Foundation,
018         * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
019         *
020         * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
021         * CA 95054 USA or visit www.sun.com if you need additional information or
022         * have any questions.
023         */
024
025        /*
026         * This file is available under and governed by the GNU General Public
027         * License version 2 only, as published by the Free Software Foundation.
028         * However, the following notice accompanied the original version of this
029         * file and, per its terms, should not be removed:
030         *
031         * Copyright (c) 2004 World Wide Web Consortium,
032         *
033         * (Massachusetts Institute of Technology, European Research Consortium for
034         * Informatics and Mathematics, Keio University). All Rights Reserved. This
035         * work is distributed under the W3C(r) Software License [1] in the hope that
036         * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
037         * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
038         *
039         * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
040         */
041
042        package org.w3c.dom;
043
044        /**
045         * The <code>Text</code> interface inherits from <code>CharacterData</code> 
046         * and represents the textual content (termed <a href='http://www.w3.org/TR/2004/REC-xml-20040204#syntax'>character data</a> in XML) of an <code>Element</code> or <code>Attr</code>. If there is no 
047         * markup inside an element's content, the text is contained in a single 
048         * object implementing the <code>Text</code> interface that is the only 
049         * child of the element. If there is markup, it is parsed into the 
050         * information items (elements, comments, etc.) and <code>Text</code> nodes 
051         * that form the list of children of the element.
052         * <p>When a document is first made available via the DOM, there is only one 
053         * <code>Text</code> node for each block of text. Users may create adjacent 
054         * <code>Text</code> nodes that represent the contents of a given element 
055         * without any intervening markup, but should be aware that there is no way 
056         * to represent the separations between these nodes in XML or HTML, so they 
057         * will not (in general) persist between DOM editing sessions. The 
058         * <code>Node.normalize()</code> method merges any such adjacent 
059         * <code>Text</code> objects into a single node for each block of text.
060         * <p> No lexical check is done on the content of a <code>Text</code> node 
061         * and, depending on its position in the document, some characters must be 
062         * escaped during serialization using character references; e.g. the 
063         * characters "&lt;&amp;" if the textual content is part of an element or of 
064         * an attribute, the character sequence "]]&gt;" when part of an element, 
065         * the quotation mark character " or the apostrophe character ' when part of 
066         * an attribute. 
067         * <p>See also the <a href='http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407'>Document Object Model (DOM) Level 3 Core Specification</a>.
068         */
069        public interface Text extends CharacterData {
070            /**
071             * Breaks this node into two nodes at the specified <code>offset</code>, 
072             * keeping both in the tree as siblings. After being split, this node 
073             * will contain all the content up to the <code>offset</code> point. A 
074             * new node of the same type, which contains all the content at and 
075             * after the <code>offset</code> point, is returned. If the original 
076             * node had a parent node, the new node is inserted as the next sibling 
077             * of the original node. When the <code>offset</code> is equal to the 
078             * length of this node, the new node has no data.
079             * @param offset The 16-bit unit offset at which to split, starting from 
080             *   <code>0</code>.
081             * @return The new node, of the same type as this node.
082             * @exception DOMException
083             *   INDEX_SIZE_ERR: Raised if the specified offset is negative or greater 
084             *   than the number of 16-bit units in <code>data</code>.
085             *   <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
086             */
087            public Text splitText(int offset) throws DOMException;
088
089            /**
090             * Returns whether this text node contains <a href='http://www.w3.org/TR/2004/REC-xml-infoset-20040204#infoitem.character'>
091             * element content whitespace</a>, often abusively called "ignorable whitespace". The text node is 
092             * determined to contain whitespace in element content during the load 
093             * of the document or if validation occurs while using 
094             * <code>Document.normalizeDocument()</code>.
095             * @since DOM Level 3
096             */
097            public boolean isElementContentWhitespace();
098
099            /**
100             * Returns all text of <code>Text</code> nodes logically-adjacent text 
101             * nodes to this node, concatenated in document order.
102             * <br>For instance, in the example below <code>wholeText</code> on the 
103             * <code>Text</code> node that contains "bar" returns "barfoo", while on 
104             * the <code>Text</code> node that contains "foo" it returns "barfoo". 
105             *
106             * <pre>
107             *                     +-----+
108             *                     | &lt;p&gt; |
109             *                     +-----+
110             *                       /\
111             *                      /  \
112             *               /-----\    +-------+
113             *               | bar |    | &amp;ent; |
114             *               \-----/    +-------+
115             *                              |
116             *                              |
117             *                           /-----\
118             *                           | foo |
119             *                           \-----/
120             * </pre>
121             * <em>Figure: barTextNode.wholeText value is "barfoo"</em>
122             *
123             * @since DOM Level 3
124             */
125            public String getWholeText();
126
127            /**
128             * Replaces the text of the current node and all logically-adjacent text 
129             * nodes with the specified text. All logically-adjacent text nodes are 
130             * removed including the current node unless it was the recipient of the 
131             * replacement text.
132             * <p>This method returns the node which received the replacement text. 
133             * The returned node is:</p>
134             * <ul>
135             * <li><code>null</code>, when the replacement text is 
136             * the empty string;
137             * </li>
138             * <li>the current node, except when the current node is 
139             * read-only;
140             * </li>
141             * <li> a new <code>Text</code> node of the same type (
142             * <code>Text</code> or <code>CDATASection</code>) as the current node 
143             * inserted at the location of the replacement.
144             * </li>
145             * </ul>
146             * <p>For instance, in the above example calling 
147             * <code>replaceWholeText</code> on the <code>Text</code> node that 
148             * contains "bar" with "yo" in argument results in the following:</p>
149             *
150             * <pre>
151             *                     +-----+
152             *                     | &lt;p&gt; |
153             *                     +-----+
154             *                        |
155             *                        |
156             *                     /-----\
157             *                     | yo  |
158             *                     \-----/
159             * </pre>
160             * <em>Figure: barTextNode.replaceWholeText("yo") modifies the
161             * textual content of barTextNode with "yo"</em>
162             *
163             * <p>Where the nodes to be removed are read-only descendants of an 
164             * <code>EntityReference</code>, the <code>EntityReference</code> must 
165             * be removed instead of the read-only nodes. If any 
166             * <code>EntityReference</code> to be removed has descendants that are 
167             * not <code>EntityReference</code>, <code>Text</code>, or 
168             * <code>CDATASection</code> nodes, the <code>replaceWholeText</code> 
169             * method must fail before performing any modification of the document, 
170             * raising a <code>DOMException</code> with the code 
171             * <code>NO_MODIFICATION_ALLOWED_ERR</code>.</p>
172             * <p>For instance, in the example below calling 
173             * <code>replaceWholeText</code> on the <code>Text</code> node that 
174             * contains "bar" fails, because the <code>EntityReference</code> node 
175             * "ent" contains an <code>Element</code> node which cannot be removed.</p>
176             * @param content The content of the replacing <code>Text</code> node.
177             * @return The <code>Text</code> node created with the specified content.
178             * @exception DOMException
179             *   NO_MODIFICATION_ALLOWED_ERR: Raised if one of the <code>Text</code> 
180             *   nodes being replaced is readonly.
181             * @since DOM Level 3
182             */
183            public Text replaceWholeText(String content) throws DOMException;
184
185        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.