Professional Documents
Culture Documents
Unit 2 WT
Unit 2 WT
Web Page Designing: HTML: List, Table, Images, Frames, forms, CSS, Document type definition, XML:
DTD, XML schemes, Object Models, presenting and using XML, Using XML Processors: DOM and SAX,
Dynamic HTML
HTML
What is HTML?
Stands for Hypertext Markup Language.
Most documents that appear on the World Wide Web were written in HTML.
HTML is a markup language, not a programming language. In fact, the term HTML is an
acronym thatstands for Hypertext Markup Language.
We can apply this markup language to your pages to display text, images, sound and movie
files, andalmost any other type of electronic information.
We use the language to format documents and link them together, regardless of the type of
computer with which the file was originally created.
HTML Elements
An element consists of three basic parts: an opening tag, the element's content, and finally,
a closing tag.
<p> - opening paragraph tag
Element Content - paragraph
words
</p> - closing tag
Every (web) page requires four critical elements: the html, head, title, and body elements.
1. <html> Element...</html>
o <html> begins and ends each and every web page.
o Its purpose is to encapsulate all the HTML code and describe the HTML document
to theweb browser.
<html></html>
2. <head> Element
o The <head> element is "next" as they say. As long as it falls somewhere between your
<html>tag and your web page content (<body>).
o The head functions "behind the scenes." Tags placed within the head element are not
directly displayed by web browsers.
o We will be placing the <title> element here.
o Other elements used for scripting (JavaScript) and formatting (CSS) will eventually be
introduced and you will have to place them within your head element.
<html>
<head>
</head>
</html>
The <title> Element
o Place the <title> tag within the <head> element to title your page.
o The words you write between the opening and closing <title></title> tags will be
displayed at thetop of a viewer's browser.
<html><head><title>My WebPage!</title></head></html>
HTML Tags
o A web browser reads an HTML document top to bottom, left to right.
o Each time the browser finds a tag, it is displayed accordingly (paragraphs look like
paragraphs, tables look like tables, etc).
o Tags have 3 major parts: opening tag(s), content(s), and closing tag(s).
o Recall that a completed tag is termed an element.
<html><body>
<h1>This is heading 1</h1><h2>This is heading 2</h2><h3>This is heading 3</h3>
<h4>This is heading 4</h4><h5>This is heading 5</h5><h6>This is heading 6</h6>
</body></html>
3. Line Breaks
o Line breaks are different then most of the tags we have seen so far. A line break ends
the lineyou are currently on and resumes on the next line.
<p>Darshan<br /> Computer<br /></p>
HTML Lists
o There are 3 different types of lists.
o A <ol> tag starts an ordered list, <ul> for unordered lists, and <dl> for definition lists.
1. <ul> - unordered list; bullets
2. <ol> - ordered list; numbers
3. <dl> - definition list; dictionary
<ol>
<li>Find a Job</li>
<li>Move Out</li>
</ol>
o Start your ordered list on any number besides 1 using the start attribute.
o There are 4 other types of ordered lists. Instead of generic numbers you can replace
them with Roman numerals or letters, both capital and lower-case. Use the type
attribute to change the numbering.
<oltype="a">
<oltype="A">
<oltype="i">
<ol type="I">
</ol>
<ul>
<li>Milk</li>
<li>Chocolate</li>
</ul>
<oltype="square">
<ol type="disc">
<oltype="circle">
</ol>
<dl>
<dt><b>Fromage</b></dt>
<dd>French word for cheese.</dd>
<dt><b>Voiture</b></dt>
<dd>French word for car.</dd>
</dl>
4. HTML Nested Lists
o You can also nest one list within another, so you could make an unordered list
inside a
<html>
<ol>
<li> Clear out garage</li>
<ul>
<li> Tomatoes</li>
</ul>
<li> repair fence </li>
</ol>
</html
numbered >
one:
HTML Color Coding System - Color Names
There are 3 different methods to set color.
<body bgcolor=”red”>
<font color=”red”>
<body bgcolor=”rgb(72,0,0)”>
<font color=”rgb(72,0,0)”>
<body bgcolor=”#ffff00”>
<font color=”#ffff00”>
1. Font Size
o Set the size of your font with size. The range of accepted values is from 1(smallest) to
7(largest).The default size of a font is 3.
2. Font Color
o Set the color of your font with color.
3. Font Face
o Choose a different font face using any font you have installed.
HTML Code:
<html><body>
<basefont size="2" color="green"><p>This paragraph has had its font...</p>
</basefont>
</body></html>
Internal - href="#anchorname"
Local -
href="../pics/picturefile.jpg"
Global -
href=http://www.xyz.com/
HTML – Images
o Use the <img /> tag to place an image on your web page.
<imgsrc="sunset.gif" />
1. Image src
o Above we have defined the src attribute.
o Src stands for source, the source of the image or more appropriately, where the picture
file is located.
o There are two ways to define the source of an image. First you may use a standard URL.
(src=http://www.Xyz.com/pics/htmlT/sunset.gif) As your second choice, you may copy
or upload the file onto your web server and access it locally using standard directory tree
methods. (src="../sunset.gif")
o The location of this picture file is in relation to your location of your .html file.
URL Types:
Local Src Location Description
src="sunset.gif" picture file resides in same directory as .html
file
src="../sunset.gif" picture file resides in previous directory as
.htmlfile
src="../pics/sunset.gif" picture file resides in the pic directory in a
previous directory as .html file
2. Alternative Attribute
o The alt attribute specifies alternate text to be displayed if for some reason the browser
cannot find the image, or if a user has image files disabled.
5. Images as Links
o Images are very useful for links and can be created with the HTML below.
<a href="http://www.xyz.com/"><imgsrc="sunset.gif"></a>
HTML Forms
o A form will take input from the viewer and depending on your needs, you may store that
data into a file, place an order, gather user statistics, register the person to your web
forum, or maybe subscribe them to your weekly newsletter.
Making a Form
o <form> is main tag to build a form.
o It has a few optional attributes too. Below is an example of the form element.
o The action attribute tells the HTML where to send the collected information, while the
methodattribute describes the way to send it.
Type of Input
o The main tag for collecting information from the user is <input>.
o The tag itself contains a name attribute, so that we can refer to the input by a name, and
the sizeof the entry box in characters.
o There are quite few different types of input to choose from:
o <input type=”text”/> this is the default input type and accepts characters and numbers
into a text box. It can also have a value attribute attached to it, which will give it an initial
value.
o <input type=”password”/> this is similar to the above text box but anything that is typed
cannot be seen; instead an asterisk is printed to cover up the entry. As the name
suggests, this is used for password entry.
o <input type=”checkbox”/> this gives a box that can be toggled between checked and
unchecked. It can initially be set to one or the other with checked=”checked”.
o <input type=”radio”/> this is similar to checkbox but in group of radio buttons only one
can be selected at a time. This can also have an initial checked state on one of the radio
buttons.
o <input type=”file”/>This will give a box to allow you to choose a file similar to when you
open or save files usually on your machine. It can be used to select a file on the local
machine for upload to a server.
<form method="post"
action="mailto:youremail@email.com">What kind of
shirt are you wearing? <br />
Shade:
<input type="radio" name="shade" value="dark">Dark
<input type="radio" name="shade" value="light">Light <br />
</form>
<form method="post"
action="mailto:youremail@email.com"> Select your
favorite cartoon characters.
<input type="checkbox" name="toon" value="Goofy">Goofy
<input type="checkbox" name="toon" value="Donald">Donald
<input type="checkbox" name="toon" value="Bugs">Bugs Bunny
</form>
HTML Drop Down Lists
o Drop down menues are created with the <select> and <option> tags. <select> is the list
itself and each <option> is an available choice for the user.
<form method="post"
action="mailto:youremail@email.com"> College Degree?
<select name="degree">
<option>Choose One</option>
<option>Some High School</option>
<option>High School Degree</option>
</select>
</form>
<form method="post"
action="mailto:youremail@email.com"> Musical Taste
<select multiple name="music" size="4">
<option value="emo" selected>Emo</option>
<option value="metal/rock" >Metal/Rock</option>
<option value="hiphop" >Hip Hop</option><option value="ska" >Ska</option>
<option value="jazz" >Jazz</option>
</form>
HTML Tables
o The <table> tag is used to begin a table. Within a table element are the <tr> (table rows)
and
<td> (table columns) tags.
<table border="1">
<tr><td>Row 1 Cell 1</td><td>Row 1 Cell 2</td></tr>
<tr><td>Row 2 Cell 1</td><td>Row 2 Cell 2</td></tr>
</table>
o And now we will change the cellpadding of the table and remove the cellspacing
from the previous example.
1. Name:
Thename attribute specifies
thenameofaformwhichisusedtoreferenceelementsinaJavaScript.
2. Action:
The required action attribute specifies where to send the form‐data when
a form issubmitted.
<form action="URL"> Value : URL
Description : Where to send the form
data.
3. Method :
The method attribute specifies how to send form‐data (the form‐data is
sent to thepagespecified in the action attribute).
<form
method="get|post">
Value : get
Description : Default. Appends the form‐data to the URL in
name/value pairs:URL?name=value&name=value
Value : post
Description : Sends the form‐data as an HTTP post transaction.
4. Target
The target attribute specifies a name or a keyword that indicates where to
display the response that is received after submitting the form.
<form target="_blank|_self|_parent|_top|framename">
Value Description
_blank Theresponseisdisplayedinanewwindowortab
_self Theresponseisdisplayedinthesameframe(thisisdefault)
_parent Theresponseisdisplayedintheparentframe
_top Theresponseisdisplayedinthefullbodyofthewindow
framename Theresponseisdisplayedinanamedframe
What is CSS?
CSS stands for Cascading Style Sheets
Styles define how to display HTML elements
External Style Sheets can save a lot of work
External Style Sheets are stored in CSS files
Importance of CSS
CSS defines HOW HTML elements are to be displayed.
Styles are normally saved in external .css files. External style sheets enable you to
change theappearance and layout of all the pages in a Web site, just by editing one single
file.
Cascading Style Sheets, fondly referred to as CSS, is a simple design language intended to simplify the
process of making web pages presentable.
CSS handles the look and feel part of a web page. Using CSS, you can control the color of the text, the
style of fonts, the spacing between paragraphs, how columns are sized and laid out, what background
images or colors are used, layout designs,variations in display for different devices and screen sizes as
well as a variety of other effects.
CSS is easy to learn and understand but it provides powerful control over the presentation of an HTML
document. Most commonly, CSS is combined with the markup languages HTML or XHTML.
Advantages of CSS
CSS saves time − You can write CSS once and then reuse same sheet in multiple HTML pages. You
can define a style for each HTML element and apply it to as many Web pages as you want.
Pages load faster − If you are using CSS, you do not need to write HTML tag attributes every time.
Just write one CSS rule of a tag and apply it to all the occurrences of that tag. So less code means
faster download times.
Easy maintenance − To make a global change, simply change the style, and all elements in all the
web pages will be updated automatically.
Superior styles to HTML − CSS has a much wider array of attributes than HTML, so you can give a
far better look to your HTML page in comparison to HTML attributes.
Multiple Device Compatibility − Style sheets allow content to be optimized for more than one
type of device. By using the same HTML document, different versions of a website can be
presented for handheld devices such as PDAs and cell phones or for printing.
Global web standards − Now HTML attributes are being deprecated and it is being recommended
to use CSS. So its a good idea to start using CSS in all the HTML pages to make them compatible to
future browsers.
CSS Syntax
A CSS rule has two main parts: a selector, and one or more declarations:
The id Selector
The id selector is used to specify a style for a single, unique element.
The id selector uses the id attribute of the HTML element, and is defined with a "#".
The style rule below will be applied to the element with id="para1":
#para1
{ text-align:center; color:red; }
.center {text-align:center;}
We can use more than one class in a single element
File Creation
o Open up notepad.exe, or any other plain text editor and type the following CSS code.
body{ background-color: gray;} p { color: blue; }h3{ color:
white; }
o Save the file as a CSS (.css) file.
o Name the file "test.css" (without the quotes). Now create a new HTML file and fill
it with the following code.
<html><head>
<link rel="stylesheet" type="text/css" href="test.css" /></head>
<body>
<h3> A White Header </h3>
<p> This paragraph has a blue font.
The background color of this page is gray because we changed it with CSS! </p>
</body></html>
2. Internal/Embedded CSS
o This type of CSS is only for Single Page.
o When using internal CSS, we must add a new tag, <style>, inside the <head>
tag. TheHTML code below contains an example of <style>'s usage.
<html><head>
<style type="text/css"></style>
</head><body>
<p>Your page's content!</p></body>
</html>
3. Inline CSS
o It is possible to place CSS right in your HTML code, and this method of CSS
usage isreferred to as inline css.
o Inline CSS has the highest priority out of external, internal, and inline CSS.
o This means that you can override styles that are defined in external or internal
by using inline CSS.
o If you want to add a style inside an HTML element all you have to do is specify the
desiredCSS properties with the style HTML attribute.
<html><head>
<link rel="stylesheet" type="text/css" href="test.css" /></head>
<body>
<p style="background: blue; color: white;">A new background andfont color
withinline CSS</p></body>
</html>
p { font-variant: small-caps; }}
2. Text Indent
o The text-indentation property is used to specify the indentation of the first line of a text.
p { text-indent: 20px; } h5 { text-indent: 30%; }
3. Text Align
o The text-align property is used to set the horizontal alignment of a text.
p { text-align: right; }
h5{ text-align:
justify; }
4. Text Transform
o The text-transform property is used to specify uppercase and lowercase letters in a text.
The top, right, bottom, and left margin can be changed independently using separate
properties. Ashorthand margin property can also be used, to change all margins at once.
Valu Description
e s
auto The browser calculates a margin
length Specifies a margin in px, pt, cm, etc. Default value is 0px
% Specifies a margin in percent of the width of the
containing element
inherit Specifies that the margin should be inherited from the
parent element
2. Border Width
o The border-width property is used to set the width of the border.
3. Border Color
o The border-color property is used to set the color of the border.
o Border colors can be any color defined by RGB, hexadecimal, or key terms. Below
is anexample of each of these types.
ol { list-style-type: upper-
roman; }ul { list-style-type:
circle; }
ul { list-style-image:
url("listArrow.gif"); } ol { list-style-
image: url("listArrow2.gif"); }
3. CSS List Position
o With Specify that the the list-item markers should appear inside the content flow
(results in an extra indentation)
ul { list-style-position: inside;
} ol { list-style-position:
outside; }
Note: "Outside" is actually the default setting for indentation.
Explain CSS Links
a:link {background-
color:#B2FF99;} a:visited
{background-color:#FFFF85;}
a:hover {background-
color:#FF704D;} a:active
{background-color:#FF704D;}
XML
What is XML?
XML is a meta-language, which can be used to store data & act as a mechanism to transfer
information between dissimilar systems.
XML stands for EXtensible Markup Language.
XML is a markup language much like HTML.
XML was designed to describe data.
XML tags are not predefined in XML. You must define your own tags.
XML is self describing.
XML uses a DTD (Document Type Definition) to formally describe the data.
<?xml version=”1.0”?>
<Person>
<Firstname>Ralph</Firstname>
<Lastname>Mosely</Lastname>
</Person>
XML stands for Extensible Markup Language. It is a text-based markup language 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
−
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.
XML Usage
A short list of XML usage says it all −
XML can work behind the scene to simplify the creation of HTML documents for large web sites.
XML can be used to exchange the information between organizations and systems.
XML can be used for offloading and reloading of databases.
XML can be used to store and arrange the data, which can customize your data handling needs.
XML can easily be merged with style sheets to create almost any desired output.
Virtually, any type of data can be expressed as an XML document.
What is Markup?
XML is a markup language that defines set of rules for encoding documents in a format that is both
human-readable and machine-readable. So what exactly is a markup language? Markup is information
added to a document that enhances its meaning in certain ways, in that it identifies the parts and how
they relate to each other. More specifically, a markup language is a set of symbols that can be placed in
the text of a document to demarcate and label the parts of that document.
Following example shows how XML markup looks, when embedded in a piece of text −
<message>
<text>Hello, world!</text>
</message>
This snippet includes the markup symbols, or the tags such as <message>...</message> and <text>...
</text>. The tags <message> and </message> mark the start and the end of the XML code fragment. The
tags <text> and </text> surround the text Hello, world!.
Difference between XML and HTML
XML HTM
L
XML was designed to store data and HTML was designed to display data.
transferthe
data.
XML focuses on what data is. HTML focus on how data looks.
In XML you can design your own tag. HTML has predefined tags.
XML uses parser to check & read xml fileseg. HTML don’t use any kind of parser
DOM,
SAX
Use of XML
Used to exchange data between dissimilar systems.
Used to describe content of document.
XML can be used as database to store data.
Features of XML
XML has its own tag so it’s self describing.
Language Independent:Any language is able to read & write XML.
OS Independent: can be work on any platform.
Readability: It’s a plain text file in user readable format so you can edit or viewin simple editor.
Hierarchical: It has hierarchical structure which is powerful to express complex data and
simple to understand.
<bookstore>
<book category="CHILDREN">
<title>Harry Potter</title>
<author>J K. Rowling</author>
<year>2005</year>
<price>29.99</price>
</book>
</bookstore>
<file type="gif">computer.gif</file>
Xmlns=”http://www.mydomian.com/ns/animals/1.1”
Create a XML file that contains Book Information.
<xml version=”1.0”?>
<bookstore>
<book>
<title>Learning XML</title>
<author>Erik T. Ray</author>
<year>2003</year>
<price>39.95</price>
</book>
<book>
<title>WAD</title>
<author>Ralph Mosely</author>
<year>2001</year>
<price>395</price>
</book>
</bookstore>
Internal DTD
o This is an XML document with a Document Type Definition:
<?xml version="1.0"?>
<!DOCTYPE note [
<!ELEMENT note (to,from,heading,body)>
<!ELEMENT to (#PCDATA)>
<!ELEMENT from (#PCDATA)>
<!ELEMENT heading (#PCDATA)>
<!ELEMENT body (#PCDATA)>
]><note>
<to>Ravi</to>
<from>Ketan</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>
<?xml version="1.0"?>
<!DOCTYPE note SYSTEM "note.dtd">
<note>
<to>Ravi</to>
<from>Narendra</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>
o This is a copy of the file "note.dtd" containing the Document Type Definition:
<?xml version="1.0"?>
<!ELEMENT note (to,from,heading,body)>
<!ELEMENT to (#PCDATA)>
<!ELEMENT from (#PCDATA)>
<!ELEMENT heading (#PCDATA)>
<!ELEMENT body (#PCDATA)>
DTD - Elements
In the DTD, XML elements are declared with an element declaration. An element
declaration has the following syntax:
<!ELEMENT element-name
(#CDATA)>or
<!ELEMENT element-name
(#PCDATA)>or
<!ELEMENT element-name
(ANY)>example:
<!ELEMENT note (#PCDATA)>
o #CDATA means the element contains character data that is not supposed to be
parsed byaparser.
o #PCDATA means that the element contains data that IS going to be parsed by a parser.
o The keyword ANY declares an element with any content.
o If a #PCDATA section contains elements, these elements must also be declared.
Elements with children (sequences)
o Elements with one or more children are defined with the name of the children
elementsinside the parentheses:
<!ELEMENT element-name (child-element-
name)>or
<!ELEMENT element-name (child-element-name,child-element-name,. )>
example:
<!ELEMENT note (to,from,heading,body)>
o When children are declared in a sequence separated by commas, the children must
appearin the same sequence in the document. In a full declaration, the children must
also bedeclared, and the children can also have children. The full declaration of the
notedocument will be:
<!ELEMENT note (to,from,heading,body)>
<!ELEMENT to (#CDATA)>
<!ELEMENT from (#CDATA)>
<!ELEMENT heading (#CDATA)>
<!ELEMENT body (#CDATA)>
Wrapping
o If the DTD is to be included in your XML source file, it should be wrapped in
aDOCTYPEdefinition with the following syntax:
o The * sign in the example above declares that the child element message can occur
zeroor more times inside the note element.
Declaring zero or one occurrences of the same element
o The? Sign in the example above declares that the child element message can occur
zeroor one times inside the note element.
DTD – Attributes
Attributes provide extra information about elements.
Attributes are placed inside the start tag of an element.
Declaring Attributes
o In the DTD, XML element attributes are declared with an ATTLIST declaration.
Anattributedeclaration has the following syntax:
o As you can see from the syntax above, the ATTLIST declaration defines the
elementwhich can have the attribute, the name of the attribute, the type of the
attribute, and thedefault attribute value.
o The attribute-type can have the following values:
Value Explanatio
n
CDATA The value is character data
(eval|eval|..) The value must be an enumerated value
ID The value is an unique id
IDREF The value is the id of another element
IDREFS The value is a list of other ids
NMTOKEN The value is a valid XML name
NMTOKENS The value is a list of valid XML names
ENTITY The value is an entity
ENTITIES The value is a list of entities
NOTATION The value is a name of a notation
xml: The value is predefined
DTD example:
<!ELEMENT square EMPTY>
<!ATTLIST square width CDATA
"0">XML example:
<square width="100"></square>
o In the above example the element square is defined to be an empty element with
theattributes width of type CDATA. The width attribute has a default value of 0.
XML Schema
An XML Schema describes the structure of an XML document.
XML Schema is an XML-based alternative to DTD.
The XML Schema language is also referred to as XML Schema Definition (XSD).
XML Schema is a W3C Recommendation.
XML Schema is commonly known as XML Schema Definition (XSD). It is used to describe and
validate the structure and the content of XML data. XML schema defines the elements,
attributes and data types. Schema element supports Namespaces. It is similar to a database
schema that describes the data in a database.
XSD Elements
XML Schemas define the elements of your XML files. It’s of two types:
o Simple
o Complex Type
<lastname>Refsnes</lastname>
<age>36</age>
<dateborn>1970-03-27</dateborn>
<product pid="1345"/>
o A complex XML element, "employee", which contains only other elements:
<employee>
<firstname>John</firstname>
<lastname>Smith</lastname>
</employee>
o A complex XML element, "food", which contains only text:
<description>
It happened on <date lang="norwegian">03.03.99</date> ....
</description>
XSD Attributes
Simple elements cannot have attributes. If an element has attributes, it is considered to
be of acomplex type. But the attribute itself is always declared as a simple type.
How to Define an Attribute?
o The syntax for defining an attribute is:
XML Parsers
An XML parser is a software library or package that provides interfaces for client applications to work
with an XML document. The XML Parser is designed to read the XML and create a way for programs to
use XML.
XML parser validates the document and check that the document is well formatted.
Let's understand the working of XML parser by the figure given below:
There are two types of XML parsers namely Simple API for XML and Document Object Model.
SAX
DOM
SAX (Simple API for XML), is the most widely adopted API for XML in Java and is considered the de -
facto standard. Although it started as a library exclusive to Java, it is now a well-known API distributed
over a variety of programming languages. It is an open-source project and has recently switched to
SourceForge project infrastructure that makes it easier to track open SAX issues outside the high-
volume XML-dev list. The current latest version as of 01/10/2018 is SAX 2.0. It uses an event-driven
serial-access mechanism for accessing XML documents and is frequently used by applets that need to
access XML documents because it is the fastest and least memory-consuming API available for parsing
XML documents. The mechanism SAX uses makes it independent of the elements that came before, i.e.
it is state-independent.
DOM stands for Document Object Model. The DOM API provides the classes to read and write an XML
file. DOM reads an entire document. It is useful when reading small to medium size XML files. It is a
tree-based parser and a little slow when compared to SAX and occupies more space when loaded into
memory. We can insert and delete nodes using the DOM API.
Now, the package that provides linkage applications for clients that work with an XML document is
called an XML Parser. It was planned to read the XML documents. An XML Parser was created for doing
programs to use XML.
SAX Parser
SAX represents a simple API for XML and a SAX API is implemented by SAX Parser. This API was called
event-based API which provides interfaces on handlers. There are four handler interfaces.
ContentHandler, DTDHandler, EntityResolver, and ErrorHandler interface. It does not create any
internal structure rather it takes the occurrences of components of an input document as events, and
then it tells the client what it reads as it reads through the input document. It is suitable for large XML
files because it doesn’t require loading the whole XML file.
Features Of SAX Parser
The internal structure can not be created by SAX Parser.
These event-based SAX parsers work the same as the event handler in Java.
Advantages Of SAX Parser
Very simple to use and has good efficiency of memory.
Its runtime is too fast and it can work for a bigger document or file system.
Disadvantages Of SAX Parser
Its ability to understand APIs is too less than an event-based API.
We can’t know the full information because of a lot of pieces of data.
DOM Parser
DOM represents the Document Object model. When an object contains some information about XML
documents, is called DOM Parser. This looks like a tree structure. DOM API is implemented by a DOM
Parser, which is very easy and simple to use. It represents an XML Document into tree format in which
each element represents tree branches and creates an In Memory tree representation of XML file and
then parses it more memory is required for this.
Features Of DOM Parser
The internal structure can be created by DOM Parser.
Because of these internal structures, the client can get information about the original XML docs.
Advantages Of DOM Parser
DOM API is easy to use so that we can do both write and read operations.
When a document is required then it preferred a wide part that can be randomly accessed.
Disadvantages Of DOM Parser
Its efficiency of memory is not too good, it takes more memory cause XML docs needed to load in
there.
In comparison to the SAX parser, it is too slow.
Hence, conclusive differences between SAX Parser and DOM Parser in Java is as follows
It is called a Simple API for XML Parsing. It is called as Document Object Model.
SAX Parser is slower than DOM Parser. DOM Parser is faster than SAX Parser.
Best for the larger sizes of files. Best for the smaller size of files.
It is suitable for making XML files in Java. It is not good at making XML files in low
memory.
The internal structure can not be created The internal structure can be created by
by SAX Parser. DOM Parser.
In the SAX parser backward navigation is In DOM parser backward and forward
not possible. search is possible
DHTML stands for Dynamic Hypertext Markup language i.e., Dynamic HTML.
Dynamic HTML is not a markup or programming language but it is a term that combines the features of
various web development technologies for creating the web pages dynamic and interactive.
The DHTML application was introduced by Microsoft with the release of the 4th version of IE (Internet
Explorer) in 1997.
o CSS
o JavaScript
o DOM.
HTML 4.0
HTML is a client-side markup language, which is a core component of the DHTML. It defines the structure
of a web page with various defined basic elements or tags.
CSS
CSS stands for Cascading Style Sheet, which allows the web users or developers for controlling the style
and layout of the HTML elements on the web pages.
JavaScript
JavaScript is a scripting language which is done on a client-side. The various browser supports JavaScript
technology. DHTML uses the JavaScript technology for accessing, controlling, and manipulating the HTML
elements. The statements in JavaScript are the commands which tell the browser for performing an
action.
DOM
DOM is the document object model. It is a w3c standard, which is a standard interface of programming
for HTML. It is mainly used for defining the objects and properties of all elements in HTML.
Uses of DHTML
o It is used for designing the animated and interactive web pages that are developed in real-time.
o DHTML helps users by animating the text and images in their documents.
o It allows the authors for adding the effects on their pages.
o It also allows the page authors for including the drop-down menus or rollover buttons.
o This term is also used to create various browser-based action games.
o It is also used to add the ticker on various websites, which needs to refresh their content
automatically.
Features of DHTML
o Its simplest and main feature is that we can create the web page dynamically.
o Dynamic Style is a feature, that allows the users to alter the font, size, color, and content of a
web page.
o It provides the facility for using the events, methods, and properties. And, also provides the
feature of code reusability.
o It also provides the feature in browsers for data binding.
o Using DHTML, users can easily create dynamic fonts for their web sites or web pages.
o With the help of DHTML, users can easily change the tags and their properties.
o The web page functionality is enhanced because the DHTML uses low-bandwidth effect.
1. HTML is simply a markup language. 1. DHTML is not a language, but it is a set of technologies
of web development.
2. It is used for developing and creating web pages. 2. It is used for creating and designing the animated and
interactive web sites or pages.
3. This markup language creates static web pages. 3. This concept creates dynamic web pages.
4. It does not contain any server-side scripting 4. It may contain the code of server-side scripting.
code.
5. The files of HTML are stored with the .html or 5. The files of DHTML are stored with the .dhtm
.htm extension in a system. extension in a system.
6. A simple page which is created by a user without 6. A page which is created by a user using the HTML, CSS,
using the scripts or styles called as an HTML page. DOM, and JavaScript technologies called a DHTML page.
7. This markup language does not need database 7. This concept needs database connectivity because it
connectivity. interacts with users.
Questions
1. Define HTML tags. Also, explain different tags used for text formatting in HTML with
example.
2. Describe tags used for styling in HTML with example.
3. What is list in HTML ? What are the different types of lists in HTML ? Give an example of
each type
4. Explain the table tag with its attributes in detail.
5. How do you make an image clickable in HTML ? Illustrate with an example.
6. Create an html page named as “Table.html” to display your class time table. i. Provide the
title as Time Table. ii. Provide various colour options to the cells (Highlight the lab hours
and elective hours with different colours)
7. Explain frames in HTML with example.
8. Write HTML code to develop a web page having two frames that divide the page into two
equal rows and divides the first row into equal columns. Fill each with the different
background colour.
9. Discuss how frames play a big role in advertising on web. What roles do form play in
making web page dynamic ?
10. Discuss forms in HTML. Explain various input items used in HTML forms.
11. Design a HTML form for a railway reservation system.
12. What do you mean by Cascading Style sheet (CSS) ? What are the advantages and features
of CSS ?
13. Explain the features of CSS.
14. What is CSS ? What are different ways to create them ? Explain with example.
15. Describe the role and importance of CSS in web designing. Also differentiate Class and Id
in CSS.
16. Explain CSS. What are the CSS frameworks? Explain in brief. What are the different ways
of using the stylesheet? Write a CSS rule that makes all the text 2.5 times larger than the
base font of the system
17. Discuss various types of DTDs (Document Type Definition) in XML. Which type of DTD is
preferable and why ?
18. What is DTD ? What are the differences between external and internal DTD ? Use suitable
example
19. Explain the role of DTD in XML and also describe its types with an example.
20. What is XML ? Discuss the significance of XML. How is XML different from HTML ? Explain
the process of XML parsing. How are they useful ?
21. What is XML ? Create a XML document of 10 students of final CSE. Add their roll number,
marks obtained in 5 subjects, total marks and percentage. Save this XML document at the
server, write a program that accepts student’s roll number as input and returns the
students marks, total percentage by taking student information for XML document.
22. Discuss DTD. How the DTD is different from XSD ? Demonstrate to create a XML document
of 10 students of third year. Add their roll numbers, marks obtained in 5 subjects, total
marks and percentage and validate using DTD.
23. What are XML parsers ? Explain the types of parsers with their advantages and
disadvantages.
24. “Document Type Definition (DTD) in XML is necessary”, justify the statement with suitable
example. Under which conditions which DTD is more preferable ?
25. What is XML schema ? Compare XML schema and XML DTD. OR What is DTD ? Also
explain its differences with XML schema
26. Define HTML DOM.
27. Explain the term SAX with suitable example
28. What is DHTML ? Write difference between HTML and DHTML.
29. Discuss how frames play a big role in advertising on web. What roles do form play in
making web page dynamic ?
30. Explain the role of DTD in XML and also describe its types with an example.
31. . What is XML ? Discuss the significance of XML. How is XML different from HTML ? Explain
the process of XML parsing. How are they useful ?
32. What are XML parsers ? Explain the types of parsers with their advantages and
disadvantages.
33. What is XML schema ? Compare XML schema and XML DTD
34. Describe the role and importance of CSS in web designing. Also differentiate Class and Id
in CSS.