(PureBasic) Using CDATA in XML
Demonstrates how to force the content of a node to be encapsulated in CDATA.
The output of the following program is an XML document that looks like this:
<root>
<year>2009</year>
<junk1>abc .. < & > 123</junk1>
<junk2><![CDATA[abc .. < & > 123]]></junk2>
</root>
IncludeFile "CkXml.pb"
Procedure ChilkatExample()
xml.i = CkXml::ckCreate()
If xml.i = 0
Debug "Failed to create object."
ProcedureReturn
EndIf
child1.i
child2.i
child3.i
CkXml::setCkTag(xml, "root")
child1 = CkXml::ckNewChild(xml,"year","2009")
child2 = CkXml::ckNewChild(xml,"junk1","abc .. < & > 123")
child3 = CkXml::ckNewChild(xml,"junk2","abc .. < & > 123")
CkXml::setCkCdata(child3, 1)
CkXml::ckDispose(child1)
CkXml::ckDispose(child2)
CkXml::ckDispose(child3)
Debug CkXml::ckGetXml(xml)
CkXml::ckDispose(xml)
ProcedureReturn
EndProcedure
|