SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Addict
    Join Date
    Mar 2003
    Location
    Greenville, SC
    Posts
    388
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    xml not parsing colon or quotes through php generated xml file...

    Hello Folks,

    I have created a file where a user enters information (and photos) to a form and submits it to a database. A xml file is then generated do display the information in flash.

    My problem is when the user submits a text entry with a single or double quote sign:

    example: John's house. Or "My friends are cool"

    the xml ceases to parse. Adding the addslashes function doesn't seem to work, because the xml file reads the slash as:

    John\'s house or \"My friends are cool\"


    So I need to have the php file generate the xml to allow the double or single quotes, or an apostrophe be read..... how is this done?

  2. #2
    SitePoint Evangelist superuser2's Avatar
    Join Date
    Aug 2006
    Posts
    598
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    "\My friends are cool\"

    the backslash should go before the quotes, I wonder what's going on there.

    Try htmlentites.

  3. #3
    SitePoint Member
    Join Date
    Mar 2007
    Location
    RTP, NC
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You should be stripslashes()ing and htmlencode()ing your input before sending to XML... (of course you shouldn't stripslashes() if magic_quotes is off)

    As superuser2 said, htmlentities() would work also. If you still have problems post a code snippet.
    Joshua Gitlin
    Senior Developer
    Digital Fruition, LLC
    http://www.digitalfruition.com/


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •