XML analysis with simple xml

Possible duplicate:
Problem with simpleXML and entity not defined

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

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

Simple xml in php cannot parse a file:

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

How can i do this?

0
source share
2 answers

I tried this 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' 
+1
source

Refer to the solution for help.

0
source

All Articles