I need to save <![CDATA[]]>
tag when I parse XML document.
For example, I have node:
<Dest><![CDATA[some text...]]></Dest>
In xml file may be present nodes without CDATA.
Then I process all the nodes in loop:
$dom = simplexml_load_file($path);
foreach($dom->children() as $child) {
$nodeValue = (string) $child;
}
As a result, when I process node in example above - $nodeValue
= some text...
But I need $nodeValue
= <![CDATA[some text...]]>
There is any way to do this?
File example:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Root>
<Params>
<param>text</param>
<anotherParam>text</anotherParam>
</Params>
<Content>
<String>
<Source>some another text</Source>
<Dest>some another text 2</Dest>
</String>
<String>
<Source>some another text 3</Source>
<Dest><![CDATA[some text...]]></Dest>
</String>
</Content>
</Root>