PBDOM_DOCUMENT:
GetContent method
Description
Returns
all child content of the current PBDOM_DOCUMENT object.
Syntax
|
1 |
<span>pbdom_document_name</span>.GetContent(ref pbdom_object<span> pbdom_object_array[ ]</span>) |
|
Argument |
Description |
|---|---|
|
pbdom_document_name |
The name of a PBDOM_DOCUMENT |
|
pbdom_object_array |
The referenced name of an array of PBDOM_OBJECTs |
Return Values
Boolean. Returns true for
success and false for failure.
Throws
EXCEPTION_PBDOM_OBJECT_INVALID_FOR_USE – This PBDOM_OBJECT
object is not associated with a derived PBDOM_OBJECT class
object.
Examples
Assume a PBDOM_DOCUMENT object called pbdom_doc contains
the following XML document.
|
1 |
<Root><br>   <Element_1><br>      <Element_1_1/><br>      <Element_1_2/><br>      <Element_1_3/><br>   </Element_1><br>   <Element_2/><br>   <Element_3/><br></Root> |
In the following PowerScript code fragment, the array pbdom_obj_array contains
just one PBDOM_ELEMENT which represents the element Root: pbdom_obj_array[1] - <Root>:
|
1 |
PBDOM_DOCUMENT pbdom_doc<br>PBDOM_OBJECT pbdom_obj_array[]<br>...<br>pbdom_doc.GetContent(pbdom_obj_array)<br>pbdom_doc.GetRootElement().GetContent(pbdom_obj_array) |
The call to GetRootElement in the last
line of the previous code fragment yields an array that contains:
|
1 |
pbdom_obj_array[1] - <Element_1><br>pbdom_obj_array[2] - <Element_2><br>pbdom_obj_array[3] - <Element_3> |
The returned PBDOM_OBJECT array can be manipulated.
For example, the following statement causes Element_2 to
contain the Text node “Element 2 Text”:
|
1 |
pbdom_obj_array[2].AddContent ("Element 2 Text") |
After this call, the tree is as follows:
|
1 |
<Root><br>   Element_1><br>      Element_1_1/><br>      Element_1_2/><br>      Element_1_3/><br>   /Element_1><br>   Element_2>Element 2 Text<Element_2/><br>   Element_3/><br></Root> |
Usage
The returned array is passed by reference, with items in the
same order in which they appear in the PBDOM_DOCUMENT object.
Any changes to any item of the array affect the actual item to which
it refers.