XML manipulation in struts

In my struts Application,  From my Action class, I call the manager class and the manager class calls the  DAO calls which would query the DB to fetch the results . Now the requirement is, i need to construct the results in the form of an XML and send it back to my Action class as a " String " . In my action class I need to parse the XML and and get the individual items in the XML

My XML format should be  something like this
<Name> karthick <./Name>
<passwrod> xxxx </password>
<url>www.experts-exchange.com</url>

Please advice



karthickkrishnanAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
krishna kishore mellacheruvu venkataConnect With a Mentor Commented:
0
 
krishna kishore mellacheruvu venkataCommented:
Use Java xml binding for the above scenario. first prepare xsd for the above xml. Through jaxb you can generate POJO for the above xml. from db populate the values in the generated POJO. Then convert POJO to XML in the DAO and send to action class. And then in action class convert again the XML to pojo and access the individual items.
0
All Courses

From novice to tech pro — start learning today.