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 asingle 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 isdefined to be one where every opening tag that is not self-closing has a closing tag, and where every closing tag closes themost recently opened tag that was not self-closing.For example, the following HTML is valid:
This is the end of the preview. Sign up
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.