For this exercise, we assume a slightly more restricted version of HTML than that is often used. HTML (the language for web pages) uses pairs of tags to indicate the beginning and the end of a piece of information.
INSTRUCTIONS TO CANDIDATES
ANSWER ALL QUESTIONS
Problem 1: well formed html
Please use stack from the standard Java:
For this exercise, we assume a slightly more restricted version of HTML than that is often used. HTML (the language for web pages) uses pairs of tags to indicate the beginning and the end of a piece of information. Here are the important rules regarding tags for this lab:
- A tag is always enclosed by a pair of < >. For example <li> and <p> are tags.
- The characters ‘<’ and ‘>’ do not appear anywhere else in the webpage other than as tag
- Tags appear in pairs. The start tag is a sequence of letters and the corresponding end tag is the same sequence of characters preceded by a ‘/’. For example <li> and </li> are a pair of tags.
- Tags are not case sensitive. For example <li> and <LI> are considered the same.
- Tags do NOT split across lines.
- Tags may be nested, but each start tag must have a corresponding end tag to form a well-formed expression. For example
<body>
<p> this is fun </p>
<ul>
<li> first </li>
<li> second item</li>
<li> third item </li>
</ul>
</body>
is well-formed, since the nesting is correct.
Write an implementation to determine whether a given string is a well-formed HTML string. Your implementation should have the following classes and methods:
public class WellFormedHtmlChecker {
public boolean isWellFormed(String html) {
}
}
Please note the method isWellFormed is a non-static method.
Attachments:
Related Questions
. Introgramming & Unix Fall 2018, CRN 44882, Oakland University Homework Assignment 6 - Using Arrays and Functions in C
DescriptionIn this final assignment, the students will demonstrate their ability to apply two ma
. The standard path finding involves finding the (shortest) path from an origin to a destination, typically on a map. This is an
Path finding involves finding a path from A to B. Typically we want the path to have certain properties,such as being the shortest or to avoid going t
. Develop a program to emulate a purchase transaction at a retail store. This program will have two classes, a LineItem class and a Transaction class. The LineItem class will represent an individual
Develop a program to emulate a purchase transaction at a retail store. Thisprogram will have two classes, a LineItem class and a Transaction class. Th
. SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:
1
Project 1
Introduction - the SeaPort Project series
For this set of projects for the course, we wish to simulate some of the aspects of a number of
. Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:
1
Project 2
Introduction - the SeaPort Project series
For this set of projects for the course, we wish to simulate some of the aspects of a number of