Question
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...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Document Format ( 2 attachments)
609507d608088_25477.pdf
180 KBs PDF File
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