Computing 4 Assignment 6 - David Lordan
 All Files Functions Variables
Functions | Variables
main.cpp File Reference
#include <xercesc/dom/DOM.hpp>
#include <xercesc/framework/StdOutFormatTarget.hpp>
#include <iostream>
#include "xercesc/dom/DOMTreeWalker.hpp"
#include <string.h>
#include <stdlib.h>

Functions

XMLCh * X (const char *const input)
 
DOMDocument * createDOM (DOMImplementation *impl)
 
void printTree (DOMDocument *doc, DOMImplementation *impl)
 
void displayAttributes (DOMNamedNodeMap *attributes, int level)
 
void treeWalker (DOMDocument *doc)
 
void banner (string type)
 
int main (int argC, char *argV[])
 

Variables

const char * courses []
 
const char * professors []
 
const char * semesters []
 
int courseLoad [] = {4, 4, 5, 5, 3, 5, 5, 3, 4, 3}
 
const char * campus []
 

Function Documentation

void banner ( string  type)

Function to add a banner describing the output type.

Parameters
type- The output type which is be described by the banner.
DOMDocument* createDOM ( DOMImplementation *  impl)

Function to create the DOM structure. Scans through each member of the 'semesters' array, creating a child node of the root for each. Each of the semester nodes are then given children corresponding to each course in that semester. Each course is then given a Instructor, Campus, and Grade child. Also, courses may or may not have attributes associated with them. Much of this function is based on the Xerces DOMPrint sample program.

Parameters
impl- DOMImplementation used to create the DOM structure.
Returns
- Returns a DOMDocument pointer containing the DOM structure.
void displayAttributes ( DOMNamedNodeMap *  attributes,
int  level 
)

Function to display a DOM element's attributes.

Parameters
attributes- a DOM map which contains a list of attribute names and values.
level- The level on which an attribute's parent is located. Used for output formatting.
int main ( int  argC,
char *  argV[] 
)

Standard C++ main function.

Parameters
argc- Number of command line arguments.
argv- Array of pointers to command line arguments.
Returns
- Returns error code if the program does not end properly.
void printTree ( DOMDocument *  doc,
DOMImplementation *  impl 
)

Function that uses the Xerces serializer to display the tree in an XML format. Much of this function is based on the Xerces DOMPrint sample program.

Parameters
doc- The DOMDocument that contains the DOM structure.
impl- The DOMImplementation used to create the DOM structure.
void treeWalker ( DOMDocument *  doc)

Function that implements the DOMTreeWalkers which is used to traverse the DOM structure. Creates the tree then scans through each node, checks its type, and depending on the results outputs the content in a particular format.

Parameters
doc- The DOM document containing the DOM structure.
XMLCh* X ( const char *const  input)

Function to simplify use of the XMLString::transcode function.

Parameters
-A char* (string) to use as an argument for transcode.
Returns
- An XMLCh* which can be used to properly create DOMNodes.

Variable Documentation

const char* campus[]
Initial value:
= {"Lynn/McGee", "Danvers/Berry", "Online", "Salem State North Campus",
"UML North Campus"}

An array of campuses in which the above courses took place. Used as tag content.

int courseLoad[] = {4, 4, 5, 5, 3, 5, 5, 3, 4, 3}

Array of the number of courses for each semester. Used as a for loop limit when populating the DOM structure.

const char* courses[]
Initial value:
= {"Physics_1", "Calculus_1", "Java_1", "Microeconomics", "Calculus_2",
"Gen.Chem_1", "Composition1", "CAD_1", "Physics_2", "Physics_3", "Calculus_3", "Statics",
"Material_Science", "Logic_Design", "Obj.Oriented.Prog", "Film_Studies",
"Differential_Equations", "Gen.Chem_2", "Comp_2", "DiscreteStruct_1", "IntroToEthics",
"Comp_4", "Assembly", "GUI_Prog_1", "DiscreteStruct_2", "Prob_and_Stats", "GUI_Prog_2",
"Software_Engineering_1", "Org._of_Prog_Lang.", "Composition_for_CS", "Comp_Architecture",
"World_Civ_1", "Intro_to_Itnl._Relations", "Intro_to_Sociology", "Found._of_CS", "Algorithms",
"Software_Engineerings_2", "Operating_Systems", "Internet_WebSystems_1", "Data_Visualization",
"Data_Mining"}

An array of courses I have taken, am taking and intend to take. Used as element content.

const char* professors[]
Initial value:
= {"Prof. Jeong", "Dr. Stone", "Prof. Guan", "Prof. O'Brien",
"Prof. Gibbs", "Prof. MacTaylor", "Prof. Burt", "Prof. Walsh", "Prof. Jeong",
"Prof. Steigerwald", "Dr. Dakhama", "Prof. Jeong", "Prof. Jeong",
"Prof. Steigewald", "Prof. Hassan", "Prof. Ronan", "Dr. Dakhama", "Prof. Day",
"Prof. Lepsky", "Prof. Doerr", "Prof. White", "Prof. Heines", "Prof. Kim", "Prof. Heines",
"Prof. Montenegro", "Prof. Graham-Eagle", "Prof. Heines", "Prof. Cao", "Prof. Martin",
"Prof. Turgeon", "Prof. Moloney", "Prof. Kalivas", "Prof. Carter", "Prof. Sloan",
"Prof. Daniels", "Prof. Daniels", "Prof. Cao", "Prof. Moloney", "Prof. Levkowitz",
"Prof. Grinstein", "Prof. Chen"}

An array of professors for the courses listed above. Used as element content.

const char* semesters[]
Initial value:
= {"Spring_13", "Summer_13", "Fall_13", "Spring_14", "Summer_14", "Fall_14",
"Spring_15", "Summer_15", "Fall_15", "Spring_16"}

An array of the semesters in my program of study. Each of these will be used as a tag name for the direct children of the root.