Sample code for 30+ languages & platforms
PowerBuilder

Creating a New Child Node

See more XML Examples

Demonstrates how to create a new child in an XML document.

The following XML sample code produces this output:


<abc>
    <xyz>
        <mmm>123</mmm>
    </xyz>
</abc>

Chilkat PowerBuilder Downloads

PowerBuilder
integer li_rc
oleobject loo_Xml
oleobject loo_ChildNode

loo_Xml = create oleobject
li_rc = loo_Xml.ConnectToNewObject("Chilkat.Xml")
if li_rc < 0 then
    destroy loo_Xml
    MessageBox("Error","Connecting to COM object failed")
    return
end if

loo_Xml.Tag = "abc"

// Create a new child  with no content 
// and return the newly created child node:

loo_ChildNode = loo_Xml.NewChild("xyz","")

// Create a child under childNode, but instead call
// NewChild2 which doesn't return the newly created child node:
loo_ChildNode.NewChild2("mmm","123")

destroy loo_ChildNode

Write-Debug loo_Xml.GetXml()


destroy loo_Xml