Re: Converting user input for XML-validation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2007. 11. 16, péntek keltezéssel 11.14-kor Ralph Kutschera ezt írta:
> Hallo!
> 
>   I'm having an HTML-form where the user can input anything. With PHP
> I'm processing the input to XML like
> 
> <userinput>what the user has entered</userinput>
> 
> Now, if the user enters e.g "< thats a bracket", that gives
> 
> <userinput>< thats a bracket</userinput>
> 
> which of course does not validate.
> 
> Is there a standard function in PHP to convert any string for usage with
> XML? In the example the string should become "&lt; thats a bracket".

you need http://hu.php.net/htmlentities

(of course first find the part within <userinput></userinput>, thats a
quite easy regex. then use htmlentities on that part, then replace it
back to the original xml)

greets
Zoltán Németh

> 
> Thanks a lot,
>   Ralph
> 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux