(PowerBuilder) Creating a New Child Node
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>
integer li_rc
oleobject loo_Xml
oleobject loo_ChildNode
loo_Xml = create oleobject
// Use "Chilkat_9_5_0.Xml" for versions of Chilkat < 10.0.0
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
|