Skip to content
Titanium SDK
Version12.6.2

You are reading 12.6.2. See this page in 13.4.1.

Titanium.XML.CharacterData

proxyAndroidiPhoneiPadmacOSsince Android 0.9, iPhone 0.9, iPad 0.9, macOS 9.2.0

Extends Titanium.XML.NodeTitanium.Proxy

Extended by Titanium.XML.CommentTitanium.XML.Text

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 33

apiName

Stringsince Android 3.2.0, iPhone 3.2.0, iPad 3.2.0, macOS 9.2.0read-only

Inherited from Titanium.Proxy

The name of the API that this proxy corresponds to.

bubbleParent

Booleansince Android 3.0.0, iPhone 3.0.0, iPad 3.0.0, macOS 9.2.0

Inherited from Titanium.Proxy

Indicates if the proxy will bubble an event to its parent.

Default: true

data

String

The character data of the node that implements this interface. Throws an exception during setting if this node is readonly.

length

Numberread-only

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.

nodeType

Numberread-only

Inherited from Titanium.XML.Node

This node's type. One of ELEMENT_NODE, ATTRIBUTE_NODE, TEXT_NODE, CDATA_SECTION_NODE, ENTITY_REFERENCE_NODE, ENTITY_NODE, PROCESSING_INSTRUCTION_NODE, COMMENT_NODE, DOCUMENT_NODE, DOCUMENT_TYPE_NODE, DOCUMENT_FRAGMENT_NODE, NOTATION_NODE.

Methods 18

Inherited from Titanium.Proxy

Adds the specified callback as an event listener for the named event.

Parameters
ParametersTypeDescription
nameString

Name of the event.

callbackCallback<Titanium.Event>

Callback function to invoke when the event is fired.

4 fields
bubbles Boolean

True if the event will try to bubble up if possible.

cancelBubble Boolean

Set to true to stop the event from bubbling.

source Object

Source object that fired the event.

type String

Name of the event fired.

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
ParametersTypeDescription
argString

The string to append.

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
ParametersTypeDescription
offsetNumber

The offset from which to start removing.

countNumber

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.

Inherited from Titanium.Proxy

Fires a synthesized event to any registered listeners.

Parameters
ParametersTypeDescription
nameString

Name of the event.

event?Dictionary

A dictionary of keys and values to add to the Titanium.Event object sent to the listeners.

Inherited from Titanium.XML.Node

Returns true if this node has attributes.

Returns Boolean

True if this node has attributes, false if it does not.

Inherited from Titanium.XML.Node

Returns true if this node has child nodes.

Returns Boolean

True if this node has children, false if it does not.

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
ParametersTypeDescription
offsetNumber

The character offset at which to insert.

argString

The string to insert.

Inherited from Titanium.XML.Node

Tests whether the DOM implementation supports a specific feature.

Parameters
ParametersTypeDescription
featureString

Name of the feature.

versionString

Version number of the feature.

Returns Boolean

True if the feature is supported, false if it is not.

Inherited from Titanium.Proxy

Removes the specified callback as an event listener for the named event.

Parameters
ParametersTypeDescription
nameString

Name of the event.

callbackCallback<Titanium.Event>

Callback function to remove. Must be the same function passed to addEventListener.

4 fields
bubbles Boolean

True if the event will try to bubble up if possible.

cancelBubble Boolean

Set to true to stop the event from bubbling.

source Object

Source object that fired the event.

type String

Name of the event fired.

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
ParametersTypeDescription
offsetNumber

The offset from which to start replacing.

countNumber

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).

argString

The string with which the range must be replaced.

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
ParametersTypeDescription
offsetNumber

Start offset of substring to extract.

countNumber

The number of characters units to extract.

Returns String

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.