(PowerBuilder) 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>
integer li_rc
oleobject loo_Xml
oleobject loo_Child1
oleobject loo_Child2
oleobject loo_Child3
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 = "root"
loo_Child1 = loo_Xml.NewChild("year","2009")
loo_Child2 = loo_Xml.NewChild("junk1","abc .. < & > 123")
loo_Child3 = loo_Xml.NewChild("junk2","abc .. < & > 123")
loo_Child3.Cdata = 1
destroy loo_Child1
destroy loo_Child2
destroy loo_Child3
Write-Debug loo_Xml.GetXml()
destroy loo_Xml
|