This week's book giveaway is in the Design forum.
We're giving away four copies of Building Microservices and have Sam Newman on-line!
See this thread for details.
The moose likes Servlets and the fly likes How to convert query string into xml Structure Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Building Microservices this week in the Design forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "How to convert query string into xml Structure" Watch "How to convert query string into xml Structure" New topic

How to convert query string into xml Structure

Gopi Chand Maddula
Ranch Hand

Joined: May 11, 2010
Posts: 40

Hi Java Ranch,

I am new to web technology. As i am familiar with core java technologies, i started woking on web technologies too.

I facing a problem in which i am getting a response from some server as a query string.
For Example the Query String looks like below....


and i must form an XML Structure based on that query string's key and value. I have no idea how to do it. Please help me by letting me know the best procedure to convert the query string into XML format.
Assume that the xml can be like this.

Thanks in Advance.
Devaka Cooray
ExamLab Creator

Joined: Jul 29, 2008
Posts: 3603

If the keys (parameters) are not pre-defined, you can use getParameterNames() method of HttpServletRequest to get an java.util.Enumeration object which contains the names of the parameters (keys). For getting the values, just iterate among the parameters through the Enumeration object and use getParameter(String) method of HttpServletRequest to get the value for each key.

Author of ExamLab ExamLab - a free SCJP / OCPJP exam simulator
What would SCJP exam questions look like? -- Home -- Twitter -- How to Ask a Question
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: How to convert query string into xml Structure
It's not a secret anymore!