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? 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. 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? 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 Link to comment https://forums.phpfreaks.com/topic/158416-strip-invalid-xml-characters/#findComment-835469 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.