HW4 3 - T o g eneratet he o utput f or t his m ethod a...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
To generate the output for this method, analyze your queue of tags with a srack. The basic idea of the algorithm is that ,' when you see an opening tag that is not a self-closing tag, you should push it onto a stack and increase your indentation. ' When you see a closing tag, you should pop the top element from the stack and decrease your indentation. You may use a single stack (in addition to the queue passed to your validator's constructor) to help you compute the result. You may not use any other collections, alrays, etc., though you can create as many simple variables as you like. Your method should also retum true if the page has valid HTML and fatse if not. A valid queue of HTML tags is defined to be one where every opening tag that is not self-closing has a closing tag, and where every closing tag closes the most recently opened tag that was not self-closing. For example, the following HTML is valid:
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

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

Ask a homework question - tutors are online