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

SetContent – PB Docs 2022 – PowerBuilder Library

SetContent – PB Docs 2022

SetContent

Description

Sets the content of this PBDOM_ATTRIBUTE.

Syntax

Argument

Description

pbdom_attribute_name

The name of the PBDOM_ATTRIBUTE

pbdom_object_array

An array of PBDOM_OBJECTs

Return value

PBDOM_OBJECT. This PBDOM_ATTRIBUTE modified.

Throws

EXCEPTION_ILLEGAL_PBOBJECT — One of the array items is not a
valid PBDOM object. This can happen if the array item has not been
initialized properly or is a null object reference. This is similar to
EXCEPTION_INVALID_ARGUMENT.

EXCEPTION_USE_OF_UNNAMED_PBDOM_OBJECT — One of the array items is
nameable and has not been given a user-defined name.

EXCEPTION_PBDOM_OBJECT_INVALID_FOR_USE — One of the array items
is not associated with a derived PBDOM_OBJECT.

EXCEPTION_PBDOM_OBJECT_ALREADY_HAS_PARENT — One of the array
items already has a parent.

EXCEPTION_INAPPROPRIATE_USE_OF_PBDOM_OBJECT — One of the array
items is not allowed to be set as part of the contents of a
PBDOM_ATTRIBUTE.

Examples

This example demonstrates setting the contents of a
PBDOM_ATTRIBUTE object. It creates a PBDOM_DOCUMENT with root element
root and attaches to it a PBDOM_DOCTYPE with the following internal
subset:

It also creates a PBDOM_ATTRIBUTE, attr, and sets as its contents
an array of three PBDOM_OBJECTS:

  • A PBDOM_TEXT with the text value “start text “

  • A PBDOM_ENTITYREFERENCE named ent_ref

  • A PBDOM_TEXT with the text value ” end text.”

This removes the original contents of attr and sets new contents
so that when the document is serialized into an external file, the root
element looks like this:

Finally, a user-defined function called GetAttributeText parses
the external serialized XML file and retrieves the text value of the
attr attribute.

The code for GetAttributeText function is as follows:

This function builds a PBDOM_DOCUMENT from the external XML file
(its first argument) and gets the text value of an attribute (its second
argument) from the root element.

The code that sets the content of the PBDOM_ATTRIBUTE is as
follows:

Usage

This method sets the content of this PBDOM_ATTRIBUTE. The supplied
array should contain only objects of type PBDOM_TEXT and
PBDOM_ENTITYREFERENCE.

When all objects in the supplied array are legal and before the
new content is added, all objects in the old content will have their
parentage set to null (no parent) and the old content list will be
cleared from this PBDOM_ATRIBUTE.

This has the effect that the items of any active array (previously
obtained with a call to GetContent) also change to reflect the new
condition. In addition, all objects in the supplied array have their
parentage set to this PBDOM_ATTRIBUTE.

Passing a null value or an empty array clears the existing content
of this PBDOM_ATTRIBUTE.

See also

AddContent

GetContent

RemoveContent

SetContent


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