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

PBDOM_OBJECT – PB Docs 2021 – PowerBuilder Library

PBDOM_OBJECT – PB Docs 2021

PBDOM_OBJECT

The PBDOM_OBJECT class represents any node in an XML node tree and
serves as the base class for specialized PBDOM classes that represent
specific node types. The DOM class that corresponds to PBDOM_OBJECT is
the Node object. PBDOM_OBJECT contains all the basic features required
by derived classes. A node can be an element node, a document node, or
any of the node types listed above that derive from PBDOM_OBJECT.

Methods

The PBDOM_OBJECT base class has the following methods:

  • AddContent, GetContent, InsertContent, RemoveContent, and
    SetContent to allow you to manipulate the children of the
    PBDOM_OBJECT

  • Clone to allow you to make shallow or deep clones of the
    PBDOM_OBJECT

  • Detach to detach the PBDOM_OBJECT from its parent

  • Equals to test for equality with another PBDOM_OBJECT

  • GetName and SetName to get and set the name of the
    PBDOM_OBJECT

  • GetObjectClass and GetObjectClassString to identify the class
    of the PBDOM_OBJECT

  • GetOwnerDocumentObject to identify the owner PBDOM_DOCUMENT of
    the current PBDOM_OBJECT

  • GetParentObject and SetParentObject to get and set the parent
    of the PBDOM_OBJECT

  • GetText, GetTextNormalize, and GetTextTrim to obtain the text
    data of the PBDOM_OBJECT

  • HasChildren to determine whether the PBDOM_OBJECT has any
    children

  • IsAncestorObjectOf to determine whether the PBDOM_OBJECT is
    the ancestor of another PBDOM_OBJECT

PBDOM_OBJECT inheritance

The PBDOM_OBJECT class is similar to a virtual class in C++ in
that it is not expected to be directly instantiated and used. For
example, although a PBDOM_OBJECT can be created using the PowerScript
CREATE statement, its methods cannot be used directly:

The third line of code above throws an exception because it
attempts to directly access the SetName method for the base class
PBDOM_OBJECT. A similar implementation is valid, however, when the
SetName method is accessed from a derived class, such as
PBDOM_ELEMENT:

Using the base PBDOM_OBJECT as a
placeholder

The PBDOM_OBJECT class can be used as a placeholder for an object
of a derived class:

The instantiated PBDOM_OBJECT pbdom_obj is assigned to a
PBDOM_DOCUMENT object, which holds the return value of the
GetRootElement method. Here, pbdom_obj holds a reference to a
PBDOM_ELEMENT and can be operated on legally like any object of a class
derived from PBDOM_OBJECT.

Standalone objects

A PBDOM_OBJECT can be created as a self-contained object
independent of any document or parent PBDOM_OBJECT. Such a PBDOM_OBJECT
is known as a standalone object. For example:

pbdom_elem_1 is instantiated in the derived class PBDOM_ELEMENT
using the Create keyword. The SetName method can then be invoked from
the pbdom_elem_1 object, which is a standalone object not contained
within any document.

Standalone objects can perform any legal PBDOM operations, but
standalone status does not give the object any special advantages or
disadvantages.

Parent-owned and document-owned
objects

A PBDOM_OBJECT can be assigned a parent by appending it to another
standalone PBDOM_OBJECT, as in the following example:

Two PBDOM_ELEMENT objects, pbdom_elem_1 and pbdom_elem_2, are
instantiated. The pbdom_elem_2 object is appended as a child object of
pbdom_elem_1 using the AddContent method.

In this example, neither pbdom_elem_1 nor pbdom_elem_2 is owned by
any document, and the pbdom_elem_1 object is still standalone. If
pbdom_elem_1 were assigned to a parent PBDOM_OBJECT owned by a document,
pbdom_elem_1 would cease to be a standalone object.


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