Description
Sets the referenced PBDOM_OBJECT to be the parent of the current PBDOM_COMMENT.
Syntax
pbdom_comment_name.SetParentObject(pbdom_object pbdom_object_ref)
Argument |
Description |
---|---|
pbdom_comment_name |
The name of a PBDOM_COMMENT |
pbdom_object_ref |
A PBDOM_OBJECT to be set as the parent of the current PBDOM_COMMENT |
Return value
PBDOM_OBJECT.
Throws
EXCEPTION_PBDOM_OBJECT_INVALID_FOR_USE -- If the input PBDOM_OBJECT is not a reference to an object derived from PBDOM_OBJECT.
EXCEPTION_PBDOM_OBJECT_ALREADY_HAS_PARENT -- If the current PBDOM_COMMENT already has a parent.
EXCEPTION_INAPPROPRIATE_USE_OF_PBDOM_OBJECT -- If the input PBDOM_OBJECT is of a class that does not have a proper parent-child relationship with the PBDOM_COMMENT class.
EXCEPTION_USE_OF_UNNAMED_PBDOM_OBJECT -- If the input PBDOM_OBJECT requires a user-defined name, and it has not been named.
Usage
This method sets the input PBDOM_OBJECT as the parent of this PBDOM_COMMENT. The caller is responsible for ensuring that the current PBDOM_COMMENT and the input PBDOM_OBJECT can have a legal parent-child relationship. Currently, only a PBDOM_ELEMENT and a PBDOM_DOCUMENT can be set as the parent of a PBDOM_COMMENT.
The PBDOM_COMMENT SetParentObject method differs from the JDOM Comment setParent method in two ways:
-
JDOM defines a setParent method for several specific classes, including Element, Comment, and CDATA. PBDOM implements the SetParentObject method in the base PBDOM_OBJECT class to allow for polymorphism.
-
The JDOM Comment's setParent method takes only an Element class object as a parameter:
COMMENT::setParent(Element parent)
To set a Document as the parent owner of a Comment using JDOM, you use the setDocument method:
COMMENT::setDocument(Document document)
In PBDOM, SetParentObject takes a reference to a PBDOM_OBJECT, so that both a PBDOM_ELEMENT and a PBDOM_DOCUMENT can be set as a parent.
See also