PureBasic
PureBasic
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 PureBasic Downloads
IncludeFile "CkXml.pb"
Procedure ChilkatExample()
xml.i = CkXml::ckCreate()
If xml.i = 0
Debug "Failed to create object."
ProcedureReturn
EndIf
CkXml::setCkTag(xml, "abc")
; Create a new child with no content
; and return the newly created child node:
childNode.i
childNode = CkXml::ckNewChild(xml,"xyz","")
; Create a child under childNode, but instead call
; NewChild2 which doesn't return the newly created child node:
CkXml::ckNewChild2(childNode,"mmm","123")
CkXml::ckDispose(childNode)
Debug CkXml::ckGetXml(xml)
CkXml::ckDispose(xml)
ProcedureReturn
EndProcedure