Description
Sets the content of the PBDOM_ELEMENT object using an array containing PBDOM_OBJECT objects legal for a PBDOM_ELEMENT object. Any existing children of the PBDOM_ELEMENT object are removed when the SetContent method is invoked.
If the input array reference is null, all contents of the PBDOM_ELEMENT object are removed. If the array contains illegal objects, an exception is thrown, and nothing is altered.
Syntax
pbdom_element_name.SetContent(pbdom_object pbdom_object_array[])
| 
                               Argument  | 
                           
                               Description  | 
                        
|---|---|
| 
                               pbdom_element_name  | 
                           
                               The name of a PBDOM_ELEMENT object  | 
                        
| 
                               pbdom_object_array  | 
                           
                               An array of PBDOM_OBJECTS to form the contents the PBDOM_ELEMENT object  | 
                        
Return value
PBDOM_OBJECT. The PBDOM_ELEMENT object modified and returned as a PBDOM_OBJECT.
Throws
EXCEPTION_USE_OF_UNNAMED_PBDOM_OBJECT -- If an input PBDOM_OBJECT array item has not been given a user-defined name.
EXCEPTION_PBDOM_OBJECT_INVALID_FOR_USE -- If an input PBDOM_OBJECT array item is not associated with a derived PBDOM_OBJECT.
EXCEPTION_PBDOM_OBJECT_ALREADY_HAS_PARENT -- If an input PBDOM_OBJECT array item already has a parent PBDOM_OBJECT.
EXCEPTION_INAPPROPRIATE_USE_OF_PBDOM_OBJECT -- If an inappropriate PBDOM_OBJECT array item is found. This happens if the PBDOM_OBJECT array item is not allowed to be added as a child of a PBDOM_ELEMENT object (for example, a PDBOM_DOCUMENT).
EXCEPTION_HIERARCHY_ERROR -- If one of the PBDOM_OBJECT array items, if set as part of the contents of this PBDOM_ELEMENT object, will cause the current PBDOM_ELEMENT object to be no longer well formed.
Examples
The SetContent method is invoked on 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 SetContent method is invoked from the following PowerScript code:
PBDOM_OBJECT pbdom_obj_array[] pbdom_obj_array[1] = entry_1 pbdom_obj_array[2] = entry_2 pbdom_doc.GetRootElement().SetContent(pbdom_obj_array)
The entry_1 PBDOM_ELEMENT object contains the following:
     <Entry>
          <Particulars>
               <Name>James Gomez</Name>
               <Age>25</Age>
               <Phone_Number>1111111</Phone_Number>
          </Particulars>
     </Entry>The entry_2 PBDOM_ELEMENT object contains the following:
     <Entry>
          <Particulars>
               <Name>Mary Jones</Name>
               <Age>22</Age>
               <Phone_Number>2222222</Phone_Number>
          </Particulars>
     </Entry>The SetContent method returns the following:
<Telephone_Book>
     <Entry>
          <Particulars>
               <Name>James Gomez</Name>
               <Age>25</Age>
               <Phone_Number>1111111</Phone_Number>
          </Particulars>
     </Entry>
     <Entry>
          <Particulars>
               <Name>Mary Jones</Name>
               <Age>22</Age>
               <Phone_Number>2222222</Phone_Number>
          </Particulars>
     </Entry>
</Telephone_Book>Usage
Only the following PBDOM_OBJECT types can be validly added to a PBDOM_ELEMENT object:
- 
                     
PBDOM_ELEMENT
 - 
                     
PBDOM_CDATA
 - 
                     
PBDOM_COMMENT
 - 
                     
PBDOM_ENTITYREFERENCE
 - 
                     
PBDOM_PROCESSINGINSTRUCTION
 - 
                     
PBDOM_TEXT
 
See also


