Description
The AddContent method is overloaded:
-
Syntax 1 adds a new PBDOM_OBJECT into a PBDOM_ELEMENT object.
-
Syntax 2 adds a new text string to the PBDOM_ELEMENT object from which the method is invoked.
Syntax
Description
Adds a new PBDOM_OBJECT into a PBDOM_ELEMENT object. The added PBDOM_OBJECT becomes a child of the PBDOM_ELEMENT object.
Syntax
pbdom_element_name.AddContent(pbdom_object pbdom_object_ref)
Argument |
Description |
---|---|
pbdom_element_name |
The name of a PBDOM_ELEMENT object |
pbdom_object_ref |
The PBDOM_OBJECT to add |
Return value
PBDOM_OBJECT. The PBDOM_ELEMENT object modified and returned as a PBDOM_OBJECT.
Throws
EXCEPTION_INAPPROPRIATE_USE_OF_PBDOM_OBJECT -- If an invalid PBDOM_OBJECT is added. See description section below on the valid PBDOM_OBJECTs that can be added to a PBDOM_ELEMENT object. This exception is also thrown if the input PBDOM_OBJECT is this PBDOM_ELEMENT object itself.
EXCEPTION_USE_OF_UNNAMED_PBDOM_OBJECT -- If the input PBDOM_OBJECT has not been given a user-defined name.
EXCEPTION_PBDOM_OBJECT_INVALID_FOR_USE -- If the input PBDOM_OBJECT is not associated with a derived PBDOM_OBJECT.
EXCEPTION_PBDOM_OBJECT_ALREADY_HAS_PARENT -- If the input PBDOM_OBJECT already has a parent PBDOM_OBJECT.
EXCEPTION_HIERARCHY_ERROR -- If adding the input PBDOM_OBJECT will cause the current PBDOM_ELEMENT object to be no longer well-formed.
Examples
The AddContent method is invoked for the Element_2 PBDOM_ELEMENT object in the following XML fragment:
<Element_1> <Element_1_1/> <Element_1_2/> <Element_1_3/> </Element_1> <Element_2>Element 2 Text</Element_2> <Element_3/>
The AddContent is invoked from the following PowerScript code, where pbdom_elem_2 represents the Element_2 object:
PBDOM_ELEMENT pbdom_elem pbdom_elem = Create PBDOM_ELEMENT pbdom_elem.SetName("Sub_Element") pbdom_elem.AddContent("Sub Element Text") pbdom_elem_2.AddContent (pbdom_elem)
The following XML fragment results:
<Element_1> <Element_1_1/> <Element_1_2/> <Element_1_3/> </Element_1> <Element_2> Element 2 Text <Sub_Element> Sub Element Text </Sub_Element> <Element_2/> <Element_3/>
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
Description
Adds a new text string to the PBDOM_ELEMENT object from which the method is invoked.
Syntax
pbdom_element_name.AddContent(string strText)
Argument |
Description |
---|---|
pbdom_element_name |
The name of a PBDOM_ELEMENT object |
strText |
A string to be added to the PBDOM_ELEMENT object as new text content |
Return value
PBDOM_OBJECT. The PBDOM_ELEMENT object modified and returned as a PBDOM_OBJECT.
Examples
The AddContent method is invoked for the abc element of the following XML document:
<abc> Root Element Data <data> ABC Data <inner_data>My Inner Data</inner_data> </data> </abc>
The AddContent method is invoked from the following PowerScript statement:
pbdom_doc.GetRootElement().AddContent(" And More !")
The following XML results:
<abc> Root Element Data <data> ABC Data <inner_data>My Inner Data</inner_data> </data> And More ! </abc>
See also