spec3 - CSE 143, Winter 2010 Programming Assignment #3:...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
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 Stack and Queue collections. Turn in two files named HtmlValidator.java and mytest.html from the Homework section of the course web site. You will also need the support files named HtmlTag.java and ValidatorMain.java from the web site; place them in the same folder as your program. HtmlValidator.java is your program, and mytest.html is a test case you will create. Though this assignment relates to web pages and HTML, you do not 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 HTML . An HTML file consists of text surrounded by markings called tags . 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). A tag consists of a named element between less-than < and greater-than > symbols. For example, the tag for making text bold uses the element b and is written as <b> . Many tags apply to a range of text, in which case a pair of tags is used: an opening tag indicating the start of the range and a closing tag indicating the end of the range. A closing tag has a / slash after its < symbol, such as </b> . So to make some text bold on a page, one would put the text to be bold between opening and closing b tags, <b> like this </b> . Tags can be nested to combine effects, <b><i> bold italic </i></b> . Some tags, such as the br tag for inserting a line break or img for inserting an image, do not cover a range of text and are considered to be " self-closing ." Self-closing tags do not need a closing tag; for a line break, only a tag of <br> is needed. Some web developers write self-closing tags with an optional / before the > , such as <br /> . The distinction between a tag and an element can be confusing. A tag is a complete token surrounded by <> brackets, which could be either an opening or closing tag, such as <title> or </head> . An element is the text inside the tag, such as title or head . Some tags have attributes , which are additional information in the tag that comes after the element. For example, the tag <img src="cat.jpg"> specifies an image from the file cat.jpg . The element is img , and the rest of the text such as src are attributes. In this assignment we will ignore attributes and focus just on elements and tags. If you're curious, there are tutorials such as http://www.w3schools.com/html/ and http://www.cs.washington.edu/190m/ . HTML Validation: 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, <b><i> like this </i></b> , the inner tag ( i for italic, here) must be closed before the outer tag is closed. So the
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 01/04/2011 for the course CSE 143 taught by Professor Sr during the Spring '08 term at University of Washington.

Page1 / 4

spec3 - CSE 143, Winter 2010 Programming Assignment #3:...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online