Welcome, Guest. Please login or register.
Did you miss your activation email?
05/23/12, 00:26
Home Help Search Login Register
News: Parsley Flex framework review featuring quiz application, in our Flex frameworks series
Flex SDK 4.5 mobile roadmap: begin with your mobile development
Swiz Flex framework review featuring quiz application
New homepage we release our new Homepage, take a look ...

+  Flash-db
|-+  Server side Scripting and Database Support
| |-+  Web Services: XML, Soap, WSDL, UDDI, and Flash Integration (Moderators: Flash-db, Musicman, vesa kortelainen, Ronald Wernecke, Jorge Solis)
| | |-+  "[" and "]" character on CDATA
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] Print
Author Topic: "[" and "]" character on CDATA  (Read 1867 times)
Joel Pablo
Server what's that
*
Posts: 6



View Profile Email
« on: 01/29/03, 03:19 »


hi,

im doing a shoutbox on flash and php .. everything is cool but when the user input has "[" or "]" character in it... the xml structure freaks out because of these character inside the CDATA tag.E:

<xmlElement>
   <![CDATA[
   <br> Hey paw! you are cool! [kewl]    ]]>
</xmlElement>


.. see the kewl word was inside the bracket, and that were my problem occur .. iwant to avoid that  error.

FYI im using php to write to the xml file ... and then output the xml values in flash .. is there a way php cud overide this Huh

thanks in advanced!
Logged
Joel Pablo
Server what's that
*
Posts: 6



View Profile Email
« Reply #1 on: 01/29/03, 04:19 »

ooppss ... just read < and > aren't valid CDATA values .. i have to change it to &lt; and so on .. Smiley ... i'll just string replace these characters thru php .... tnx anyways  Grin
Logged
Jorge Solis
Administrator
Systems Administrator
*****
Posts: 14600


View Profile
« Reply #2 on: 01/29/03, 04:45 »

You can replace the [] with another characters or simply by empty spaces using ereg_replace, (that use regexps) I.e

$text = ereg_replace"\[*(\]|\[)", " ", $xmlstring)

In this example, you replace any "[]" in $xmlstring with an empty space

To replace special HTML characters you can use the htmlspecialchars() function, that take a string and return a string with the doble quote, "&", "<" and ">" replaced with the correspond HTML entity

Jorge
« Last Edit: 01/29/03, 04:50 by Jorge Solis » Logged

Joel Pablo
Server what's that
*
Posts: 6



View Profile Email
« Reply #3 on: 01/29/03, 05:12 »

thank you.  Grin
Logged
Pages: [1] Print 
« previous next »
Jump to:  


Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!
anything