Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The utility program htags should read the HTML file specified as the command line parameter, for example to run your program on (*).htm use: $

The utility program htags should read the HTML file specified as the command line parameter, for example to run your program on (*).htm use:

$ ./htags (*).htm The program should read the entire HTML file into a character array. This character array is the only data structure for storing text, i.e. strings of characters, in your new program. The new implementation must not store the HTML tags directly in a separate data structure (array). Instead, htags should use pointers stored in the index table, pointing to the first occurrence of each tag identified in the character array. A separate (parallel) array of integers should then be used to keep track of the number of occurrences of each identified tag type. Here are the requirements for the implementation of htags:

Read the file specified as the command line parameter and output the count for each HTML tag detected.

Your program must consist of at least TWO programming modules, with at least one of them compiled and tested separately.

The new version of the htags2 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.

** for clarification***

Need to go through a txt file and write every character to a character array.

(this text file would be the txt file you get if you were to save the "inspect source" of a webpage into a .htm file)

then we must close the file, and use the array of characters to determine the rest of what we need.

Then we must go through the array checking for tags (tags start with a '<').

It is a tag if and only if the next character after the < is NOT a '/' , whitespace, '\0' or nextline.

If it meets these parameters we must get the location, (not the value, but the array element) of that character from the character array, storing it's location in a seperate array. int *startOfTag[100]

If it meets the above parameters then we must do the same to get the last character of the tag, i.e search for the '>' or whitespace and store the location of the last character of the tag in another array int *endOfTag[100]

Once we have the locations of every tag obtained via parsing through the character array we must use the information from startOfTag and endOfTag to get the string from the original character array and then count how many times it appears inside of the array.

Essentially finding and printing the name of each tag, their counts and doing so by accessing the array via only pointers, ie no calls with "[]" other than initial declarations.

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

PostgreSQL 10 High Performance Expert Techniques For Query Optimization High Availability And Efficient Database Maintenance

Authors: Ibrar Ahmed ,Gregory Smith ,Enrico Pirozzi

3rd Edition

1788474481, 978-1788474481

More Books

Students also viewed these Databases questions