/** * Make a string containing HTML safe for use in a XML document * Tags are stripped, entities are normalized and named entities are * converted to numeric entities. */ function stringToXML($string) { $string = stringStripTags($string); $string = entity::named_to_numeric($string); $string = entity::normalize_numeric($string); if (strtoupper(_CHARSET) == 'UTF-8') { $string = entity::numeric_to_utf8($string); } $string = entity::specialchars($string, 'xml'); return $string; }