#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2013
    Posts
    5
    Rep Power
    0

    XML as data in HTML form post : how to escape special characters(x-postedTo HTMLForum


    Hi. I have an HTML form where the data for one of the input fields is an xml string.

    <htmlCode>
    <form action="xxx" method="post">
    <input type='hidden' id='myName' name='myName' value='joe'/>
    <input type='hidden' id='myXML' name='myXML' value='<myData><userid value="123"/><remarks text="age is &lt; 65"/></myData>'/>
    </form>
    </htmlCode>


    where xxx is some url.

    My question is : When I post this form, "&lt;" is being URLencoded and changed to %3C. However, on the destination side, the data sent over is not valid, since it thinks that the opening "<" for the remarks tag is not closed.

    How can I send data containing characters such as "<" in an xml string that is a value of an input element in a form post correctly?

    Any help is appreciated.

    -Andrew

    P.S. I'm x-posting this to the HTML Programming forum since part of it involves HTML
  2. #2
  3. Transforming Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    14,122
    Rep Power
    9398
    Originally Posted by ndrw_cheung
    P.S. I'm x-posting this to the HTML Programming forum since part of it involves HTML
    Please don't.

IMN logo majestic logo threadwatch logo seochat tools logo