Web Technology Lab Manual
Assignment No. : 3
TECHNNOLOGY
TECHNNOLOGY: XML and CSS
PROBLEM STATEMENT
Design the XML document to store the information of the employees of any business organization
and demonstrate the use of: DTD & XML Schema
And display the content in (e.g., tabular format) by using CSS/XSL.
OUTCOMES
Students will be able to,
1. Design static webpage using XML.
2. Apply CSS to XML pages.
SOFTWARE & HARDWARE REQUIREMENTS
Software: Notepad, Any Browser
THEORY-CONCEPT
XML stands for Extensible Markup Language. It is nothing but the text-based markup language
which is derived from Standard Generalized Markup Language(SGML).
XML tags identify the data and are used to store and organize the data, rather than specifying
how to display it like HTML tags, which are used to display the data. XML is not going to
replace HTML in the near future, but it introduces new possibilities by adopting many
successful features of HTML.
There are three important characteristics of XML that make it useful in a variety of systems and
solutions −
Sinhgad Institute of Technology , lonavala Page 19
Web Technology Lab Manual
Sinhgad Institute of Technology , lonavala Page 20
Web Technology Lab Manual
• XML is extensible − XML allows you to create your own self-descriptive tags, or
language, that suits your application.
• XML carries the data, does not present it − XML allows you to store the data irrespective
of how it will be presented.
XML is a public standard − XML was developed by an organization called the World Wide
Web Consortium (W3C) and is available as an open standard.
TECHNOLOGY/TOOL
The XML document have an XML declaration, but it is optional, and it is written as−
<? xml version = "1.0" encoding = "UTF-8"?>
Where version is nothing but the version of an XML document and UTF specifies the character-
encoding used in the document.
Each XML-element needs to be closed either with start or with end elements as shown below −
<element>………</element>
An XML document can have only one root element.
<root>
<x>...</x>
<y>...</y>
</root>
XML Attributes:
Using a name/value pair, an attribute specifies a single property for an element. An XML-
element can have one or more attributes. For example −
<a href = "http://www.google.com/">XMLTutorial</a>
Here href is the attribute name and http://www.google.com/ is attribute value.
DESIGN/EXECUTION STEPS
Following steps are used to Create and Execute web applications,
1. Write the XML code in notepad and save with .xml extension.
2. Write the CSS code in notepad and save with .css extension.
Sinhgad Institute of Technology , lonavala Page 21
Web Technology Lab Manual
3. Import CSS file in XML page.
4. Open XML page in the browser.
TEST CASES
Manual testing is used to check whether CSS gets applied or not.
CONCLUSION/ANALYSIS
Hence, we have designed static web pages using XML and CSS
PROGRAM CODE & OUTPUT
Book.xml
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="book_catalog.css"?>
<CATALOG>
<BOOK>
<TITLE>Database Management System</TITLE>
<AUTHOR>Korth</AUTHOR>
<PRICE>500</PRICE>
<YEAR>1985</YEAR>
</BOOK>
<BOOK>
<TITLE>Computer Network</TITLE>
<AUTHOR>Tenenbaum</AUTHOR>
<PRICE>600</PRICE>
<YEAR>1985</YEAR>
</BOOK>
<BOOK>
<TITLE>Software Engineering and project Management</TITLE>
<AUTHOR>Roger Pressman</AUTHOR>
<PRICE>600</PRICE>
<YEAR>1985</YEAR>
</BOOK>
</CATALOG>
book_catalog.css
BOOK {
Display: block;
Sinhgad Institute of Technology , lonavala Page 22
Web Technology Lab Manual
margin-left:0;
magin-bottom: 30pt;
}
CATALOG {
Width:100%;
background-color: #ffffff;
}
TITLE {
Color: ff0000;
display: block;
font-size: 20pt;
}
AUTHOR {
display: block;
color: #0000ff;
font-size: 20pt;
}
YEAR, PRICE {
Color:#00000;
Display: block;
Margin-left: 20pt;
}
Output:
Sinhgad Institute of Technology , lonavala Page 23
Web Technology Lab Manual
ORAL QUESTIONS
1. Explain difference between HTML and XML?
2. What is XML DOM?
3. Explain difference between CDATA and PCDATA?
4. What is mean by simple element and complex element?
5. What is XPATH?
6. Explain XSL and XSLT?
Sinhgad Institute of Technology , lonavala Page 24