i have a html or jsp file with the input values ,when i click the submit button it calls a servlet's do post method,so there i need to generate a xml file using some java code, and in that xml file i want to show all the data recieved in request.
Can you share what have you tried and what is not working
The general steps for achieving this would be
1. Read the request
2. Create a file and populate the file based on the request parameters and your business logic
3. Write the file to the response's outputstream
Note: remember to set the content type appropriately
Nope. If you use those DOM methods to create a representation of your XML in memory, and then use an identity transformation to serialize it to disk, you will get well-formed XML. What you showed was HTML, not well-formed XML. Therefore it was not produced in that way. You should review your code and configuration to find out what is really happening.