I'm utterly confounded, and can only find info on parsing CDATA _from_ an XML
file, not _writing_ CDATA in XML formatted output.
---------------------------------
What I am currently generating :
<events>
<day thedate="15/10/2004" text1="var1" text2="var2" /></day>
. . .
</events>
---------------------------------
What I need to generate (word wrap aside) :
<events>
<day thedate="15/10/2004" text1="var1" text2="var2" /><![CDATA[
$details_field_here ]]></day>
. . .
</events>
---------------------------------
I can't figure out how to take the MySQL field containing HTML and insert it
into a CDATA segment as required.
---------------------------------
The code I have so far :
$root = $doc->add_root("events");
while (list($thedate, $var1, $var2, $details) = mysql_fetch_row($result)) {
$record = $root->new_child("day", "");
$record->set_attribute("thedate", $thedate);
$record->set_attribute("text1", $var1);
$record->set_attribute("text2", $var2);
// Stuck here, trying to insert $details CDATA
}
I've seen the short manual page about create_cdata_section, but nothing that's
actually helpful. I must be missing something in all my Googling and
manual-reading, but I'm stumped.
Any and all advice will be greatly appreciated. TIA !