76 * node had a parent node, the new node is inserted as the next sibling
77 * of the original node. When the <code>offset</code> is equal to the
78 * length of this node, the new node has no data.
79 * @param offset The 16-bit unit offset at which to split, starting from
80 * <code>0</code>.
81 * @return The new node, of the same type as this node.
82 * @exception DOMException
83 * INDEX_SIZE_ERR: Raised if the specified offset is negative or greater
84 * than the number of 16-bit units in <code>data</code>.
85 * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
86 */
87 public Text splitText(int offset)
88 throws DOMException;
89
90 /**
91 * Returns whether this text node contains <a href='http://www.w3.org/TR/2004/REC-xml-infoset-20040204#infoitem.character'>
92 * element content whitespace</a>, often abusively called "ignorable whitespace". The text node is
93 * determined to contain whitespace in element content during the load
94 * of the document or if validation occurs while using
95 * <code>Document.normalizeDocument()</code>.
96 * @since DOM Level 3
97 */
98 public boolean isElementContentWhitespace();
99
100 /**
101 * Returns all text of <code>Text</code> nodes logically-adjacent text
102 * nodes to this node, concatenated in document order.
103 * <br>For instance, in the example below <code>wholeText</code> on the
104 * <code>Text</code> node that contains "bar" returns "barfoo", while on
105 * the <code>Text</code> node that contains "foo" it returns "barfoo".
106 *
107 * <pre>
108 * +-----+
109 * | <p> |
110 * +-----+
111 * /\
112 * / \
113 * /-----\ +-------+
114 * | bar | | &ent; |
115 * \-----/ +-------+
116 * |
117 * |
118 * /-----\
119 * | foo |
120 * \-----/
121 * </pre>
122 * <em>Figure: barTextNode.wholeText value is "barfoo"</em>
123 *
124 * @since DOM Level 3
125 */
126 public String getWholeText();
127
128 /**
129 * Replaces the text of the current node and all logically-adjacent text
130 * nodes with the specified text. All logically-adjacent text nodes are
131 * removed including the current node unless it was the recipient of the
132 * replacement text.
133 * <p>This method returns the node which received the replacement text.
134 * The returned node is:</p>
135 * <ul>
136 * <li><code>null</code>, when the replacement text is
137 * the empty string;
138 * </li>
139 * <li>the current node, except when the current node is
140 * read-only;
141 * </li>
142 * <li> a new <code>Text</code> node of the same type (
143 * <code>Text</code> or <code>CDATASection</code>) as the current node
144 * inserted at the location of the replacement.
162 * textual content of barTextNode with "yo"</em>
163 *
164 * <p>Where the nodes to be removed are read-only descendants of an
165 * <code>EntityReference</code>, the <code>EntityReference</code> must
166 * be removed instead of the read-only nodes. If any
167 * <code>EntityReference</code> to be removed has descendants that are
168 * not <code>EntityReference</code>, <code>Text</code>, or
169 * <code>CDATASection</code> nodes, the <code>replaceWholeText</code>
170 * method must fail before performing any modification of the document,
171 * raising a <code>DOMException</code> with the code
172 * <code>NO_MODIFICATION_ALLOWED_ERR</code>.</p>
173 * <p>For instance, in the example below calling
174 * <code>replaceWholeText</code> on the <code>Text</code> node that
175 * contains "bar" fails, because the <code>EntityReference</code> node
176 * "ent" contains an <code>Element</code> node which cannot be removed.</p>
177 * @param content The content of the replacing <code>Text</code> node.
178 * @return The <code>Text</code> node created with the specified content.
179 * @exception DOMException
180 * NO_MODIFICATION_ALLOWED_ERR: Raised if one of the <code>Text</code>
181 * nodes being replaced is readonly.
182 * @since DOM Level 3
183 */
184 public Text replaceWholeText(String content)
185 throws DOMException;
186
187 }
|
76 * node had a parent node, the new node is inserted as the next sibling
77 * of the original node. When the <code>offset</code> is equal to the
78 * length of this node, the new node has no data.
79 * @param offset The 16-bit unit offset at which to split, starting from
80 * <code>0</code>.
81 * @return The new node, of the same type as this node.
82 * @exception DOMException
83 * INDEX_SIZE_ERR: Raised if the specified offset is negative or greater
84 * than the number of 16-bit units in <code>data</code>.
85 * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
86 */
87 public Text splitText(int offset)
88 throws DOMException;
89
90 /**
91 * Returns whether this text node contains <a href='http://www.w3.org/TR/2004/REC-xml-infoset-20040204#infoitem.character'>
92 * element content whitespace</a>, often abusively called "ignorable whitespace". The text node is
93 * determined to contain whitespace in element content during the load
94 * of the document or if validation occurs while using
95 * <code>Document.normalizeDocument()</code>.
96 * @since 1.5, DOM Level 3
97 */
98 public boolean isElementContentWhitespace();
99
100 /**
101 * Returns all text of <code>Text</code> nodes logically-adjacent text
102 * nodes to this node, concatenated in document order.
103 * <br>For instance, in the example below <code>wholeText</code> on the
104 * <code>Text</code> node that contains "bar" returns "barfoo", while on
105 * the <code>Text</code> node that contains "foo" it returns "barfoo".
106 *
107 * <pre>
108 * +-----+
109 * | <p> |
110 * +-----+
111 * /\
112 * / \
113 * /-----\ +-------+
114 * | bar | | &ent; |
115 * \-----/ +-------+
116 * |
117 * |
118 * /-----\
119 * | foo |
120 * \-----/
121 * </pre>
122 * <em>Figure: barTextNode.wholeText value is "barfoo"</em>
123 *
124 * @since 1.5, DOM Level 3
125 */
126 public String getWholeText();
127
128 /**
129 * Replaces the text of the current node and all logically-adjacent text
130 * nodes with the specified text. All logically-adjacent text nodes are
131 * removed including the current node unless it was the recipient of the
132 * replacement text.
133 * <p>This method returns the node which received the replacement text.
134 * The returned node is:</p>
135 * <ul>
136 * <li><code>null</code>, when the replacement text is
137 * the empty string;
138 * </li>
139 * <li>the current node, except when the current node is
140 * read-only;
141 * </li>
142 * <li> a new <code>Text</code> node of the same type (
143 * <code>Text</code> or <code>CDATASection</code>) as the current node
144 * inserted at the location of the replacement.
162 * textual content of barTextNode with "yo"</em>
163 *
164 * <p>Where the nodes to be removed are read-only descendants of an
165 * <code>EntityReference</code>, the <code>EntityReference</code> must
166 * be removed instead of the read-only nodes. If any
167 * <code>EntityReference</code> to be removed has descendants that are
168 * not <code>EntityReference</code>, <code>Text</code>, or
169 * <code>CDATASection</code> nodes, the <code>replaceWholeText</code>
170 * method must fail before performing any modification of the document,
171 * raising a <code>DOMException</code> with the code
172 * <code>NO_MODIFICATION_ALLOWED_ERR</code>.</p>
173 * <p>For instance, in the example below calling
174 * <code>replaceWholeText</code> on the <code>Text</code> node that
175 * contains "bar" fails, because the <code>EntityReference</code> node
176 * "ent" contains an <code>Element</code> node which cannot be removed.</p>
177 * @param content The content of the replacing <code>Text</code> node.
178 * @return The <code>Text</code> node created with the specified content.
179 * @exception DOMException
180 * NO_MODIFICATION_ALLOWED_ERR: Raised if one of the <code>Text</code>
181 * nodes being replaced is readonly.
182 * @since 1.5, DOM Level 3
183 */
184 public Text replaceWholeText(String content)
185 throws DOMException;
186
187 }
|