InsertContent – PB Docs 126

PBDOM_DOCUMENT:

InsertContent method

Description

Inserts
a new PBDOM_OBJECT into the current PBDOM_DOCUMENT object.

Syntax

Argument

Description

pbdom_document_name

The name of a PBDOM_DOCUMENT
object

pbdom_object_new

The PBDOM_OBJECT to insert

pbdom_object_ref

The PBDOM_OBJECT in front of
which the new PBDOM_OBJECT will be inserted

Return Values

PBDOM_OBJECT. The modified PBDOM_DOCUMENT
object returned as a PBDOM_OBJECT.

Throws

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

EXCEPTION_USE_OF_UNNAMED_PBDOM_OBJECT – The
input PBDOM_OBJECT to insert has not been given a user-defined
name. The same exception is thrown if the reference PBDOM_OBJECT
is also not given a user–defined name, unless the reference
PBDOM_OBJECT is specifically set to null.

EXCEPTION_PBDOM_OBJECT_INVALID_FOR_USE – The
input PBDOM_OBJECT to insert is not associated with a derived PBDOM_OBJECT.
The same exception is thrown if the reference PBDOM_OBJECT
is also not associated with a derived PBDOM_OBJECT, unless
the reference PBDOM_OBJECT is specifically set to null.

EXCEPTION_PBDOM_OBJECT_ALREADY_HAS_PARENT – The
input PBDOM_OBJECT to insert already as a parent.

EXCEPTION_MULTIPLE_ROOT_ELEMENT – A
PBDOM_ELEMENT is to be inserted, but this document already
has a root element.

EXCEPTION_MULTIPLE_DOCTYPE – A
PBDOM_DOCTYPE is to be inserted, but this document already
has a DOCTYPE.

EXCEPTION_HIERARCHY_ERROR – Inserting
the PBDOM_OBJECT adversely affects how well-formed the
document is.

EXCEPTION_INAPPROPRIATE_USE_OF_PBDOM_OBJECT – An
invalid PBDOM_OBJECT is to be inserted. See AddContent for information
on the valid PBDOM_OBJECTs that can be added to a PBDOM_DOCUMENT
object.

EXCEPTION_WRONG_PARENT_ERROR – The
reference PBDOM_OBJECT is not a child of this PBDOM_DOCUMENT
object.

Examples

A PBDOM_DOCUMENT object is created from
an XML string. The PBDOM_ELEMENT pbdom_elem_1 is
also created and set as Elem_1. The PBDOM_DOCTYPE pbdom_doctype_1 and
the root element pbdom_root_elem are
set.The root element is detached from its parent, which is also
the PBDOM_DOCUMENT object itself. This makes it possible
to insert pbdom_elem_1 into
the document specifically before pbdom_doctype_1.

The result is the following document, which is not well-formed:

Usage

When a new PBDOM_OBJECT is inserted into the current PBDOM_DOCUMENT
object, the new PBDOM_OBJECT becomes a child node of the
current PBDOM_DOCUMENT object. Also, the new PBDOM_OBJECT
is to be positioned specifically before another PBDOM_OBJECT,
denoted using the second parameter.

If the second PBDOM_OBJECT is specified as null,
then the new PBDOM_OBJECT is to be inserted at the end
of the list of children of the current PBDOM_DOCUMENT object.

See Also


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