Answered step by step
Verified Expert Solution
Question
1 Approved Answer
In this assignment, you are to develop and test a utility program, htags that analyses an HTML file and prints of the list of the
In this assignment, you are to develop and test a utility program, htags that analyses an HTML file and prints of the list of the HTML tag names together with the number of occurrences of each tag.
Here is a simple html file:
SDOCTYPE htowl:
shead:
smeta charset"Lfirg"
hles HeVe Suessian worial :
sheac:
abody
sp:Holiosps
spWords
shody
chams
Elements of the file are enclosed with tags describing their purpose tag names There are three forms of tags:
Those that have opening and closing tags of the form name
Those that have content tag the form
Those that have no content single tag and begin with en is an html tag.
Your program should read the html file from the standard input use the input redirection to read the entire HTML file read the entire HTML file into a character array, called here the input array. This input array is the only data structure for storing text ie strings of characters in your program. The new implementation must not store the HTML tags directly in a separate data structure array Instead, htags should use pointers stored in an index table, pointing to the first occurrence of each tag identified in the input array. A separate parallel array of integers should then be used to keep track of the number of occurrences of each identified tag type. Output from the program should list each tag name, followed by the number of occurrences, per line. The following would be reported for the html above:
$ htags hello.html
html
head
meta
title
body
P
Your program must consist of at least TWO functions, with at least one of them compiled and tested separately ie separate source file
The program is to be implemented using pointers ONLY to access array elements. The square brackets and can be used to specify the array dimensions ONLY. In all other cases you must use pointers.
Only one char array, the "input" array, can be used to store the text from the entire input HTML file.
You are not allowed to store the detected tags in a char array: you must use the index table to store pointers to the tags detected in the input char array.
Assume the input file contains less than characters.
Assume there are less than different tag types in the HTML file.
The Report
In a few sentences describe the design of your program. Focus on what each of the data
Structures holds and how each of the functions acts on them.
Show the testing of one of the functions using a test program.
Show the output from running your program on the included HelloWorld.html file.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
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
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started