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 & jerry</example>'
obviously, want simplexml decode &
&
. 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
Post a Comment