http://xml.apache.org/http://www.apache.org/http://www.w3.org/

Home

Readme
Installation
Build

API Docs
Samples
Programming
Migration
FAQs

Releases
Feedback
Bug-Todo

Download
CVS Repository
Mail Archive

API Docs for SAX and DOM
 

Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

DOM_CharacterData Class Reference

The DOM_CharacterData interface extends Node with a set of methods for accessing character data in the DOM. More...

#include <DOM_CharacterData.hpp>

Inheritance diagram for DOM_CharacterData

Inheritance graph
[legend]
Collaboration diagram for DOM_CharacterData:

Collaboration graph
[legend]
List of all members.

Public Methods

Constructors and assignment operator
 DOM_CharacterData ()
 Default constructor for DOM_CharacterData. More...

 DOM_CharacterData (const DOM_CharacterData &other)
 Copy constructor. More...

DOM_CharacterData& operator= (const DOM_CharacterData &other)
 Assignment operator. More...

DOM_CharacterData& operator= (const DOM_NullPtr *val)
 Assignment operator. More...

Destructor.
 ~DOM_CharacterData ()
 Destructor for DOM_CharacterData. More...

Getter functions.
DOMString getData () const
 Returns the character data of the node that implements this interface. More...

unsigned int getLength () const
 Returns the number of characters that are available through data and the substringData method below. More...

DOMString substringData (unsigned int offset, unsigned int count) const
 Extracts a range of data from the node. More...

Functions that set or change data.
void appendData (const DOMString &arg)
 Append the string to the end of the character data of the node. More...

void insertData (unsigned int offset, const DOMString &arg)
 Insert a string at the specified character offset. More...

void deleteData (unsigned int offset, unsigned int count)
 Remove a range of characters from the node. More...

void replaceData (unsigned int offset, unsigned int count, const DOMString &arg)
 Replace the characters starting at the specified character offset with the specified string. More...

void setData (const DOMString &data)
 Sets the character data of the node that implements this interface. More...


Protected Methods

 DOM_CharacterData (CharacterDataImpl *impl)

Detailed Description

The DOM_CharacterData interface extends Node with a set of methods for accessing character data in the DOM.

For clarity this set is defined here rather than on each class that uses these 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, and index in terms of Unicode 16 bit storage units.


Constructor & Destructor Documentation

DOM_CharacterData::DOM_CharacterData ( )
 

Default constructor for DOM_CharacterData.

While there can be no actual DOM nodes of type CharacterData, the C++ objects function more like reference variables, and instances of DOM_CharacterData can exist. They will be null when created by this constructor, and can then be assigned to refer to Text or CDATASection nodes.

DOM_CharacterData::DOM_CharacterData ( const DOM_CharacterData & other )
 

Copy constructor.

Parameters:
other   The object to be copied

DOM_CharacterData::~DOM_CharacterData ( )
 

Destructor for DOM_CharacterData.

The object being destroyed is the reference to the Character Data node, not the character data itself.

DOM_CharacterData::DOM_CharacterData ( CharacterDataImpl * impl ) [protected]
 


Member Function Documentation

void DOM_CharacterData::appendData ( const DOMString & 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.

Parameters:
arg   The DOMString to append.
Exceptions:
DOMException   NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.

void DOM_CharacterData::deleteData ( unsigned int offset,
unsigned int count )
 

Remove a range of characters from the node.

Upon success, data and length reflect the change.

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

DOMString DOM_CharacterData::getData ( ) const
 

Returns the character data of the node that implements this interface.

The DOM implementation may not put arbitrary limits on the amount of data that may be stored in a CharacterData node. However, implementation limits may mean that the entirety of a node's data may not fit into a single DOMString. In such cases, the user may call substringData to retrieve the data in appropriately sized pieces.

Exceptions:
DOMException   NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
DOMException   DOMSTRING_SIZE_ERR: Raised when it would return more characters than fit in a DOMString variable on the implementation platform.

unsigned int DOM_CharacterData::getLength ( ) const
 

Returns the number of characters that are available through data and the substringData method below.

This may have the value zero, i.e., CharacterData nodes may be empty.

void DOM_CharacterData::insertData ( unsigned int offset,
const DOMString & arg )
 

Insert a string at the specified character offset.

Parameters:
offset   The character offset at which to insert.
arg   The DOMString to insert.
Exceptions:
DOMException   INDEX_SIZE_ERR: Raised if the specified offset is negative or greater than the number of characters in data.
NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.

DOM_CharacterData & DOM_CharacterData::operator= ( const DOM_NullPtr * val )
 

Assignment operator.

This overloaded variant is provided for the sole purpose of setting a DOM_Node reference variable to zero. Nulling out a reference variable in this way will decrement the reference count on the underlying Node object that the variable formerly referenced. This effect is normally obtained when reference variable goes out of scope, but zeroing them can be useful for global instances, or for local instances that will remain in scope for an extended time, when the storage belonging to the underlying node needs to be reclaimed.

Parameters:
val.   Only a value of 0, or null, is allowed.

Reimplemented from DOM_Node.

Reimplemented in DOM_CDATASection, DOM_Comment, and DOM_Text.

DOM_CharacterData & DOM_CharacterData::operator= ( const DOM_CharacterData & other )
 

Assignment operator.

Parameters:
other   The object to be copied

void DOM_CharacterData::replaceData ( unsigned int offset,
unsigned int count,
const DOMString & arg )
 

Replace the characters starting at the specified character offset with the specified string.

Parameters:
offset   The offset from which to start replacing.
count   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   The DOMString with which the range must be replaced.
Exceptions:
DOMException   INDEX_SIZE_ERR: Raised if the specified offset is negative or greater than the number of characters in data, or if the specified count is negative.
NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.

void DOM_CharacterData::setData ( const DOMString & data )
 

Sets the character data of the node that implements this interface.

Parameters:
data   The DOMString to set.

DOMString DOM_CharacterData::substringData ( unsigned int offset,
unsigned int count ) const
 

Extracts a range of data from the node.

Parameters:
offset   Start offset of substring to extract.
count   The number of characters to extract.
Returns:
The specified substring. If the sum of offset and count exceeds the length, then all characters to the end of the data are returned.
Exceptions:
DOMException   INDEX_SIZE_ERR: Raised if the specified offset is negative or greater than the number of characters in data, or if the specified count is negative.
DOMSTRING_SIZE_ERR: Raised if the specified range of text does not fit into a DOMString.


The documentation for this class was generated from the following file:


Copyright © 2000 The Apache Software Foundation. All Rights Reserved.