I am trying to retreive a string in a XML file using simplexml. But the string contains the character "&". So I think I have to use CDATA to get the value. I am really new to this and don't no how to do it. this is just an example of what I want.
Example.php
<?php
$xmlstr = <<<XML
<?xml version='1.0' standalone='yes'?>
<Books>
<Book>
<title> PHP & XML </title>
<author> Some text </author>
<price> Some text </price>
</Book>
<Book>
<title> Java & Coding </title>
<author> Some text </author>
<price> Some text </price>
</Book>
</Books>
XML;
?>
And this is my calling php file
call.php
<?php
include 'Example.php';
$xml = simplexml_load_string($xmlstr);
$abc = $xml->Book[0]->title[0];
echo $abc;
?>
And it is giving an error because of the character "&". I cannot change my XML. Any modification can be done to call.php Any help regarding the matter would be highly appreciate. Thanx.