1 of 4
CSE 143, Winter 2010
Programming Assignment #3: HTML Validator (20 points)
Due Thursday, January 28, 2010, 11:30 PM
This program focuses on using
Turn in two files named
from the Homework section of the course web site. You will also need the support files named
from the web site; place them in the same folder as your program.
is your program, and
is a test case you will create.
Though this assignment relates to web pages and HTML, you do
need to know how to write HTML to complete it.
Background Information About HTML:
Web pages are written in a language called Hypertext Markup Language, or
. An HTML file consists of text
surrounded by markings called
Tags give information to the text, such as formatting (bold, italic, etc.) or layout
(paragraph, table, list).
Some tags specify comments or information about the document (header, title, document type).
consists of a named
For example, the tag for making text
bold uses the element
and is written as
Many tags apply to a range of text, in which case a pair of tags is used: an
tag indicating the start of the range and a
tag indicating the end of the range.
A closing tag has a
symbol, such as
So to make some text bold on a page, one would put the text to be bold between opening
Tags can be nested to combine effects,
Some tags, such as the
tag for inserting a line break or
for inserting an image, do not cover a range of text and are
considered to be "
Self-closing tags do not need a closing tag; for a line break, only a tag of
Some web developers write self-closing tags with an optional
, such as
The distinction between a tag and an element can be confusing.
A tag is a complete token surrounded by
which could be either an opening or closing tag, such as
An element is the text inside the tag, such
Some tags have
, which are additional information in the tag that comes after the element.
For example, the tag
specifies an image from the file
The element is
, and the
rest of the text such as
In this assignment we will ignore attributes and focus just on elements and tags.
If you're curious, there are tutorials such as
One problem on the web is that many developers make mistakes in their HTML code.
All tags that cover a range must
eventually be closed, but some developers forget to close their tags.
Also, whenever a tag is nested inside another tag,
, the inner tag (
for italic, here) must be closed before the outer tag is closed.