<DIV>
<DIV>Hello ,</DIV>
<DIV>I am using below code to get data from .html FORM and then buid XML.</DIV>
<DIV>Presently,I am writing the XML I generated to the browser.</DIV>
<DIV> </DIV>
<DIV>I would like to parse the XML thatw as generated and get the values out to insert in the database using JDBC.I know how to use JDBC(connectin,statement,execution ....)</DIV>
<DIV> </DIV>
<DIV>All I am looking for is to parse the XML doc I create and get the values out ...so that I can insert the values in the database....</DIV>
<DIV> </DIV>
<DIV>Your help is highly appreciated....</DIV>
<DIV>thanks</DIV>
<DIV>naveen</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>import java.io.*;<BR>import java.text.*;<BR>import java.util.*;</DIV>
<DIV>import javax.servlet.*;<BR>import javax.servlet.http.*;</DIV>
<DIV>import org.jdom.*;<BR>import org.jdom.input.*;<BR>import org.jdom.output.*;</DIV>
<DIV><BR>public class XML3 extends HttpServlet<BR>{</DIV>
<DIV> public void doGet(HttpServletRequest request,<BR> HttpServletResponse response)<BR> throws IOException, ServletException<BR> {<BR> response.setContentType("text/xml");<BR> PrintWriter out = response.getWriter();</DIV>
<DIV> try<BR> {<BR> Element studentRegistration = new Element("studentRegistration");</DIV>
<DIV> </DIV>
<DIV> Element studentID = new Element("studentID");<BR> studentID.addContent(request.getParameter("studentID"));<BR> studentRegistration.addContent(studentID);</DIV>
<DIV> </DIV>
<DIV> Element firstName = new Element("firstName");<BR> firstName.addContent(request.getParameter("firstName"));<BR> studentRegistration.addContent(firstName);</DIV>
<DIV> </DIV>
<DIV> Element lastName = new Element("lastName");<BR> lastName.addContent(request.getParameter("lastName"));<BR> studentRegistration.addContent(lastName);</DIV>
<DIV> </DIV>
<DIV> Element ssn = new Element("ssn");<BR> ssn.addContent(request.getParameter("ssn"));<BR> studentRegistration.addContent(ssn);</DIV>
<DIV> </DIV>
<DIV> Element address = new Element("address");<BR> address.addContent(request.getParameter("address"));<BR> studentRegistration.addContent(address);</DIV>
<DIV> </DIV>
<DIV> Element city = new Element("city");<BR> city.addContent(request.getParameter("city"));<BR> studentRegistration.addContent(city);</DIV>
<DIV> </DIV>
<DIV> Element state = new Element("state");<BR> state.addContent(request.getParameter("state"));<BR> studentRegistration.addContent(state);</DIV>
<DIV> </DIV>
<DIV> Element zip = new Element("zip");<BR> zip.addContent(request.getParameter("zip"));<BR> studentRegistration.addContent(zip);</DIV>
<DIV> </DIV>
<DIV> Element emailAddress = new Element("emailAddress");<BR> emailAddress.addContent(request.getParameter("emailAddress"));<BR> studentRegistration.addContent(emailAddress);</DIV>
<DIV> </DIV>
<DIV> Element userID = new Element("userID");<BR> userID.addContent(request.getParameter("userID"));<BR> studentRegistration.addContent(userID);</DIV>
<DIV> </DIV>
<DIV> Element password = new Element("password");<BR> password.addContent(request.getParameter("password"));<BR> studentRegistration.addContent(password);</DIV>
<DIV><BR> Document studentRegistrationdoc = new Document(studentRegistration);</DIV>
<DIV> </DIV>
<DIV> XMLOutputter xout = new XMLOutputter(" ", true);<BR> xout.output(studentRegistrationdoc, out);<BR> System.out.println(xout);<BR> }<BR> catch (Exception e)<BR> {<BR> e.printStackTrace();<BR> }<BR> }<BR> public void doPost(HttpServletRequest request,<BR> HttpServletResponse response)<BR> throws IOException, ServletException<BR>
{<BR> doGet(request, response);<BR> }<BR>}</DIV>
<DIV> </DIV></DIV><p><hr SIZE=1>
Do you Yahoo!?<br>
<a href="http://pa.yahoo.com/*http://rd.yahoo.com/evt=1207/*http://promo.yahoo.com/sbc/">SBC Yahoo! DSL</a> - Now only $29.95 per month!