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