nimabaghaei Posted May 16, 2009 Share Posted May 16, 2009 Hi, Suppose I have a string called $a that contains invalid XML characters: $a; I want to have some sort of code that would look at the string and remove all invalid XML characters. The string is going to get exported into an XML file. Can anyone help me with this? Quote Link to comment https://forums.phpfreaks.com/topic/158416-strip-invalid-xml-characters/ Share on other sites More sharing options...
Daniel0 Posted May 16, 2009 Share Posted May 16, 2009 There are no invalid characters in your string. Quote Link to comment https://forums.phpfreaks.com/topic/158416-strip-invalid-xml-characters/#findComment-835462 Share on other sites More sharing options...
nimabaghaei Posted May 16, 2009 Author Share Posted May 16, 2009 woops, ok suppose it has some, what code would I need to remove them? Quote Link to comment https://forums.phpfreaks.com/topic/158416-strip-invalid-xml-characters/#findComment-835467 Share on other sites More sharing options...
Daniel0 Posted May 16, 2009 Share Posted May 16, 2009 Well, you should do this instead: <someTag><![CDATA[data here]]></someTag> http://en.wikipedia.org/wiki/CDATA Quote Link to comment https://forums.phpfreaks.com/topic/158416-strip-invalid-xml-characters/#findComment-835469 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.