Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa XML jsp and xml

Have Programming Question? Ask it here!
 
 
 


vikas
jsp and xml
1 Answer(s)      6 years and 5 months ago
Posted in : XML


An example of retrive data from xml using JSP.


Advertisement
View Answers

April 4, 2008 at 5:37 PM


Hi

This retrive data from xml using jsp.


airLineShedule.jsp

<%@ page contentType="text/html"%>
<%@ page import="javax.xml.parsers.DocumentBuilderFactory,
javax.xml.parsers.DocumentBuilder,org.w3c.dom.*"
%>
<html>
<body><center>
<table border="1" cellspacing="0", cellpadding="0">

<%
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
Document doc = db.parse("\\airLineShedule.xml");

NodeList nl= doc.getElementsByTagName("Name");
NodeList n1= doc.getElementsByTagName("Address");
NodeList n2= doc.getElementsByTagName("City");
NodeList n3= doc.getElementsByTagName("State");
NodeList n4= doc.getElementsByTagName("Zip");
NodeList n5= doc.getElementsByTagName("Phone");

%>

<tr>
<td colspan="2"><h2>User Information Details</h2></td>
</tr>
<tr>
<td>Name</td>
<td><%= nl.item(0).getFirstChild().getNodeValue() %> </td>
</tr>
<tr><td>Address</td>
<td><%= n1.item(0).getFirstChild().getNodeValue() %> </td>
</tr>
<tr>
<td>City</td>
<td><%= n2.item(0).getFirstChild().getNodeValue() %> </td></tr>
<tr><td>State</td>
<td><%= n3.item(0).getFirstChild().getNodeValue() %> </td></tr>
<tr><td>Zip</td>
<td><%= n4.item(0).getFirstChild().getNodeValue() %> </td></tr>
<tr><td>Phone</td>
<td><%= n5.item(0).getFirstChild().getNodeValue() %> </td></tr>

</table>
</center>
</body>
</html>

airLineShedule.xml

<?xml version="1.0" encoding="UTF-8"?>
<Flights>
<Name>Amardeep Patel</Name>
<Address>Sec-2, Rohini, Delhi-85</Address>
<City>Bhagalpur</City>
<State>Bihar</State>
<Zip>813220</Zip>
<Phone>9810255320</Phone>

</Flights>






Related Tutorials/Questions & Answers:
XML with JSP - XML
XML with JSP  Hai all,, I have a doubt..is it possible to submit jsp form data in to xml... i mean after filling the HTML form when i give submit... the values in to my jsp from XMl..pls help me in this issue
XML to JSP
an xml file and display the data into jsp file...XML to JSP  How to access the following XML tag Title tag in JSP   Please visit the following link: http://www.roseindia.net/jsp
Advertisements
jsp and xml - XML
jsp and xml  An example of retrive data from xml using JSP.  HiThis retrive data from xml using jsp.airLineShedule.jsp<%@ page...;/body></html>airLineShedule.xml<?xml version="1.0" encoding
XML in JSP - JSP-Servlet
XML in JSP  How to read XML in our JSP page. send me any exmple code.  Hi friend, We can read an XML file in the JSP using DOM parser. Here is the link which will help you to understand XML file parsing (reading
parsing xml file in jsp
parsing xml file in jsp  example that pars XML file in JSP
xml in JSP - JSP-Servlet
xml in JSP  This is my code.... Now I am getting only first node. I......   Hi Friend, I am sending you a JSP code which... ========================= parsingxml.jsp Parsing of xml using DOM Parser
XML - JSP-Servlet
XML  How to read XML of a website to display that data in our JSP page. Send me any sample code.  Hi friend, For solving the problem visit to : http://www.roseindia.net/jsp/parsing-xml.shtml Thanks
XML - JSP-Servlet
XML  Hello have a nice time, how to write an web.xml which can access both jsp page and servlet file can you explain with example.. thanking you.   Hi Friend, Do you want the web.xml file? Please clarify
Reading a xml file - JSP-Servlet
Reading a xml file  how to read a xml file using jsp and then i have to retrive a data from that file use it in code?  Hi Friend, Please visit the following link: http://www.roseindia.net/jsp/parsing-xml.shtml
write xml file with jsp useBean - JSP-Servlet
write xml file with jsp useBean  how to write into xml files with jsp... allows our application to obtain a Java XML parser. DocumentBuilderFactory... an org.w3c.dom.Document from XML. Save the xml file at bin file of C:\apache-tomat-5.5.23\bin
sql/xml query in jsp - JSP-Servlet
sql/xml query in jsp  Sir I am coding in jsp and trying to retrieve xml data from db2 using sql/xml query in jsp but getting no result. When running jsp file in browser the output
project in JSP and XML(to store data)
project in JSP and XML(to store data)  I need to complete an assignment in JSP and using XML as Database ,Please help me to complete... of JSP Web Application demonstrating web technology concepts? Create n
sql/xml query in jsp - JSP-Servlet
sql/xml query in jsp  Sir Here is my code which is not working Testing JSP select id from "SYSTEM..." name:PROFILE columns:id (bigint) and INFO (xml) data stored:id=1 and info=nitin
How to access the Title tag from xml to jsp
How to access the Title tag from xml to jsp  How to access the Title tag from xml to jsp   Please visit the following link: http... that will read an xml file and display the data into jsp file
Reading a xml file - JSP-Servlet
Reading a xml file  Thanks for ur answer sir but problem is that i have to do a reading a xml file of a employee record and then i have to use a employee details to send mail to those employees how to do i sir please help me
XML Transformation in JSP
XML Transformation in JSP  ... to demonstrate XML Transformation tag in JSP This example illustrate use of XML transformation tag in JSP file. This example performs transformation from an XML
JSP and XML .data store nd retrieve
JSP and XML .data store nd retrieve  I have made a form in jsp having... in xml file.How can i store data entered by user in XML file and later retrieve data in another jsp page using retrieve submit button.Please tell step by step
How to access the following tag from xml to jsp
How to access the following tag from xml to jsp  How can i get the title where cat="1" and "My Title" from XML File?   Please visit the following link: http://www.roseindia.net/jsp/parsing-xml.shtml The above link
Produces XML file but format not correct for storing data using JSP and XML
Produces XML file but format not correct for storing data using JSP and XML  hii I have created a project using JSP and XML as database to store data... XML file also(wrong format),shows result in JSP page but server shows
how to store data in XML file - JSP-Servlet
how to store data in XML file  hi i have to store the data for example user id and password in a xml file the input userid and password will be coming from jsp middle ware servlet how to do that?   Hi friend
Using JSP in pure XML generating conforming XHTML
; Example program to demonstrate using JSP in pure XML generating conforming XHTML This JSP example describes how JSP tags for XML can be used in XML generation... in JSP files in their XML format is given as below: <jsp:root> <
Delete and edit data in xml file using JSP
Delete and edit data in xml file using JSP   I want to know how to delete and edit data from an XML file by use of JSP. I have XML file having tasks... in the xml file,I want to delete and edit some tasks using task id then how can i do
JSP Write XML
JSP Write XML     ... dynamic XML using JSP. JSP technology is basically used for building HTML pages... illustrate an elaborate example on JSP Write XML. To understand the example we make use
Extract xml to store into db - JSP-Servlet
Extract xml to store into db  Hi all, I need to get the data from the xml file and store it onto the database. Is there anyway of doing this? thanks
How to extract details from XML? - JSP-Servlet
How to extract details from XML?  I want to extract details from http://service.openkapow.com/palanikumar/airportantigua.rest How can i extract details from this link?Here is my program... Airport
XML
XML  How i remove a tag from xml and update it in my xml
xml
xml  why the content written in xml is more secure
xml
xml  validate student login using xml for library management system
xml
xml  validate student login using xml for library management system
xml
xml  what is name space,xml scema give an example for each   XML Namespaces provide a method to avoid element name conflicts.They are used for providing uniquely named elements and attributes in an XML document
XML Parsing Error: mismatched tag. Expected: </br>. - JSP-Servlet
XML Parsing Error: mismatched tag. Expected: .  i had an error:"XML... into an xml file. i use the jspBean to call the writeXML class. pls help me to solve.../jsp/jdo-mparsing-xml.shtml http://www.roseindia.net/jsp/java-beans.shtml
XML
XML  Hi...... Please tel me about that Aren't XML, SGML, and HTML all the same thing? Thanks
xml
xml  how can i remove white space and next line when i copy stream to xml file
XML
XML  create flat file with 20 records. Read the records using xml parser and show required details
XML
XML  please tell me how i remove one tag out of all similar type of tags in xml
xml
xml  what is xml   Extensible Markup Language (XML... that is both human-readable and machine-readable. It is defined in the XML 1.0... gratis open standards. The design goals of XML emphasize simplicity, generality
Reflecting changes in xml files included in jsp page dynamically...
Reflecting changes in xml files included in jsp page dynamically...  ... xml file in my jsp page as:- <%@ include file="Home.xml"%> But when I... not reflect in jsp page, though the xml file has already changed in system...even
Reflecting changes in xml files included in jsp page dynamically...
Reflecting changes in xml files included in jsp page dynamically...  ... xml file in my jsp page as:- <%@ include file="Home.xml"%> But when I... not reflect in jsp page, though the xml file has already changed in system...even
HOW TO STORE MULTIPLE EMPLOYEE DETAILS TO XML FILE USING JSP?
HOW TO STORE MULTIPLE EMPLOYEE DETAILS TO XML FILE USING JSP?  HELLO SIR, CAN ANYONE HELP ME OUT HOW TO STORE MULTIPLE EMPLOYEE DETAILS TO XML... EMPLOYEES SHOULD BE SAVED IN XML FILE AND MY SQL DATABSE TABLES AT A TIME, AND ALSO
sorting and filtering the displayed table data using jsp and xml
sorting and filtering the displayed table data using jsp and xml  I have created a xml file and a jsp file, which uses DOM parser to display the content of xml file in web page. Now I would like to sort and filter those data
XML
XML  Design an XML to maintain book details to do the following: (i) Separate Data (ii) Exchange Data (iii) Store Data (iv) Create new language
xml
xml  Design an XML to maintain book details to do the following: (i) Separate Data (ii) Exchange Data (iii) Store Data (iv) Create new language
xml - XML
://www.roseindia.net/xml/ http://www.roseindia.net/jsp/jdo-mparsing-xml.shtml http...xml  define parser and xml,in jaxp api how to up load parsers... then the program contains syntax errors. XML is defined as an extensible
Display JSP selected listbox and checkbox in xml-please help me
Display JSP selected listbox and checkbox in xml-please help me  Hi, I have three Listbox on my jsp page. I want to do following: ByDefault first... from 1st list box second will fill accordingly by database using jsp. When user
Data needs to be gathered in XML file from the database (MySql) using JSP
in XML file from the database (MySql) using appropriate JSP/Java Bean functions...Data needs to be gathered in XML file from the database (MySql) using JSP  on index.jsp page, where the user will be able to search, with search
XML - XML
XML  What is specific definatio of XML? Tell us about marits and demarits of XML? use of XML? How we can use of XML?  Hi, XML... language much like HTML used to describe data. In XML, tags are not predefined
Use of Core XML tags in JSP
Use of Core XML tags in JSP   ... use of Core XML tag in JSP JSTL (JSP standard tag library) XML tag can.../msg08807.html This example illustrates use of XML core tags into a JSP file
How to store data entered by User in JSP page in XML file
How to store data entered by User in JSP page in XML file  How to store data entered by user in JSP page to be saved in XML file.On clicking submit...   JSP store data entered by user into XML file 1)form.jsp: <html>
Display image on JSP page using XML
Display image on JSP page using XML  ... can display a image on JSP page by using XML.  This example will examine how to parse and expose XML information using the JAXP with a JSP page
XML - XML
XML XSD validation in java  Can anyone help in writing validation for XML XSD in Java
Advertisements
 

 

 

DMCA.com