RemoveContent

Description

Removes a child PBDOM_OBJECT from a PBDOM_ELEMENT object. All children of the removed PBDOM_OBJECT are also removed.

Syntax

pbdom_element_name.RemoveContent(pbdom_object pbdom_object_ref)

Argument

Description

pbdom_element_name

The name of a PBDOM_ELEMENT object

pbdom_object_ref

The PBDOM_OBJECT to remove


Return value

Boolean.

Returns true if the specified content was removed and false otherwise.

Throws

EXCEPTION_USE_OF_UNNAMED_PBDOM_OBJECT -- If the input PBDOM_OBJECT has not been given a user-defined name.

EXCEPTION_PBDOM_OBJECT_INVALID_FOR_USE -- If the input PBDOM_OBJECT is not associated with a derived PBDOM_OBJECT.

EXCEPTION_WRONG_DOCUMENT_ERROR -- If the input PBDOM_OBJECT is not from the same document as this PBDOM_ELEMENT object.

EXCEPTION_WRONG_PARENT_ERROR -- If the input PBDOM_OBJECT is not a child of the current PBDOM_ELEMENT object.

Examples

The RemoveContent method is used to modify the following XML fragment:

<Telephone_Book>
     <Entry>
          <Particulars>
               <Name>John Doe</Name>
               <Age>21</Age>
               <Phone_Number>1234567</Phone_Number>
          </Particulars>
     </Entry>
</Telephone_Book>

The RemoveContent method is invoked from the following PowerScript code:

PBDOM_DOCUMENT pbdom_doc
PBDOM_ELEMENT pbdom_entry

pbdom_doc.GetRootElement().RemoveContent(pbdom_entry)

The following XML results:

<Telephone_Book></Telephone_Book>

See also

AddContent Syntax 1

AddContent Syntax 2

GetContent

InsertContent

SetContent