SetRootElement

Description

Sets the root element for this document.

Syntax

pbdom_document_name.SetRootElement(pbdom_element pbdom_element_ref)

Argument

Description

pbdom_document_name

The name of a PBDOM_DOCUMENT object

pbdom_element_ref

A PBDOM_ELEMENT object to be set as the root element for this document


Return value

PBDOM_DOCUMENT. The PBDOM_DOCUMENT object with a modified root element.

Throws

EXCEPTION_INVALID_ARGUMENT -- The input PBDOM_ELEMENT 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_ELEMENT is nameable and it has not been given a user-defined name.

EXCEPTION_PBDOM_OBJECT_ALREADY_HAS_PARENT -- The input PBDOM_ELEMENT already has a parent PBDOM_OBJECT.

Usage

If this document already has a root element, the existing root element is replaced. The root element of a PBDOM_DOCUMENT object can be changed multiple times, and it is legal for a user to call the SetRootElement method multiple times.

See also

DetachRootElement

GetRootElement

HasRootElement