Clone – PB Docs 126

PBDOM_CHARACTERDATA:

Clone method

Description

Creates
and returns a clone of the current PBDOM_CHARACTERDATA.

Syntax

Argument

Description

pbdom_chardata_name

The name of a PBDOM_CHARACTERDATA.

bDeep

A boolean specifying whether a deep or
shallow clone is returned. Values are true for
a deep clone and false for a shallow clone. This
argument is currently ignored.

Return Values

PBDOM_OBJECT.

Throws

EXCEPTION_PBDOM_OBJECT_INVALID_FOR_USE – If
this PBDOM_CHARACTERDATA is not a reference to an object
derived from PBDOM_CHARACTERDATA.

Examples

This example creates a PBDOM_DOCUMENT based
on the following DOM tree:

The PowerScript code obtains the data element of the root
element as a PBDM_ELEMENT and obtains an array of its children.
The array has only one item, the PBDOM_TEXT containing
the string “data”:

This PBDOM_TEXT is assigned into a PBDOM_CHARACTERDATA object, pbdom_chardata_1.
Calling GetObjectClassString on pbdom_chardata_1 returns
the class name of the actual object contained within it, pbdom_text. Calling GetText on
it returns the string Data:

Calling Clone on pbdom_chardata_1 creates
a new PBDOM_CHARACTERDATA object. However, because the
actual object referenced by pbdom_chardata_1 is
a PBDOM_TEXT, the clone is a PBDOM_TEXT object.Calling GetObjectClassString and GetText on
the clone have the same result as for pbdom_chardata_1.
The clone and the original object are separate objects and a call
to Equals returns false:

However, a call to Equals returns true if
the object being compared to pbdom_chardata_1 is
a reference to pbdom_chardata_1:

Usage

The Clone method creates a new PBDOM_CHARACTERDATA
object which is a duplicate of, and a separate object from, the
original. Calling Equals using these two objects
returns false.

The clone of a PBDOM_CHARACTERDATA object is always
identical to its original whether bDeep is true or false, because
a PBDOM_CHARACTERDATA object contains no subtree of child PBDOM_OBJECTs.A
PBDOM_CHARACTERDATA clone has no parent, but it resides
in the same PBDOM_DOCUMENT as its original, and if the
original PBDOM_CHARACTERDATA is standalone, the clone is
standalone.


Document get from Powerbuilder help
Thank you for watching.
Was this article helpful?
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x