Skip Headers

Oracle® XML API Reference 10g Release 1 (10.1) Part No. B10789-01 |
| Contents

## CharacterDataRef Interface

Table 15-4 summarizes the methods of available through `CharacterDataRef` interface.

Table 15-4 Summary of CharacterDataRef Methods; Dom Package

Function | Summary
--- | ---
appendData | Append data to end of node's current data.
deleteData | Remove part of node's data.
freeString | Deallocate the string allocated by `substringData`.
getData | Return node's data.
getLength | Return length of node's data.
insertData | Insert string into node's current data.
replaceData | Replace part of node's data.
setData | Set node's data.
substringData | Get substring of node's data.

### appendData

Append a string to the end of a `CharacterData` node's data. The appended data should be in the data encoding. It will not be verified, converted, or checked.

Syntax

    void appendData(
       oratext* data)
    throw (DOMException);

Parameter | Description
--- | ---
    data
| data to append

### deleteData

Remove a range of characters from a `CharacterData` node's data. The offset is zero-based, so offset zero refers to the start of the data. Both offset and count are in characters, not bytes. If the sum of offset and count exceeds the data length then all characters from offset to the end of the data are deleted.

Syntax

    void deleteData(
       ub4 offset,
       ub4 count)
    throw (DOMException);

Parameter | Description
--- | ---
    offset
| character offset where deletion starts
    count
| number of characters to delete

### freeString

Deallocates the string allocated by substringData(). It is Oracle's extension.

Syntax

    void freeString(
       oratext* str);

Parameter | Description
--- | ---
    str
| string

### getData

Returns the data for a `CharacterData` node (type text, comment or CDATA) in the data encoding.

Syntax

    oratext* getData() const;

Returns

`(oratext*)` node's data

### getLength

Returns the length of the data for a `CharacterData` node (type `Text`, `Comment` or `CDATA`) in characters (not bytes).

Syntax

    ub4 getLength() const;

Returns

`(ub4)` length in characters (not bytes!) of node's data

### insertData

Insert a string into a `CharacterData` node's data at the specified position. The inserted data must be in the data encoding. It will not be verified, converted, or checked. The offset is specified as characters, not bytes. The offset is zero-based, so inserting at offset zero prepends the data.

Syntax

    void insertData(
       ub4 offset,
       oratext* data)
    throw (DOMException);

Parameter | Description
--- | ---
    offset
| character offset where insertion starts
    data
| data to insert

### replaceData

Replaces a range of characters in a `CharacterData` node's data with a new string. The offset is zero-based, so offset zero refers to the start of the data. The replacement data must be in the data encoding. It will not be verified, converted, or checked. The offset and count are both in characters, not bytes. If the sum of offset and count exceeds length, then all characters to the end of the data are replaced.

Syntax

    void replaceData(
       ub4 offset,
       ub4 count,
       oratext* data)
    throw (DOMException);

Parameter | Description
--- | ---
    offset
| offset
    count
| number of characters to replace
    data
| data

### setData

Sets data for a `CharacterData` node (type text, comment or CDATA), replacing the old data. The new data is not verified, converted, or checked -- it should be in the data encoding.

Syntax

    void setData(
       oratext* data)
    throw (DOMException);

Parameter | Description
--- | ---
    data
| data

### substringData

Returns a range of character data from a `CharacterData` node (type `Text`, `Comment` or `CDATA`). Since the data is in the data encoding, offset and count are in characters, not bytes. The beginning of the string is offset 0. If the sum of offset and count exceeds the length, then all characters to the end of the data are returned. The substring is permanently allocated in the context managed memory and should be explicitly deallocated by `freeString`

Syntax

    oratext* substringData(
       ub4 offset,
       ub4 count)
    throw (DOMException);

Parameter | Description
--- | ---
    offset
| offset
    count
| number of characters to extract

Returns

`(oratext *)` specified substring