开发者

xml parsing with simple xml [duplicate]

This question already has answers here: Closed 11 years ago开发者_JAVA技巧.

Possible Duplicate:

Problem with simpleXML and entity not being defined

I have this tag with an entity in an xml file:

<comune>Forli&#39;</comune>

Simple xml in php fail to parse the file:

Warning: SimpleXMLElement::__construct() [simplexmlelement.--construct]: parser error : Entity 'igrave' not defined

How can i do?


I tried this a small example and it worked for me

XML:

<?xml version="1.0" encoding="UTF-8"?>
<comune>
<comune>Forli&#39;</comune>
</comune>

PHP:

    $xml = simplexml_load_file('test.xml');

    foreach($xml->children() as $child){ 
        echo '<pre>';
        print_r((string)$child);
        echo '</pre>asd';
    }

OUTPUT:

Forli'


Check this solution for help

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜