Question: 3) HTML Tag Checker Complete the function tag_checker) in the HTML_Processor_abcd001.py file that iterates through your list of tags, looking for matches. If there is

 3) HTML Tag Checker Complete the function tag_checker) in the HTML_Processor_abcd001.py

3) HTML Tag Checker Complete the function tag_checker) in the HTML_Processor_abcd001.py file that iterates through your list of tags, looking for matches. If there is a mismatch of start and end tags, raise an exception with the appropriate error message (see output section below). To check whether a pair of tags match use the is match () method in the Tag class. After going through the list, if there are still tags remaining in the stack, raise an exception with the appropriate error message along with the tags in the stack (see output section below) Additionally your tag_checker function should keep track of the unique tags encountered using a list unique tags. As you iterate through your list of tags, check and see if the tag appears in this list. If it doesn't, add it to the list. Once you have gone the list of tags and have not encountered any mismatches, return the unique_tags list. Output The output of your program should include the following One line for each tag you check, explaining the action and displaying the current contents of the stack. You will need to complete the str method of the Stack class to allow the information to be displayed properly. Some examples are Tag

pushed. Stack 1s now: [,

,

] Tag

is popped. Stack is now: [] Tag

    pushed. Stack is now: [, ,
      ] Complete the main () function in the HTML Processor_abcd001.py file so that: o A confirmation message that all tags are balanced is printed All tags are balanced! o A list of all the unique tags encountered is printed HTML tags encountered: , , <em>, <strong>, p>, , <hr>, <li>, <ul>, <td>, </td><tr>,</tr><tbody>, <table>, ] o An appropriate error message is printed if the HTML tags are not balanced Mismatched tags: <em>and 1i> End tag without matching start tag Start tag (s) [, <p> without matching end tag (s) Your HTML_Processor_abcd001.py programme should now work fine with testl.html, test2.html, test3.html, test4.html and test5.html. The first two test files have balanced tags, the remaining files should result in the appropriate exception being raised</p></em></table></tbody></ul></li></strong></em>

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!