java project 2

Closed Posted 6 years ago Paid on delivery
Closed Paid on delivery

write a program to validate html files.

In html, tags are element names enclosed in angle brackets < >. Most tags have start and end tags which enclose some document element(s) and possibly other tags. End tags have the same name as the corresponding start tag, preceded by a '/':

<p>Arrays are <b>objects</b>, which means that when we declare an array, the <b><i>name</i></b> of the array is a <b>reference</b>

<a hef="[login to view URL]"></p>.

Start tags can contain attributes which provide additional information about the element, such as <img src="[login to view URL]">

Some tags do not surround any content. These "empty elements" have start tags but no end tags.

Restrictions for This Validator

There are multiple versions of html with different rules. We are going to simplify a bit for the purposes of this lab. We are going to use the following rules for valid html:

tags are case insensitive

the following tags are empty, and so have no corresponding close tag: <area>, <base>, <br>, <col>, <command>, <embed>, <hr>, <image>,<input>, <keygen>, <link>, <meta>, <param>, <source>, <track>, <wbr>

all other tags must have a close tag

tags must be nested correctly, so <p><b> . . .</b></p> is valid but <p><b> . . .</p></b> is not.

Input

The input is an html file which may or may not follow the restrictions described above.

Output

each time a pair of tags is matched, print a message such as: "matched: <p> and </p>"

each time a tag with no end tag is processed, print a message such as "no match needed: <br>"

each time a start tag has no matching end tag, print a message such as: "missing end tag: <li>"

each time there is no start tag to match an end tag, print a message such as "missing start tag: </head>

if there are no errors in the file, print a message saying that the file is valid; if there are any errors in the file, print a message saying that the file is invalid

Requirements

Prompt for the name of the file to be validated. Create a Scanner for the file and pass it to your validator.

Your validator should use a stack to check for correct nesting of tags. The algorithm is similar to the algorithm for checking for balanced parentheses in our textbook. Open tags are pushed onto the stack. Each close tag is compared with the top of the stack to check for a match.

Don't forget that some tags have no close tag.

Create class for tags. This class should not have set or get methods. The Tag class should contain the list of tags with no end tag and a method to test whether a tag has no end tag. Your tag class should also have a method to test whether a pair of tags are matching start and end tags. You will probably need some additional methods in the Tag class.

You need to extract the tags from the input file. Attributes are not stacked. My advice is to write your own "split" method that will take a line of the input file and return an array or ArrayList of the tags (modified to remove attributes) in a line of input. A good place for this method is to make it a static method in the Tag class.

CSS HTML Java Software Architecture

Project ID: #16393872

About the project

16 proposals Remote project Active 5 years ago

16 freelancers are bidding on average $38 for this job

it2051229

Hi there, I went through the requirements and I would like to do this project if given the opportunity. I am confident I can do this. Let me know if you are interested.

$35 USD in 1 day
(1236 Reviews)
7.7
wangbeizou

Hello. How are you . I have read. I have strong knowledge in Data structures, Algorithms Design, Computer Architecture, And I'm expert in Java, ,PHP etc. I'm interested in this project. Please send me a More

$50 USD in 2 days
(150 Reviews)
6.3
kishanpala

i read details.i will validate your files lets discuss to shake of clarity looking forward for the reply

$50 USD in 2 days
(18 Reviews)
4.4
chali5

HI sir...!! I read your description and will do this task easily just in few hours. I am professional java developer and have develop a compiler to validate c-language code. I have good concepts of stack and queue and More

$27 USD in 1 day
(20 Reviews)
3.9
usamayounas37

Hello sir, I have 3 years of experience dealing this type of projects. Let me help you for better outcome. Thanks.

$27 USD in 10 days
(0 Reviews)
0.0
rveina

Hello I can help you with this as I am very experienced with such issues. The code will be clean and understandable. Thanks!

$25 USD in 3 days
(0 Reviews)
0.0
chinmayeeshepal

There are some libraries in Java which provides the validation functionality for html. Using those open source libraries the task which you want to be done, can be done faster. Please send me a private chat message if More

$35 USD in 3 days
(0 Reviews)
0.0
harmitmaan

Hey, I have 10 years experience in java and data structure. I am new here and looking to improve my reputation so money is not an issue for me as of now. I can assure good quality code and timely delivery. I can even More

$25 USD in 2 days
(0 Reviews)
0.0