You are asked to write a program to check if the HTML tags in a given file
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 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.