(DataFlex) 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>
Use ChilkatAx-win32.pkg
Procedure Test
Handle hoXml
Variant vChildNode
Handle hoChildNode
String sTemp1
Get Create (RefClass(cComChilkatXml)) To hoXml
If (Not(IsComObjectCreated(hoXml))) Begin
Send CreateComObject of hoXml
End
Set ComTag Of hoXml To "abc"
// Create a new child with no content
// and return the newly created child node:
Get ComNewChild Of hoXml "xyz" "" To vChildNode
If (IsComObject(vChildNode)) Begin
Get Create (RefClass(cComChilkatXml)) To hoChildNode
Set pvComObject Of hoChildNode To vChildNode
End
// Create a child under childNode, but instead call
// NewChild2 which doesn't return the newly created child node:
Send ComNewChild2 To hoChildNode "mmm" "123"
Send Destroy of hoChildNode
Get ComGetXml Of hoXml To sTemp1
Showln sTemp1
End_Procedure
|