DOCUMENTS 5 - PortalScripting API
Public Member Functions | Public Attributes | List of all members
DOMCharacterData Class Reference

DOMCharacterData represents text-like nodes in the DOM tree. More...

Inheritance diagram for DOMCharacterData:
DOMNode

Public Member Functions

void appendData (String arg)
 Append some string to the text. More...
 
void deleteData (Integer offset, Integer count)
 Delete a section of the text. More...
 
void insertData (Integer offset, String arg)
 Insert some string into the text. More...
 
void replaceData (Integer offset, Integer count, String arg)
 Replace a section of the text with a new string. More...
 
DOMCharacterData splitText (Integer offset)
 Split a text node into two. More...
 
String substringData (Integer offset, Integer count)
 Extract a substring of the node's text. More...
 
- Public Member Functions inherited from DOMNode
DOMNode appendChild (DOMNode newChild)
 Append a new node to the list of child nodes. More...
 
DOMNode cloneNode (boolean deep)
 Create a duplicate of this node. More...
 
boolean hasAttributes ()
 Test, whether a node has got any associated attributes. More...
 
boolean hasChildNodes ()
 Test, whether a node has got any associated child nodes. More...
 
DOMNode insertBefore (DOMNode newChild, DOMNode refChild)
 Insert a new node into the list of child nodes. More...
 
void normalize ()
 Normalize the node ans its subtree. More...
 
DOMNode removeChild (DOMNode oldChild)
 Remove a node from the list of child nodes. More...
 
DOMNode replaceChild (DOMNode newChild, DOMNode oldChild)
 Replace a node in the list of child nodes. More...
 

Public Attributes

String data
 The text data in the node. More...
 
Integer length
 The text length in the node. More...
 
- Public Attributes inherited from DOMNode
DOMNamedNodeMap attributes
 A map of DOM attributes. If this node is not a DOMElement, the value is null. The property is readonly.
 
DOMNodeList childNodes
 A list of all children of this node. The property is readonly.
 
DOMNode firstChild
 The first child node, otherwise null. The property is readonly.
 
DOMNode lastChild
 The last child node, otherwise null. The property is readonly.
 
DOMNode nextSibling
 The next sibling node, otherwise null. The property is readonly.
 
String nodeName
 The name of this node. The property is readonly.
 
Integer nodeType
 The type or subclass of a this node, encoded as an integer. The property is readonly.
 
String nodeValue
 The value of the node, which depends on the type. More...
 
DOMDocument ownerDocument
 The document, which owns this node. The property is readonly.
 
DOMNode parentNode
 The parent node or null. The property is readonly.
 
DOMNode previousSibling
 The previous sibling node, otherwise null. The property is readonly.
 
Integer ELEMENT_NODE
 Constant for the nodeType "Element". The actual subclass is DOMElement.
 
Integer ATTRIBUTE_NODE
 Constant for the nodeType "Attr". The actual subclass is DOMAttr.
 
Integer TEXT_NODE
 Constant for the nodeType "Text". The actual subclass is DOMCharacterData, differing from the standard.
 
Integer CDATA_SECTION_NODE
 Constant for the nodeType "CDATASection". The actual subclass is DOMCharacterData, differing from the standard.
 
Integer ENTITY_REFERENCE_NODE
 Constant for the nodeType "EntityReference". The actual implementation does not provide a subclass for this type.
 
Integer ENTITY_NODE
 Constant for the nodeType "Entity". The actual implementation does not provide a subclass for this type.
 
Integer PROCESSING_INSTRUCTION_NODE
 Constant for the nodeType "ProcessingInstruction". The actual implementation does not provide a subclass for this type.
 
Integer COMMENT_NODE
 Constant for the nodeType "Comment". The actual subclass is DOMCharacterData, differing from the standard.
 
Integer DOCUMENT_NODE
 Constant for the nodeType "Document". The actual subclass is DOMDocument.
 
Integer DOCUMENT_TYPE_NODE
 Constant for the nodeType "DocumentType". The actual implementation does not provide a subclass for this type.
 
Integer DOCUMENT_FRAGMENT_NODE
 Constant for the nodeType "DocumentFragment". The actual implementation does not provide a subclass for this type.
 
Integer NOTATION_NODE
 Constant for the nodeType "Notation". The actual implementation does not provide a subclass for this type.
 

Detailed Description

DOMCharacterData represents text-like nodes in the DOM tree.

An object of this class can represent either a text node, a comment node or a CDATA section. Scripts should use the inherited nodeType attribute to distinguish these node types.

Remarks about W3C conformity
The class covers the CharacterData interface of DOM level 1. The underlying native library already supports at least level 2. The W3C has defined several derived interfaces, namely "Text", "Comment" and "CDATASection". With respect to code size (and work) this API omits the corresponding subclasses "DOMText", "DOMComment" and "DOMCDATASection". The only additional method "DOMText.splitText()" has been moved into this class.
This simplification has got only one little disadvantage. Scripts cannot distinguish the three node types using the JavaScript instanceof operator. They must use the nodeType attribute instead.

Since
DOCUMENTS 4.0c

Member Function Documentation

◆ appendData()

void DOMCharacterData::appendData ( String  arg)

Append some string to the text.

Parameters
argThe string to append.
Exceptions
DOMException
Since
DOCUMENTS 4.0c

◆ deleteData()

void DOMCharacterData::deleteData ( Integer  offset,
Integer  count 
)

Delete a section of the text.

Parameters
offsetThe zero-based position of the first character to delete.
countThe number of characters to delete.
Exceptions
DOMException
Since
DOCUMENTS 4.0c

◆ insertData()

void DOMCharacterData::insertData ( Integer  offset,
String  arg 
)

Insert some string into the text.

Parameters
offsetA zero-based position. On return, the inserted string will begin here.
argThe string to insert.
Exceptions
DOMException
Since
DOCUMENTS 4.0c

◆ replaceData()

void DOMCharacterData::replaceData ( Integer  offset,
Integer  count,
String  arg 
)

Replace a section of the text with a new string.

Parameters
offsetThe zero-based position of the first character to be replaced.
countThe number of characters to replace.
argThe string replacing the old one.
Exceptions
DOMException
Since
DOCUMENTS 4.0c

◆ splitText()

DOMCharacterData DOMCharacterData::splitText ( Integer  offset)

Split a text node into two.

The new node becomes the next sibling of this node in the tree, and it has got the same nodeType.

Parameters
offsetThe zero-based index of the character, which will become the first character of the new node.
Returns
The new text node.
Exceptions
DOMException
Note
Future releases of the API may expose this method only in a new subclass DOMText. See also the W3C conformity remarks in the class description. If a script calls this method on a "Comment" node. it will trigger a JavaScript error, because "Comment" is not derived from "Text" in the standard API.
Since
DOCUMENTS 4.0c

◆ substringData()

String DOMCharacterData::substringData ( Integer  offset,
Integer  count 
)

Extract a substring of the node's text.

Parameters
offsetThe zero-based index of the first character to extract.
countThe number of characters to extract.
Returns
The requested substring.
Exceptions
DOMException
Since
DOCUMENTS 4.0c

Member Data Documentation

◆ data

String DOMCharacterData::data

The text data in the node.

Exceptions
DOMException
Since
DOCUMENTS 4.0c

◆ length

Integer DOMCharacterData::length

The text length in the node.

This property is readonly.

Since
DOCUMENTS 4.0c

This documentation refers DOCUMENTS 5.0e (2105).
Created at 11-09-2019. - © 1998-2019 otris software AG, Königswall 21, D-44137 Dortmund. support@otris.de