Description
Determines whether the current PBDOM_OBJECT is the ancestor of another PBDOM_OBJECT.
Syntax
pbdom_object_name.IsAncestorObjectOf(pbdom_object_ret)
|
Argument |
Description |
|---|---|
|
pbdom_object_name |
The name of the PBDOM_OBJECT |
|
pbdom_object_ref |
The PBDOM_OBJECT to check against |
Return value
Boolean.
Returns true if the current PBDOM_OBJECT is the ancestor of the referenced PBDOM_OBJECT, and false otherwise.
Throws
EXCEPTION_PBDOM_OBJECT_INVALID_FOR_USE -- This PBDOM_OBJECT object is not associated with a derived PBDOM_OBJECT class object.
EXCEPTION_INVALID_ARGUMENT -- The input PBDOM_OBJECT is invalid. This can happen if it has not been initialized properly or it is a null object reference.
Examples
The following code fragment uses the IsAncestorObjectOf method and creates a structured document. In the fragment, pbdom_elem_1 represents the pbdom_elem_1 element. Because it is an ancestor of pbdom_elem_3, which represents the pbdom_elem_ element, the call to IsAncestorObjectOf returns true.
PBDOM_ELEMENT pbdom_elem_1
PBDOM_ELEMENT pbdom_elem_2
PBDOM_ELEMENT pbdom_elem_3
PBDOM_ELEMENT pbdom_elem_root
PBDOM_DOCUMENT pbdom_doc1
pbdom_doc1 = Create PBDOM_DOCUMENT
pbdom_elem_1 = Create PBDOM_ELEMENT
pbdom_elem_2 = Create PBDOM_ELEMENT
pbdom_elem_3 = Create PBDOM_ELEMENT
pbdom_elem_1.SetName("pbdom_elem_1")
pbdom_elem_2.SetName("pbdom_elem_2")
pbdom_elem_3.SetName("pbdom_elem_3")
pbdom_elem_1.AddContent(pbdom_elem_2)
pbdom_elem_2.AddContent(pbdom_elem_3)
pbdom_doc1.NewDocument("", "", &
"Root_Element_From_Doc_1" , "", "")
pbdom_elem_root = pbdom_doc1.GetRootElement()
pbdom_elem_root.AddContent(pbdom_elem_1)
IF (pbdom_elem_1.IsAncestorObjectOf(pbdom_elem_3)) THEN
MessageBox ("Ancestry", &
"pbdom_elem_1 Is The Ancestor Of pbdom_elem_3")
ELSE
MessageBox ("Ancestry", &
"pbdom_elem_1 Is NOT The Ancestor Of pbdom_elem_3")
END IF
destroy pbdom_elem_1
destroy pbdom_elem_2
destroy pbdom_elem_3
destroy pbdom_elem_root
destroy pbdom_doc1
The preceding code fragment creates the following document:
<!DOCTYPE Root_Element_From_Doc_1>
<Root_Element_From_Doc_1>
<pbdom_elem_1>
<pbdom_elem_2>
<pbdom_elem_3 />
</pbdom_elem_2>
</pbdom_elem_1>
</Root_Element_From_Doc_1>Usage
The IsAncestorObjectOf method determines whether the current PBDOM_OBJECT is the ancestor of another PBDOM_OBJECT.


