Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

sending xml to servlet

 
David Westbrook
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hey all,

I have an xml document containing data in html page, and I would like to send that to a servlet.

I'm thinking I can do it one of two ways.

ONE:



I have seen supposedly working examples of this, but they were IE specific, and I'm looking for something that complies w/w3c.

and then on servlet I do something like:




I have a feeling that I need to alter the setRequestHeader, so any suggestions would be helpful.

The other way I think would be possible would be to turn the xml doc into a string and send it like this:



and then do something on servlet like:




problem w/this is xmldoc doesn't have toString().

Any help (thoughts, comments, examples, good references) would be appreciated.
 
Ulf Dittmer
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As to the client side in the browser, any code that does this will have some IE-specific stuff; that's just how XMLHttpRequest is implemented. But that's generally abstracted away by the thinnest layer on top of it; see this for code that works in all browsers.
 
David Westbrook
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have it working perfectly. I will post more details when I get the time. Check back in a couple of days if you're interested.
[ January 02, 2009: Message edited by: David Westbrook ]
 
Pat Farrell
Rancher
Posts: 4678
7
Linux Mac OS X VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Glad to hear that you have it working. One thing you might want to consider, XML compresses well, there is lots of redundancy, so the built in Java gzip code can save a lot of time and bandwidth.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic