Connection Information

To perform the requested action, WordPress needs to access your web server. Please enter your FTP credentials to proceed. If you do not remember your credentials, you should contact your web host.

Connection Type

GetParentObject – PB Docs 2019 – PowerBuilder Library

GetParentObject – PB Docs 2019

GetParentObject

Description

The GetParentObject method returns the parent PBDOM_OBJECT of the
current PBDOM_CHARACTERDATA.

Syntax

Argument

Description

pbdom_chardata_name

The name of a PBDOM_CHARACTERDATA
object

Return value

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 and demonstrates how a PBDOM_CHARACTERDATA INSTANCE can be detached
from its parent:

The PowerScript code obtains the root element, uses it to obtain
the child element, and then obtains an array of the child element’s own
children. This array has a single item, the PBDOM_TEXT object with the
text Data. The array can be cast to a PBDOM_CHARACTERDATA object,
because it does not contain any objects that are not derived from
PBDOM_CHARACTERDATA.

The parent of pbdom_chardata_1 is the data element. The following
steps detach it from its parent:

  • Create a PBDOM_COMMENT in the PBDOM_CHARACTERDATA object
    pbdom_chardata_2 and assign to it the text “Some Comments”.

  • Set pbdom_chardata_2 as an array item of
    pbdom_obj_array.

  • Call SetContent on the parent of pbdom_chardata_1 (the
    data element).

Calling SetContent resets the contents of data, which can cause
its original contents (including pbdom_chardata_1) to be removed,
depending on what is stored inside pbdom_obj_array. Because
pbdom_obj_array contains only the newly created PBDOM_COMMENT,
pbdom_chardata_2, data will have only this PBDOM_COMMENT as its
child.

pbdom_chardata_1 will have no parent, because it has been silently
detached from it. Calling GetParentObject on it will return null:

When the resulting PBDOM_DOCUMENT is saved to a file, it looks
like this:

Usage

The parent is also an object derived from PBDOM_CHARACTERDATA. If
the PBDOM_OBJECT has no parent, null is returned.

See also

SetParentObject


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