For example, take a look at following example:
$str = <<
text & images
EOT;
$s = simplexml_load_string($str);
?>
This will generate the following error:
Warning: simplexml_load_string()
[
function.simplexml-load-string]:
Entity: line 2: parser error : xmlParseEntityRef:
no name in C:\OOP with PHP5\Codes\ch8\cdata.php
on line 10
Warning: simplexml_load_string()
[
function.simplexml-load-string]:
<content>text & images </content>
in C:\OOP with PHP5\Codes\ch8\cdata.php
on line 10
Warning: simplexml_load_string()
[
function.simplexml-load-string]:
^ in C:\OOP with PHP5\Codes\ch8\cdata.php
on line 10
To avoid this problem we have to enclose using a CDATA tag. Let's rewrite it like this:
Cooking XML with OOP
[ 202 ]
Now it will work perfectly. And you don't have to do any extra work for managing
this CDATA section.
Pages:
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218