Is there any function that I can use to parse any string to ensure it won\'t cause xml parsing problems? I have a php script outputting a xml file with content obtained from
You take it the wrong way - don't look for a parser which doesn't give you errors. Instead try to have a well-formed xml.
How did you get ’ from the user? If he literally typed it in, you are not processing the input correctly - for example you should escape & to &. If it is you who put the entity there (perhaps in place of some apostrophe), either define it in DTD () or write it using a numeric notation (’), because almost every of the named entities are a part of HTML. XML defines only a few basic ones, as Gumbo pointed out.
EDIT based on additions to the question:
]]> <°)))><, you have a problem.& which should be interpreted like &).If you use htmlspecialchars() with ENT_QUOTES, it should be ok, but see how Drupal does it.