XML文書を解析するときに<![CDATA[]]>
タグを保存する必要があります。SimpleXML:ノード値のCDATAタグの存在を処理する
例えば、Iノードを有する:XMLファイルで
<Dest><![CDATA[some text...]]></Dest>
はCDATAすることなく、本ノードであってもよいです。
そしてIは、ループ内のすべてのノード処理:私は上記の例では、ノードを処理するとき、結果として
$dom = simplexml_load_file($path);
foreach($dom->children() as $child) {
$nodeValue = (string) $child;
}
を - = some text...
$nodeValue
しかし、私はあり$nodeValue
= <![CDATA[some text...]]>
が必要これを行う方法は何ですか?
ファイル例:
<?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>
XMLファイルの例を挙げることはできますか? –