OracleJavaScript API Reference for Oracle ADF Faces

 

SUMMARY: FIELD | CONSTR | METHOD    DETAIL: FIELD | CONSTR | METHOD

org.w3c.dom.core
Class CharacterData

org.ecmascript.object.Object
   |
   +--org.w3c.dom.core.Node
         |
         +--org.w3c.dom.core.CharacterData
Direct Known Subclasses:
Comment, Text

public abstract class CharacterData
extends Node
The CharacterData interface extends Node with a set of attributes and methods for accessing character data in the DOM. For clarity this set is defined here rather than on each object that uses these attributes and methods. No DOM objects correspond directly to CharacterData, though Text and others do inherit the interface from it. All offsets in this interface start from 0.

As explained in the String interface, text strings in the DOM are represented in UTF-16, i.e. as a sequence of 16-bit units. In the following, the term 16-bit units is used whenever necessary to indicate that indexing on CharacterData is done in 16-bit units.

Note that this object is implemented and supported by the web browser and results of its use may vary.



Field Summary

public String
data
The character data of the node that implements this interface.
public Number
length
The number of 16-bit units that are available through the data attribute and the substringData() method.


Fields inherited from org.w3c.dom.core.Node

ATTRIBUTE_NODE, attributes, CDATA_SECTION_NODE, childNodes, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, firstChild, lastChild, localName, namespaceURI, nextSibling, nodeName, nodeType, nodeValue, NOTATION_NODE, ownerDocument, parentNode, prefix, previousSibling, PROCESSING_INSTRUCTION_NODE, TEXT_NODE


Fields inherited from org.ecmascript.object.Object

constructor, prototype


Method Summary

public void
appendData(String arg)
Append the string to the end of the character data of the node.
public void
deleteData(Number offset, Number count)
Remove a range of 16-bit units from the node.
public void
insertData(Number offset, Number count)
Remove a range of 16-bit units from the node.
public void
replaceData(Number offset, Number count, String arg)
Replace the characters starting at the specified 16-bit unit offset with the specified string.
public String
substringData(Number offset, Number count)
Replace the characters starting at the specified 16-bit unit offset with the specified string.


Methods inherited from org.w3c.dom.core.Node

appendChild, cloneNode, hasAttributes, hasChildNodes, insertBefore, isSupported, normalize, removeChild, replaceChild


Field Detail


data

public String data

The character data of the node that implements this interface.

JavaScript Code Example:
var txt = document.createTextNode('AAA-BBB');
var output = txt.data;

length

public Number length

The number of 16-bit units that are available through the data attribute and the substringData() method. This is a readonly attribute

JavaScript Code Example:
var txt = document.createTextNode('AAA-BBB');
var output = txt.length;

Method Detail


appendData

public void appendData(String arg)

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 DOMString specified.

JavaScript:
var txt = document.createTextNode('AAA-BBB');
txt.appendData('CCC');
var output = txt.data;

Parameters:
arg  -  The String to Append
Return:
void - null
Throws:
DOMException NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.

deleteData

public void deleteData(Number offset,
                       Number count)

Remove a range of 16-bit units from the node.

JavaScript:
var txt = document.createTextNode('AAA-BBB');
txt.deleteData(0, 4);
var output = txt.data;

Parameters:
offset  -  The offset from which to removing.
count  -  The number of 16-bit units to delete. If the sum of offset and count exceeds length then all 16-bit units from offset to the end of the data are deleted.
Return:
void - null
Throws:
DOMException INDEX_SIZE_ERR: Raised if the specified offset is negative or greater than the number of 16-bit units in data, or if the specified count is negative.
DOMException NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.

insertData

public void insertData(Number offset,
                       Number count)

Remove a range of 16-bit units from the node. Upon success, data and length reflect the change.

JavaScript:
var txt = document.createTextNode('AAA-BBB');
txt.deleteData(0, 4);
var output = txt.data;

Parameters:
offset  -  The offset from which to removing.
count  -  The number of 16-bit units to delete. If the sum of offset and count exceeds length then all 16-bit units from offset to the end of the data are deleted.
Return:
void - null
Throws:
DOMException INDEX_SIZE_ERR: Raised if the specified offset is negative or greater than the number of 16-bit units in data, or if the specified count is negative.
DOMException NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.

replaceData

public void replaceData(Number offset,
                        Number count,
                        String arg)

Replace the characters starting at the specified 16-bit unit offset with the specified string.

JavaScript:
var txt = document.createTextNode('AAA-BBB');
txt.replaceData(0, 4, 'DDDD');
var output = txt.data;

Parameters:
offset  -  The offset from which to removing.
count  -  The number of 16-bit units to replace. If the sum of offset and count exceeds length, then all 16-bit units to the end of the data are replaced.
arg  -  The String with which the range must be replaced.
Return:
void - null
Throws:
DOMException INDEX_SIZE_ERR: Raised if the specified offset is negative or greater than the number of 16-bit units in data, or if the specified count is negative.
DOMException NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.

substringData

public String substringData(Number offset,
                            Number count)

Replace the characters starting at the specified 16-bit unit offset with the specified string.

JavaScript:
var txt = document.createTextNode('AAA-BBB');
txt.replaceData(0, 4, 'DDDD');
var output = txt.data;

Parameters:
offset  -  The offset from which to extract.
count  -  The number of 16-bit units to extract.
Return:
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.
Throws:
DOMException INDEX_SIZE_ERR: Raised if the specified offset is negative or greater than the number of 16-bit units in data, or if the specified count is negative.
DOMException NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.

SUMMARY: FIELD | CONSTR | METHOD    DETAIL: FIELD | CONSTR | METHOD

 

Generated on 2010.03.26 00:15 UTC
Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.