php - SimpleXML with decoded entities -


how can make simplexml replace html/xml entities respective characters, in php?

assume having xml document, in string:

$data = '<?xml version="1.0" encoding="iso-8859-1"?><example>tom &amp; jerry</example>' 

obviously, want simplexml decode &amp; &. not default. have tried these 2 ways, neither of worked:

$xml = new simplexmlelement($data); $xml = new simplexmlelement($data, libxml_noent); 

what's best way xml entities decoded? guess xml parser should it, avoid running html_entity_decode before parsing (actually, won't work either). may problem encoding of string? if so, how track , fix it?

i don't know if going work in cases maybe...

$xml = new simplexmlelement(html_entity_decode($data)); 

http://www.php.net/manual/en/function.html-entity-decode.php


Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -