Convert HTML Entities
Join the DZone community and get the full member experience.Join For Free
Include this to convert those ampersands and angle brackets to proper entities. It can help with XML too but remember there are lots of other entities that need converting.
use HTML::Entities; ... $html = encode_entities($string, '<>&"');