Answered step by step
Verified Expert Solution
Link Copied!

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: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 >> tag-name >
Those that have no content (single tag)of the form ?tag-name>
Those that have no content (single tag) and begin with "="en">isanhtmL 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 (i.e. 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 inan index table, pointing to the first eccurrence 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:
1
$ htags hello.html
html 1
head
meta 1
title body
p,2
Your program must consist of at least TWO functions, with at least one of them compiled and tested separately (i.e. 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 100000 characters.
Assume there are less than 100 different tag types in the HTML file.
Your program will be marked against a different input 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.
Show the output from running your program on the included Sample.html file.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

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

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

Database Concepts

Authors: David Kroenke

4th Edition

0136086535, 9780136086536

More Books

Students also viewed these Databases questions

Question

What is meant by organisational theory ?

Answered: 1 week ago

Question

What is meant by decentralisation of authority ?

Answered: 1 week ago

Question

Briefly explain the qualities of an able supervisor

Answered: 1 week ago

Question

Define policy making?

Answered: 1 week ago

Question

Define co-ordination?

Answered: 1 week ago