* Copyright (c) 2004 World Wide Web Consortium,
* (Massachusetts Institute of Technology, European Research Consortium for
* Informatics and Mathematics, Keio University). All Rights Reserved. This
* work is distributed under the W3C(r) Software License  in the hope that
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*  http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
Textinterface inherits from
CharacterDataand represents the textual content (termed in XML) of an
Attr. If there is no markup inside an element's content, the text is contained in a single object implementing the
Textinterface that is the only child of the element. If there is markup, it is parsed into the information items (elements, comments, etc.) and
Textnodes that form the list of children of the element.
When a document is first made available via the DOM, there is only one
Text node for each block of text. Users may create adjacent
Text nodes that represent the contents of a given element
without any intervening markup, but should be aware that there is no way
to represent the separations between these nodes in XML or HTML, so they
will not (in general) persist between DOM editing sessions. The
Node.normalize() method merges any such adjacent
Text objects into a single node for each block of text.
No lexical check is done on the content of a
and, depending on its position in the document, some characters must be
escaped during serialization using character references; e.g. the
characters "<&" if the textual content is part of an element or of
an attribute, the character sequence "]]>" when part of an element,
the quotation mark character " or the apostrophe character ' when part of
See also the.
offset, keeping both in the tree as siblings. After being split, this node will contain all the content up to the
offsetpoint. A new node of the same type, which contains all the content at and after the
offsetpoint, is returned. If the original node had a parent node, the new node is inserted as the next sibling of the original node. When the
offsetis equal to the length of this node, the new node has no data.
offsetThe 16-bit unit offset at which to split, starting from
org.w3c.dom.DOMExceptionINDEX_SIZE_ERR: Raised if the specified offset is negative or greater than the number of 16-bit units in
null, when the replacement text is the empty string;
Textnode of the same type (
CDATASection) as the current node inserted at the location of the replacement.
Textnode that contains "bar" with "yo" in argument results in the following:
EntityReferencemust be removed instead of the read-only nodes. If any
EntityReferenceto be removed has descendants that are not
replaceWholeTextmethod must fail before performing any modification of the document, raising a
DOMExceptionwith the code
Textnode that contains "bar" fails, because the
EntityReferencenode "ent" contains an
Elementnode which cannot be removed.
contentThe content of the replacing
Textnode created with the specified content.
org.w3c.dom.DOMExceptionNO_MODIFICATION_ALLOWED_ERR: Raised if one of the
Textnodes being replaced is readonly.