| PHP SimpleXML - Adding Text from forms to XML
|
username

msg:4363902 | 12:48 am on Sep 18, 2011 (gmt 0) | Hi all, I'm trying to find a tried and tested method of adding user generated text into XML. An example would be a user types some text into a text area, posts it to a php page, then I check the text for html characters and add it to the XML. My issue, is that the XML is breaking because some non allowed characters are getting through. I have tried:
- strip_tags - to remove html[/li]
- htmlspecialchars - to convert non xml approved characters to acceptable character[/li]
I would like to ideally keep the html in the text if possible. Does anyone have a good method of processing text for addition to XML? Thanks
|
Readie

msg:4363984 | 11:33 am on Sep 18, 2011 (gmt 0) | Have you tried wrapping the user defined content in <[CDATA[ ]]> tags? <xml_element_name><[CDATA[user defined content]]></xml_element_name> |
|
|
|
|