|
1 =head1 NAME |
|
2 |
|
3 XML::DOM::CharacterData - Common interface for Text, CDATASections and Comments |
|
4 |
|
5 =head1 DESCRIPTION |
|
6 |
|
7 XML::DOM::CharacterData extends L<XML::DOM::Node> |
|
8 |
|
9 The CharacterData interface extends Node with a set of attributes and |
|
10 methods for accessing character data in the DOM. For clarity this set |
|
11 is defined here rather than on each object that uses these attributes |
|
12 and methods. No DOM objects correspond directly to CharacterData, |
|
13 though Text, Comment and CDATASection do inherit the interface from it. |
|
14 All offsets in this interface start from 0. |
|
15 |
|
16 =head2 METHODS |
|
17 |
|
18 =over 4 |
|
19 |
|
20 =item getData and setData (data) |
|
21 |
|
22 The character data of the node that implements this |
|
23 interface. The DOM implementation may not put arbitrary |
|
24 limits on the amount of data that may be stored in a |
|
25 CharacterData node. However, implementation limits may mean |
|
26 that the entirety of a node's data may not fit into a single |
|
27 DOMString. In such cases, the user may call substringData to |
|
28 retrieve the data in appropriately sized pieces. |
|
29 |
|
30 =item getLength |
|
31 |
|
32 The number of characters that are available through data and |
|
33 the substringData method below. This may have the value zero, |
|
34 i.e., CharacterData nodes may be empty. |
|
35 |
|
36 =item substringData (offset, count) |
|
37 |
|
38 Extracts a range of data from the node. |
|
39 |
|
40 Parameters: |
|
41 I<offset> Start offset of substring to extract. |
|
42 I<count> The number of characters to extract. |
|
43 |
|
44 Return Value: The specified substring. If the sum of offset and count |
|
45 exceeds the length, then all characters to the end of |
|
46 the data are returned. |
|
47 |
|
48 =item appendData (str) |
|
49 |
|
50 Appends the string to the end of the character data of the |
|
51 node. Upon success, data provides access to the concatenation |
|
52 of data and the DOMString specified. |
|
53 |
|
54 =item insertData (offset, arg) |
|
55 |
|
56 Inserts a string at the specified character offset. |
|
57 |
|
58 Parameters: |
|
59 I<offset> The character offset at which to insert. |
|
60 I<arg> The DOMString to insert. |
|
61 |
|
62 =item deleteData (offset, count) |
|
63 |
|
64 Removes a range of characters from the node. |
|
65 Upon success, data and length reflect the change. |
|
66 If the sum of offset and count exceeds length then all characters |
|
67 from offset to the end of the data are deleted. |
|
68 |
|
69 Parameters: |
|
70 I<offset> The offset from which to remove characters. |
|
71 I<count> The number of characters to delete. |
|
72 |
|
73 =item replaceData (offset, count, arg) |
|
74 |
|
75 Replaces the characters starting at the specified character |
|
76 offset with the specified string. |
|
77 |
|
78 Parameters: |
|
79 I<offset> The offset from which to start replacing. |
|
80 I<count> The number of characters to replace. |
|
81 I<arg> The DOMString with which the range must be replaced. |
|
82 |
|
83 If the sum of offset and count exceeds length, then all characters to the end of |
|
84 the data are replaced (i.e., the effect is the same as a remove method call with |
|
85 the same range, followed by an append method invocation). |
|
86 |
|
87 =back |