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

SetAttribute Syntax 1 – PB Docs 126 – PowerBuilder Library

SetAttribute Syntax 1 – PB Docs 126

PBDOM_ELEMENT:

SetAttribute Syntax 1 method

Description

Adds a predefined PBDOM_ATTRIBUTE object to a PBDOM_ELEMENT object.
Any existing attribute with the same name and namespace URI is overwritten.

Syntax

Argument

Description

pbdom_element_name

The name of a PBDOM_ELEMENT
object

pbdom_attribute_ref

The PBDOM_ATTRIBUTE object to
be set for this PBDOM_ELEMENT object

Return Values

PBDOM_ELEMENT. The PBDOM_ELEMENT object
modified to contain the specified PBDOM_ATTRIBUTE.

Throws

EXCEPTION_INVALID_ARGUMENT – The
input PBDOM_ATTRIBUTE is invalid. This can happen if it
has not been initialized properly or it is a null object
reference.

EXCEPTION_USE_OF_UNNAMED_PBDOM_OBJECT – The
input PBDOM_ATTRIBUTE has not been given a user-defined
name.

EXCEPTION_PBDOM_OBJECT_ALREADY_HAS_OWNER – The
input PBDOM_ATTRIBUTE already has an owner element.

Examples

The SetAttribute method is invoked
for the following element:

The SetAttribute method is invoked from
the following PowerScript code, where elem_image represents
the image element from the preceding XML:

The following XML results:

The following example demonstrates the impact of
setting a PBDOM_ATTRIBUTE for a PBDOM_ELEMENT
object where the PBDOM_ELEMENT object already contains
an attribute of the same name and namespace URI as the input PBDOM_ATTRIBUTE.

The example creates a PBDOM_DOCUMENT based on the
following document:

Then it creates a PBDOM_ATTRIBUTE object and sets
its name to a and its prefix
and URI to pre2 and http://www.pre.com.
The bVerifyNamespace argument is set to false because
this PBDOM_ATTRIBUTE has not been assigned an owner PBDOM_ELEMENT
object yet, so that the verification for a predeclared namespace
would fail. The text value is set to 456.The child1 element
already contains an attribute named a that
belongs to the namespace http://www.pre.com, as
indicated by the prefix pre1. The new PBDOM_ATTRIBUTE
uses the prefix pre2, but it represents the
same namespace URI, so setting the new PBDOM_ATTRIBUTE
to child1 successfully replaces the existing pre1:a with
the new PBDOM_ATTRIBUTE pre2:a.

When saved and converted to an XML document, the document
looks like the following :

Usage

This method allows the caller to add a predefined PBDOM_ATTRIBUTE object
to a PBDOM_ELEMENT object. If this PBDOM_ELEMENT
object already contains an existing attribute with the same name
and namespace URI as the input PBDOM_ATTRIBUTE, the existing
attribute is replaced by the input PBDOM_ATTRIBUTE.

If a PBDOM_ATTRIBUTE has been created to represent
the original attribute, it is still valid after the call, but the
attribute that it represents has been detached from the original
owner element. Calling GetOwnerElementObject on
this PBDOM_ATTRIBUTE returns a null value.

See Also


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