GetContent
Description
Returns all child content of the current PBDOM_DOCUMENT
object.
Syntax
|
1 |
pbdom_document_name.GetContent(ref pbdom_object pbdom_object_array[ ]) |
|
Argument |
Description |
|---|---|
|
pbdom_document_name |
The name of a PBDOM_DOCUMENT object |
|
pbdom_object_array |
The referenced name of an array of |
Return value
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 2 3 4 5 6 7 8 9 |
<Root> <Element_1> <Element_1_1/> <Element_1_2/> <Element_1_3/> </Element_1> <Element_2/> <Element_3/> </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 2 3 4 5 |
PBDOM_DOCUMENT pbdom_doc PBDOM_OBJECT pbdom_obj_array[] … pbdom_doc.GetContent(pbdom_obj_array) 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 2 3 |
pbdom_obj_array[1] - <Element_1> pbdom_obj_array[2] - <Element_2> 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 2 3 4 5 6 7 8 9 |
<Root> Element_1> Element_1_1/> Element_1_2/> Element_1_3/> /Element_1> Element_2>Element 2 Text<Element_2/> Element_3/> </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.
See also