summaryrefslogtreecommitdiff
path: root/it_xml.class
diff options
context:
space:
mode:
authorUrban Müller2009-10-05 00:59:40 +0000
committerUrban Müller2009-10-05 00:59:40 +0000
commit815e12f8731453fce48628ce0cdd3177c3f2abf7 (patch)
tree3ae0d58d330fff0d03f3300c6efcdd4a9275aa37 /it_xml.class
parent4fa947294e8be3042807da1ba52d21bd1ca0a7ae (diff)
downloaditools-815e12f8731453fce48628ce0cdd3177c3f2abf7.tar.gz
itools-815e12f8731453fce48628ce0cdd3177c3f2abf7.tar.bz2
itools-815e12f8731453fce48628ce0cdd3177c3f2abf7.zip
handle bad xml
Diffstat (limited to 'it_xml.class')
-rw-r--r--it_xml.class3
1 files changed, 3 insertions, 0 deletions
diff --git a/it_xml.class b/it_xml.class
index 654042b..6013b52 100644
--- a/it_xml.class
+++ b/it_xml.class
@@ -88,6 +88,9 @@ function from_xml($xmldata, $p)
if (!preg_match('/^(<\?xml|\xEF\xBB\xBF|\xFE\xFF|\xFF\xFE|\x00\x00\xFE\xFF|\x00\x00\xFF\xFE)/', $xmldata))
$xmldata = '<?xml version="1.0" encoding="' . $this->_p['encoding'] . '"?>' . $xmldata;
+ # decode illegal entities but protect semantically important ones
+ $xmldata = html_entity_decode(preg_replace('/&(amp|lt|gt|#38|#60|#62|#x26|#x3C|#3E);/i', '&amp;$1;', $xmldata));
+
$result = xml_parse($parser, $xmldata);
}