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

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -

java - Why does my date parsing return a weird date? -

Need help in packaging app using TideSDK on Windows -