PHP Snippet 1:
<![CDATA[Aghia Paraskevi, Skiatos, Greece]]>
PHP Snippet 2:
$doc = new DOMDocument();
$doc->load('test.xml');
$destinations = $doc->getElementsByTagName("Destination");
foreach ($destinations as $destination) {
foreach($destination->childNodes as $child) {
if ($child->nodeType == XML_CDATA_SECTION_NODE) {
echo $child->textContent . "<br/>";
}
}
}
PHP Snippet 3:
$parseFile = simplexml_load_file($myXML,'SimpleXMLElement', LIBXML_NOCDATA)
PHP Snippet 4:
foreach ($parseFile->yourNode as $node ){
etc...
}
PHP Snippet 5:
$xml = simplexml_load_string($xmlData, 'SimpleXMLElement', LIBXML_NOCDATA);
$xmlJson = json_encode($xml);
$xmlArr = json_decode($xmlJson, 1); // Returns associative array
PHP Snippet 6:
str_replace(array('<\![CDATA[',']]>'), '', $xml);
PHP Snippet 7:
<![CDATA[values]] >
PHP Snippet 8:
$xml_file_data = json_decode(json_encode(simplexml_load_string($xml, 'SimpleXMLElement', LIBXML_NOCDATA),true), true);
PHP Snippet 9:
function inBetweenOf(string $here, string $there, string $content) : string {
$left_over = strlen(substr($content, strpos($content, $there)));
return substr($content, strpos($content, $here) + strlen($here), -$left_over);
}
PHP Snippet 10:
$doc = inBetweenOf('<![CDATA[', ']]>', $xml);