5 -DESIGN AN XML DOCUMENT TO STORE INFORMATION ABOUT A STUDENT IN AN ENGINEERING COLLEGE AFFILIATED TO VTU. THE INFORMATION MUST INCLUDE USN, NAME, AND NAME OF THE COLLEGE, BRANCH, YEAR OF JOINING, AND EMAIL ID. MAKE UP SAMPLE DATA FOR 3 STUDENTS. CREATE A CSS STYLE SHEET AND USE IT TO DISPLAY THE DOCUMENT.
SOLUTION 1
prog5.xml
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="PROG5.css"?>
<STUDENTDATA>
<STUDENT>
<USN>USN : 3GN16CS002</USN>
<NAME>NAME : ABHISHEK MALI</NAME>
<COLLEGE>COLLEGE : GNDECB</COLLEGE>
<BRANCH>BRANCH :CSE</BRANCH>
<YEAR>YEAR : 2019</YEAR>
<EMAIL>E-MAIL : abhishek@gmail.com</EMAIL>
</STUDENT>
<STUDENT>
<USN>USN : 3GN16CS029</USN>
<NAME>NAME : KESHAV POLA</NAME>
<COLLEGE>COLLEGE : GNDECB</COLLEGE>
<BRANCH>BRANCH :CSE</BRANCH>
<YEAR>YEAR : 2019</YEAR>
<EMAIL>E-MAIL : keshav@gmail.com</EMAIL>
</STUDENT>
<STUDENT>
<USN>USN : 3GN16CS027</USN>
<NAME>NAME : KARAN DANGE</NAME>
<COLLEGE>COLLEGE : GNDECB</COLLEGE>
<BRANCH>BRANCH :CSE</BRANCH>
<YEAR>YEAR : 2019</YEAR>
<EMAIL>E-MAIL : karan@gmail.com</EMAIL>
</STUDENT>
</STUDENTDATA>
prog5.css
*{
display: block; font-size: 20px;
}
USN {
color: blue;
font-size: 30px;
margin-top: 20px;
}
OUTPUT :( click on image to zoom )
SOLUTION 1
prog5.xml
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="PROG5.css"?>
<STUDENTDATA>
<STUDENT>
<USN>USN : 3GN16CS002</USN>
<NAME>NAME : ABHISHEK MALI</NAME>
<COLLEGE>COLLEGE : GNDECB</COLLEGE>
<BRANCH>BRANCH :CSE</BRANCH>
<YEAR>YEAR : 2019</YEAR>
<EMAIL>E-MAIL : abhishek@gmail.com</EMAIL>
</STUDENT>
<STUDENT>
<USN>USN : 3GN16CS029</USN>
<NAME>NAME : KESHAV POLA</NAME>
<COLLEGE>COLLEGE : GNDECB</COLLEGE>
<BRANCH>BRANCH :CSE</BRANCH>
<YEAR>YEAR : 2019</YEAR>
<EMAIL>E-MAIL : keshav@gmail.com</EMAIL>
</STUDENT>
<STUDENT>
<USN>USN : 3GN16CS027</USN>
<NAME>NAME : KARAN DANGE</NAME>
<COLLEGE>COLLEGE : GNDECB</COLLEGE>
<BRANCH>BRANCH :CSE</BRANCH>
<YEAR>YEAR : 2019</YEAR>
<EMAIL>E-MAIL : karan@gmail.com</EMAIL>
</STUDENT>
</STUDENTDATA>
prog5.css
*{
display: block; font-size: 20px;
}
USN {
color: blue;
font-size: 30px;
margin-top: 20px;
}
OUTPUT :( click on image to zoom )
SOLUTION 2
prog5.xml
<?xml-stylesheet type="text/css" href="5.css" ?>
<!DOCTYPE HTML>
<html>
<head>
<h1> STUDENTS DESCRIPTION </h1>
</head>
<students>
<student>
<USN>USN : 3GN07CS001</USN>
<name>NAME : SANTHOSH</name>
<college>COLLEGE : GNDEC</college>
<branch>BRANCH : Computer Science and Engineering</branch>
<year>YEAR : 2007</year>
<e-mail>E-Mail : santosh@gmail.com</e-mail>
</student>
<student>
<USN>USN : 3GN07IS001</USN>
<name>NAME : MANORANJAN</name>
<college>COLLEGE : GNDEC</college>
<branch>BRANCH : Information Science and Engineering</branch>
<year>YEAR : 2007</year>
<e-mail>E-Mail : manoranjan@gmail.com</e-mail>
</student>
<student>
<USN>USN : 3GN07EC001</USN>
<name>NAME : CHETHAN</name>
<college>COLLEGE : GNDEC</college>
<branch>BRANCH : Electronics and Communication Engineering
</branch>
<year>YEAR : 2007</year>
<e-mail>E-Mail : chethan@gmail.com</e-mail>
</student>
</students>
</html>
prog5.css
student{
display:block; margin-top:10px; color:Navy;
}
USN{
display:block; margin-left:10px;font-size:14pt; color:Red;
}
name{
display:block; margin-left:20px;font-size:14pt; color:Blue;
}
college{
display:block; margin-left:20px;font-size:12pt; color:Maroon;
}
branch{
display:block; margin-left:20px;font-size:12pt; color:Purple;
}
year{
display:block; margin-left:20px;font-size:14pt; color:Green;
}
e-mail{
display:block; margin-left:20px;font-size:12pt; color:Blue;
}
OUTPUT :( click on image to zoom )
prog5.xml
<?xml-stylesheet type="text/css" href="5.css" ?>
<!DOCTYPE HTML>
<html>
<head>
<h1> STUDENTS DESCRIPTION </h1>
</head>
<students>
<student>
<USN>USN : 3GN07CS001</USN>
<name>NAME : SANTHOSH</name>
<college>COLLEGE : GNDEC</college>
<branch>BRANCH : Computer Science and Engineering</branch>
<year>YEAR : 2007</year>
<e-mail>E-Mail : santosh@gmail.com</e-mail>
</student>
<student>
<USN>USN : 3GN07IS001</USN>
<name>NAME : MANORANJAN</name>
<college>COLLEGE : GNDEC</college>
<branch>BRANCH : Information Science and Engineering</branch>
<year>YEAR : 2007</year>
<e-mail>E-Mail : manoranjan@gmail.com</e-mail>
</student>
<student>
<USN>USN : 3GN07EC001</USN>
<name>NAME : CHETHAN</name>
<college>COLLEGE : GNDEC</college>
<branch>BRANCH : Electronics and Communication Engineering
</branch>
<year>YEAR : 2007</year>
<e-mail>E-Mail : chethan@gmail.com</e-mail>
</student>
</students>
</html>
prog5.css
student{
display:block; margin-top:10px; color:Navy;
}
USN{
display:block; margin-left:10px;font-size:14pt; color:Red;
}
name{
display:block; margin-left:20px;font-size:14pt; color:Blue;
}
college{
display:block; margin-left:20px;font-size:12pt; color:Maroon;
}
branch{
display:block; margin-left:20px;font-size:12pt; color:Purple;
}
year{
display:block; margin-left:20px;font-size:14pt; color:Green;
}
e-mail{
display:block; margin-left:20px;font-size:12pt; color:Blue;
}
OUTPUT :( click on image to zoom )
Move the previous DTD to an external file and validate the XML document again.
ReplyDeleteprivius DTD example :Design an XML document to store information about a student in TYBCA. The information must include USN, Name, Name of the College, Branch, Year of Joining, and e-mail id. Make up sample data for 3 students. Create a CSS style sheet and use it to display the document.
👍
ReplyDelete