test.xml
Codice PHP:
<?xml version="1.0" encoding="UTF-8"?>
<parent>
<child1>jjjjjjjjjjjjjj</child1>
<child2><![CDATA[If your text contains a lot of "<" or "&" characters - as program code often does - the XML element can be defined as a CDATA section.]]></child2>
</parent>
homework
Codice PHP:
<?php
$file = 'test.xml';
$dom = new DOMDocument('1.0', 'UTF-8');
$dom->load($file);
$child2 = $dom->getElementsByTagName("child2");
$cloneChild2= $child2->item(0)->cloneNode(true);
echo $cloneChild2->firstChild->nodeType; //4
?>