1XML::DOM::Text(3) User Contributed Perl Documentation XML::DOM::Text(3)
2
3
4
6 XML::DOM::Text - A piece of XML text in XML::DOM
7
9 XML::DOM::Text extends XML::DOM::CharacterData, which extends
10 XML::DOM::Node.
11
12 The Text interface represents the textual content (termed character
13 data in XML) of an Element or Attr. If there is no markup inside an
14 element's content, the text is contained in a single object implement‐
15 ing the Text interface that is the only child of the element. If there
16 is markup, it is parsed into a list of elements and Text nodes that
17 form the list of children of the element.
18
19 When a document is first made available via the DOM, there is only one
20 Text node for each block of text. Users may create adjacent Text nodes
21 that represent the contents of a given element without any intervening
22 markup, but should be aware that there is no way to represent the sepa‐
23 rations between these nodes in XML or HTML, so they will not (in gen‐
24 eral) persist between DOM editing sessions. The normalize() method on
25 Element merges any such adjacent Text objects into a single node for
26 each block of text; this is recommended before employing operations
27 that depend on a particular document structure, such as navigation with
28 XPointers.
29
30 METHODS
31
32 splitText (offset)
33 Breaks this Text node into two Text nodes at the specified offset,
34 keeping both in the tree as siblings. This node then only contains
35 all the content up to the offset point. And a new Text node, which
36 is inserted as the next sibling of this node, contains all the con‐
37 tent at and after the offset point.
38
39 Parameters:
40 offset The offset at which to split, starting from 0.
41
42 Return Value: The new Text node.
43
44 DOMExceptions:
45
46 * INDEX_SIZE_ERR
47 Raised if the specified offset is negative or greater than the
48 number of characters in data.
49
50 * NO_MODIFICATION_ALLOWED_ERR
51 Raised if this node is readonly.
52
53
54
55perl v5.8.8 2002-02-08 XML::DOM::Text(3)