Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Can I get help with this code and comments so I know what each part is doing? Pa

ID: 3870346 • Letter: C

Question

Can I get help with this code and comments so I know what each part is doing?

Part A

You are to read the input data into an appropriate

string

and then dump

the data using an appropriate function. You will get 5 points for doing this

and for having your name and other boilerplate attribution at the top of each

program file.

You will get zero points if you don’t do the right read/write or if you

don’t have your name in each file.

parseintoxml.cc

/******************************************************************************
* Constructor
**/
ParseIntoXML::ParseIntoXML() {
}

/******************************************************************************
* Destructor
**/
ParseIntoXML::~ParseIntoXML() {
}

/******************************************************************************
* Accessors and Mutators
**/

/******************************************************************************
* General functions.
**/

/******************************************************************************
* Function 'FilterInput'.
* This function cleans up the input so it can be parsed more easily.
*
**/
string ParseIntoXML::FilterInput(string the_string) {
#ifdef EBUG
Utils::log_stream << "enter FilterInput ";
#endif

#ifdef EBUG
Utils::log_stream << "leave FilterInput ";
#endif
return new_string9;
}

/******************************************************************************
* Function 'ParseTheFile'.
**/
void ParseIntoXML::ParseTheFile(Scanner& in_scanner) {
#ifdef EBUG
Utils::log_stream << "enter ParseTheFile ";
#endif

#ifdef EBUG
Utils::log_stream << "leave ParseTheFile ";
#endif
}

/******************************************************************************
* Function 'Replace'.
* This function replaces one string with another as substrings of a larger
* string. This is just a helper function to eliminate the need for
* remembering the syntax of the underlying functions.
*
* This will replace ALL instances of the old substring with the new substring.
*
* Parameters:
*   the_string - the string to have things replaced in
*   old_string - the string to replace
*   new_string - the string to replace with
*
* Returns:
*   the original string with the replacement made
**/
string ParseIntoXML::Replace(string the_string, string old_string, string new_string) {

string return_string = the_string;

#ifdef EBUG
Utils::log_stream << "enter Replace ";
#endif

size_t found = return_string.find(old_string);
while (found != string::npos) {
    return_string.replace(found, old_string.length(), new_string );
    found = return_string.find(old_string);
}

#ifdef EBUG
Utils::log_stream << "leave Replace ";
#endif

return return_string;
}

/******************************************************************************
* Function 'Split'.
* This function splits a string on whitespace using the 'next' function.
**/
vector<string> ParseIntoXML::Split(string in_string) const {
}

/******************************************************************************
* Function 'ToStringXML'.
* This function formats an XML 'vector<string>' for prettyprinting.
*
* Returns:
*   the prettyprint string for printing
**/
string ParseIntoXML::ToStringXML(vector<XMLItem> the_vector) const {
#ifdef EBUG
Utils::log_stream << "enter ToStringXML ";
#endif
string s = "";

#ifdef EBUG
Utils::log_stream << "leave ToStringXML ";
#endif
return s;
}

/******************************************************************************
* Function 'XMLize'.
* This function takes a string as input and produces a 'vector' of the XML
* that is that string.
**/
vector<XMLItem> ParseIntoXML::XMLize(string in_string) const {

}


parseintoxml.h

**/

#ifndef PARSEINTOXML_H
#define PARSEINTOXML_H

#include <iostream>
#include <set>
#include <vector>
#include <stack>
using namespace std;

#include "xmlitem.h"

#include "../../Utilities/scanner.h"
#include "../../Utilities/scanline.h"

class ParseIntoXML {
public:
    ParseIntoXML();
    virtual ~ParseIntoXML();

    void ParseTheFile(Scanner& in_scanner);

private:
    string FilterInput(string the_string);
    string Replace(string the_string, string old_string, string new_string);
    string ToStringXML(vector<XMLItem> the_vector) const;
    vector<string> Split(string in_string) const;
    vector<XMLItem> XMLize(string in_string) const;
};
#endif

Explanation / Answer

This class ParseIntoXML takes a file as input and generates an xml structure for the file.

The main method within which this processing happens is void ParseTheFile(Scanner& in_scanner);

In order to carry out this task the class makes use of the following helper functions in the below order:-

- Split - Splits the string read from the file on whitespace

- FilterInput: Carries out input string preprocessing

- Replace :Carries out substring replacement

- XMLize - Takes a string as input and converts into the corresponding xml component

- ToStringXML:prints the xml document in the standard indented format

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote