Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

You are asked to write a program to check if the HTML tags in a given file are nested correctly or not. This problem is

You are asked to write a program to check if the HTML tags in a given file are nested correctly or not. This problem is similar to the example of proper matching of { ( [ ] ) }, but now you will deal with HTML tags and read them from a file. You need to implement and use use stack lib that we discussed in class with typedef void *stackElementT; or typedef char *stackElementT;

For example, if an HTML file contains

THIS FILE USES CORRECTLY NESTED TAGS

First header text

Some other text

Then YES, all the tags are nested correctly.

But if an HTML file contains

THIS FILE IS NOT NESTED CORRECTLY .

some text is not nested correctly

Then NO, the tag violates the proper nesting!

Your program must accept HTML input file name as a command line argument and process it for proper nesting of HTML tags. You can stop the program when you detect the first tag that violates the proper nesting structure and print NO and the tag that violates nesting on the screen. Otherwise, your program will print YES, all the tags are nested correctly.

Step by Step Solution

3.44 Rating (154 Votes )

There are 3 Steps involved in it

Step: 1

include include include include define STACKMAX 100 define TAGMAX 50 struct Stack char dataSTACKMAXT... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Document Format ( 2 attachments)

PDF file Icon
609507d608088_25477.pdf

180 KBs PDF File

Word file Icon
609507d608088_25477.docx

120 KBs Word File

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Physics

Authors: John D. Cutnell, Kenneth W. Johnson

9th edition

470879564, 1118424840, 470879521, 9780470879566, 9781118424841, 978-0470879528

More Books

Students also viewed these Programming questions

Question

Summarize the findings of psychotherapy effectiveness studies.

Answered: 1 week ago

Question

Define Management by exception

Answered: 1 week ago

Question

Explain the importance of staffing in business organisations

Answered: 1 week ago

Question

What are the types of forms of communication ?

Answered: 1 week ago