wood burning stoves 2.0*
The moose likes XML and Related Technologies and the fly likes How to dynamically generate then POST xml data? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "How to dynamically generate then POST xml data?" Watch "How to dynamically generate then POST xml data?" New topic
Author

How to dynamically generate then POST xml data?

James Hodgkiss
Ranch Hand

Joined: Jan 22, 2004
Posts: 401
I'm new to XML and need to create a web app needs to do the following:
1. Read a couple of parameters (username and password) from the request
2. Dynamically create some xml code with those params
3. Send the xml code to another web service for validation

I am struggling with steps 2 and 3. Have been reading a lot on XML and SAX but the possible solutions I'm looking at seem really heavy. Is there a simple / straightforward way of doing what I need? Any code samples/snippets would be much appreciated.

Cheers,
James
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12761
    
    5
The simplest thing to do is just treat this as a problem in generating text and ignore the XML APIs.

If you can create/edit a text file that is a legal XML document containing example data, use that as a template and fill in the changing values at runtime.

I did this as a quick fix for a customer, so very very much simpler and faster than creating a DOM in memory and serializing it.

Another possibility would be to use JAXB .

Bill

 
 
subject: How to dynamically generate then POST xml data?
 
Similar Threads
advise on using XML in the application
Dynamically building web content using XML file(s)
Dynamically building web content using XML file(s)
How to make an xml file downloadable thru jsp which xml file is created dynamically?
How to add attributes when creating xml dynamically through Database