xml or database

Ads
 

xml or database

View Answers

December 3, 2008 at 10:53 PM

Hi friend,


Code to help in solving the problem :

"parsingxml.jsp"

<%@ page import= "org.jdom.*, java.util.*,
org.jdom.input.SAXBuilder" %>
<%
SAXBuilder saxBuilder = new SAXBuilder();
Document doc = saxBuilder.build
("http://localhost:8080/ServletExample/roseindia.xml";);
%>
<html>
<head><title>Parsing of xml using JDOM</title></head>
<body>
<h1><font color='green'>Employees of Roseindia</font></h1>
<table border="2">
<tr>
<th><font color='blue'>Name of Employee</font></th>
<th><font color='blue'>Date of Birth</font></th>
<th><font color='blue'>City</font></th>
</tr>
<%
List list = doc.getRootElement().getChildren();
Iterator iter = list.iterator();
while (iter.hasNext()){
Element element = (Element) iter.next();
List NameDOBCity = element.getChildren();
Iterator listIter = NameDOBCity.iterator();
%>
<tr>
<%
while ( listIter.hasNext() ){
Element childNode = (Element) listIter.next();
%>
<td><%= childNode.getText() %></td>
<%
}
}
%>
</tr>
</table>
</body>
</html>

"roseindia.xml"

<?xml version="1.0" encoding="ISO-8859-1"?>

<roseindia>

<employee>
<name>Sandeep Kumar suman</name>
<date-of-birth>15-02-84</date-of-birth>
<city>Gorakhpur</city>
</employee>

<employee>
<name>Amit Raghuvanshi</name>
<date-of-birth>19-12-86</date-of-birth>
<city>Lucknow</city>
</employee>

<employee>
<name>Vineet Bansal</name>
<date-of-birth>05-02-83</date-of-birth>
<city>Sonipat</city>
</employee>

<employee>
<name>Vikas Singh</name>
<date-of-birth>05-12-88</date-of-birth>
<city>Hazipur</city>
</employee>

<employee>
<name>Anusmita Singh</name>
<date-of-birth>28-12-84</date-of-birth>
<city>Bareilly</city>
</employee>

</roseindia>

Thanks

Ads









Related Tutorials/Questions & Answers:
database data in xml format
database data in xml format  HI, i want to display the database data in the xml format(not as xml file ) on the console using DOM. help will be appreciated. THANKS K.K
XML parsing to Mysql database
XML parsing to Mysql database  Can someone please post the code for parsing an XML file into Mysql database using SAX
Advertisements
How to convert XML file to database ?
How to convert XML file to database ?  How to convert XML file to database
retrieving xml document from database
retrieving xml document from database  Hi Guys, I want to retrieve the xml document stored in the database on to a jsp page using jdbc/odbc connnection.Please help me in implementing this feature. Thank You Madhu
Store XML file into Sqlserver Database
Store XML file into Sqlserver Database  Code for storing a typical XML file into SQl server database in 1 or more tables using asp.net using C
simple code for XML database in JS
simple code for XML database in JS  Sir , i want a code in javascript for XML database to store details (username and password entered by user during registration process (login process)). please send me a code . Thank you
converting an xml file in relational database objects
converting an xml file in relational database objects  converting an xml file in relational database objects
complex xml parsing and storing in database - XML
complex xml parsing and storing in database  Hi Experts ,i want to parse my xml document and store it in mysql database. This is my code. How to parse this complex data. EDI_DC40 800 0000000000557748
data insertion from xml file to database table
data insertion from xml file to database table  Hi all, I have data in the XML file. I need to insert it into table in the database using servlet. so please reply me . ThankYou
Store XML file into Sqlserver Database
Store XML file into Sqlserver Database  Code for storing a typical XML file into SQl server database in 1 or more tables using asp.net using C#. <?xml version="1.0" ?> <!DOCTYPE PubmedArticleSet (View Source
Solution to get vaues for xml tags fform sql database in java
Solution to get vaues for xml tags fform sql database in java  hi I have written a code in java to get these xml tags < company comp:loc=" "/>...(" "). how do i get these values.. already connected database and created xml tags
Want solution to get values for xml namespace tags from database in java
Want solution to get values for xml namespace tags from database in java  hi I have written a code in java to get these xml tags < company comp:loc=" "/> now i need to get values from sql database for values in the blank
Insert XML file data to database
Insert XML file data to database In this tutorial, you will learn how to insert the xml file data to database using dom parser. You all are aware of XML... to read the xml file data and save the values of an XML file to a Database
Data needs to be gathered in XML file from the database (MySql) using JSP
Data needs to be gathered in XML file from the database (MySql) using JSP ... data regarding particular id from the database table. Data needs to be gathered in XML file from the database (MySql) using appropriate JSP/Java Bean functions
Need solution to get values for XML namespace tags from SQL database in Java
Need solution to get values for XML namespace tags from SQL database in Java  hi I have written a code in java to get these xml tags < company comp:loc=" "/> now i need to get values from sql database for values
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
XML  please tell me how i remove one tag out of all similar type of tags in xml
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  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
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
database
database  database
database
database  database application
XML to XML Mapping
XML to XML Mapping  Hi Dear Developer Team, I would like to know how does XML-to-XML and XML-to-database Mapping works? I do not want use any... Database-Table(Source/Target)? With best regards, Fartos
database
database  the code for initializing the database connection
database
database  i want to let the user select the name of database and then delete that database.......im doing project in swings netbeans

Ads