I've used htmlspecialchars already but it also converts the valid characters such as '<' in '<outline' into '<' which I do not want it to do. I simply want the urls/titles/names etc to be checked whether they are valid; or if they are not, they must be made valid. I've considered passing each url through htmlspecialchars but it slows down process a lot.
A part of my xml string looks as follows:
<outline title="inspiration" text="inspiration"> <outline text="Paul Graham" title="Paul Graham" type="rss" xmlUrl="http://www.aaronsw.com/2002/feeds/pgessays.rss" htmlUrl="http://www.paulgraham.com/index.html"/> <outline text="Flickr: Shreeda Kumar's Photostream" title="Flickr: Shreeda Kumar's Photostream" type="rss" xmlUrl="http://api.flickr.com/services/feeds/photos_public.gne?id=47780284@N06&lang=en-us&format=rss_200" htmlUrl="http://www.flickr.com/photos/shreeda-kumar/"/> <outline text="Lea Verou | Life at the bleeding edge (of web standards)" title="Lea Verou | Life at the bleeding edge (of web standards)" type="rss" xmlUrl="http://lea.verou.me/feed/" htmlUrl="http://lea.verou.me/"/> </outline>