• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

how to send & by appending the URL

 
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi guys,

I want to send a XML file to the Server (which may have ampersand symbol in the XML file), when I trying to get that I am able to get only the half of that XML file. Is there any way to get the complete XML STRING (with & inside it?)
 
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How are you sending the xml file.As query string or POST ?
 
Abdul Kader
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As a Query String . i am using AJAX to that
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can replace & with another charactor(which is not used in the xml file) like "@" or "#" and post then, in the servelet U can easily replace that with &

or

convert whole xml to unicode and send unicode as a string, then convert back in the servelet
 
Abdul Kader
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't believe replace things will not be a good solution.is there any other solution other than that. thanks for your time
 
Rahul Bhattacharjee
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Query string always have character limitation , why donot you use POST instead , With AJAX also you can make POST method call.
 
Abdul Kader
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


See this code i am using to send the DATA to the Server the both XML file may have &. And i am using POST method .please let me know if you have any inputs on this
 
Rahul Bhattacharjee
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Yousuff Mohammed:

See this code i am using to send the DATA to the Server the both XML file may have &. And i am using POST method .please let me know if you have any inputs on this



Is this working ?
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Yousuff Mohammed:
I don't believe replace things will not be a good solution.is there any other solution other than that. thanks for your time



Why don't you believe it will be a good idea?

If your text has querystring control characters, then they will need to be replaced before sending them as part of a querystring.
There is no way around that.
 
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yousuff,

The ampersand character is obviously a url reserved character and you need to encode it as %26 when it's part of the url.

Regards,
Dan
 
Rahul Bhattacharjee
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I see there are two things in the question:
a> You want to have ampersand in the query string.

b> You are not getting the complete xml file in the servlet.

For a) as many have mentioned that you have URLEncode the stuff.

For b) as you are not getting the complete xml file may be because of the character restriction of URL.Try using POST instead.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic