# Titanium.XML.CharacterData
An interface extending Titanium.XML.Node with a set of attributes and methods for accessing character data in the DOM. Implements the DOM Level 2 API on Android and iOS. For reasons of compatibility with the javascript engine, text is represented by UTF-8 instead of UTF-16 on Android and iOS.
# Properties
# data
The character data of the node that implements this interface. Throws an exception during setting if this node is readonly.
# length READONLY
The number of characters that are available through data and the substringData method. This may have the value zero, i.e., Titanium.XML.CharacterData may be empty.
# Methods
# appendData
Append the string to the end of the character data of the node. Upon success, data provides access to the concatenation of data and the string specified. Throws an exception if this node is readonly.
Parameters
Name | Type | Description |
---|---|---|
arg | String | The string to append. |
Returns
- Type
- void
# deleteData
Remove a range of characters from the node. Upon success, data and length reflect the change. Throws an exception if this node is readonly, if offset is negative, offset is beyond the data's length, or if count is negative.
Parameters
Name | Type | Description |
---|---|---|
offset | Number | The offset from which to start removing. |
count | Number | The number of characters to delete. If the sum of offset and count exceeds length then all characters from offset to the end of the data are deleted. |
Returns
- Type
- void
# insertData
Insert a string at the specified offset. Throws an exception if this node is readonly, if offset is negative, or if offset is beyond the data's length.
Parameters
Name | Type | Description |
---|---|---|
offset | Number | The character offset at which to insert. |
arg | String | The string to insert. |
Returns
- Type
- void
# replaceData
Replace the characters starting at the specified offset with the specified string. Throws an exception if this node is readonly, if offset is negative, offset is beyond the data's length, or if count is negative.
Parameters
Name | Type | Description |
---|---|---|
offset | Number | The offset from which to start replacing. |
count | Number | The number of characters to replace. If the sum of offset and count exceeds length, then all characters to the end of the data are replaced; (i.e., the effect is the same as a remove method call with the same range, followed by an append method invocation). |
arg | String | The string with which the range must be replaced. |
Returns
- Type
- void
# substringData
Extracts a range of data from the node. Throws an exception if offset is negative, offset is beyond the data's length, or if count is negative.
Parameters
Name | Type | Description |
---|---|---|
offset | Number | Start offset of substring to extract. |
count | Number | The number of characters units to extract. |
Returns
The specified substring. If the sum of offset and count exceeds the length, then all 16-bit units to the end of the data are returned.
- Type
- String