pdk.flow.xml.XmlCharacterData
contains functions to operate with XML CharacterData variables
This functions are based on Java org.w3c.dom
package classes.
https://docs.oracle.com/en/java/javase/11/docs/api/java.xml/org/w3c/dom/package-summary.html
You can always rely on Java documentation and examples!
You can use functions from the pdk.floe.xml.XmlNode package for variables of type CharacterData, as the pdk.net.xml.CharacterData structure extends the pdk.net.xml.Node.
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.
All functions
appendData
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.
Arguments:
characterData :: pdk.net.xml.CharacterData
arg :: pdk.core.String
Result:
No variable is returned. The input characterData has arg data.
Possible exceptions
NullPointerException - throws if the input characterData or arg is
NULL
DOMException -
NO_MODIFICATION_ALLOWED_ERR
: Raised if this node is readonly
Example:
XML Document
deleteData
Removes a range of 16-bit units from the node. Upon success, data
and length
reflect the change.
Arguments:
characterData :: pdk.net.xml.CharacterData
offset :: pdk.core.Integer - The offset from which to start removing.
limit :: pdk.core.Integer - The number of 16-bit units to delete. If the sum of
offset
andcount
exceedslength
then all 16-bit units fromoffset
to the end of the data are deleted.
Result:
No variable is returned. The input characterData has updated value.
Possible exceptions
NullPointerException - throws if the input characterData or offset or limit is
NULL
DOMException -
NO_MODIFICATION_ALLOWED_ERR
: Raised if this node is readonly
Example:
XML Document
getData
The character data of the node. 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.
Arguments:
characterData :: pdk.net.xml.CharacterData
Result:
output :: pdk.core.String
Possible exceptions
NullPointerException - throws if the input characterData is
NULL
DOMException -
DOMSTRING_SIZE_ERR
: Raised when it would return more characters than fit in aDOMString
variable on the implementation platform.
Example:
XML Document
getLength
The number of 16-bit units that are available through data
and the substringData
functions below. This may have the value zero, i.e., CharacterData nodes may be empty.
Arguments:
characterData :: pdk.net.xml.CharacterData
Result:
output :: pdk.core.Integer
Possible exceptions
NullPointerException - throws if the input characterData is
NULL
Example:
XML Document
insertData
Insert a string at the specified 16-bit unit offset.
Arguments:
characterData :: pdk.net.xml.CharacterData
offset :: pdk.core.Integer - The character offset at which to insert.
arg :: pdk.core.String - The
DOMString
to insert.
Result:
No variable is returned. The input characterData has updated value.
Possible exceptions
NullPointerException - throws if the input characterData or offset or arg is
NULL
DOMException -
INDEX_SIZE_ERR
: Raised if the specifiedoffset
is negative or greater than the number of 16-bit units indata
.NO_MODIFICATION_ALLOWED_ERR
: Raised if this node is readonly.
Example:
XML Document
replaceData
Replace the characters starting at the specified 16-bit unit offset with the specified string.
Arguments:
characterData :: pdk.net.xml.CharacterData
offset :: pdk.core.Integer - The offset from which to start replacing.
count :: pdk.core.Integer - The number of 16-bit units to replace. If the sum of
offset
andcount
exceedslength
, then all 16-bit units to the end of the data are replaced; (i.e., the effect is the same as aremove
function call with the same range, followed by an appendData function invocation).arg :: pdk.core.String - The
DOMString
with which the range must be replaced.
Result:
No variable is returned. The input characterData has updated value.
Possible exceptions
NullPointerException - throws if the input characterData or offset or arg is
NULL
DOMException -
INDEX_SIZE_ERR
: Raised if the specifiedoffset
is negative or greater than the number of 16-bit units indata
, or if the specifiedcount
is negative.NO_MODIFICATION_ALLOWED_ERR
: Raised if this node is readonly.
Example:
XML Document
setData
Sets 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.
Arguments:
characterData :: pdk.net.xml.CharacterData
data :: pdk.core.String
Result:
No variable is returned. The input characterData has updated value.
Possible exceptions
NullPointerException - throws if the input characterData or offset or arg is
NULL
DOMException -
NO_MODIFICATION_ALLOWED_ERR
: Raised when the node is readonly.
Example:
XML Document
substringData
Extracts a range of data from the node.
Arguments:
characterData :: pdk.net.xml.CharacterData
offset :: pdk.core.Integer - Start offset of substring to extract.
count :: pdk.core.Integer - The number of 16-bit units to extract.
Result:
output :: pdk.core.String - The specified substring. If the sum of
offset
andcount
exceeds thelength
, then all 16-bit units to the end of the data are returned.
Possible exceptions
NullPointerException - throws if the input characterData or offset or arg is
NULL
DOMException -
INDEX_SIZE_ERR
: Raised if the specifiedoffset
is negative or greater than the number of 16-bit units indata
, or if the specifiedcount
is negative.DOMSTRING_SIZE_ERR
: Raised if the specified range of text does not fit into aDOMString
.
Example:
XML Document
Last updated