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

posting ampersand in xml



Don't know if this is a HTTP API problem or not.  I'm hoping someone has seen this issue before and can help me. 
 
We run a RPG program that constructs an xml string from DB2/400 data.  This xml string is then passed to a program that executes the http_url_post_raw function posting the string to a java servlet.  This works fine unless the string contains an ampersand character.  For example, the RPG program (using http_url_post_raw) passes this xml string to the servlet correctly: "<data><id>1234</id><company>SMITH INC </company></data>".  However if the string is equal to "<data><id>3456</id><company>SMITH & WESSON</company></data>" then the program only sends the first 34
 characters to the servlet. 
 
If the xml string contains an ampersand sign then the string is truncated at the ampersand sign.  This truncation causes a problem on the web side because the XML string is incomplete.  Our first impression is that the utility's http_url_post_raw is encoding the spaces in the string correctly but not the ampersand sign.  We have seen some literature that says the ampersand needs to be replaced with "&amp;" - we have tried that in the program that constructs the xml string but that has not worked.
 
Thanks in advance for any help!