Comp_4_Assignment_7_DavidLordan
 All Files Functions
treeManipulation.h
Go to the documentation of this file.
1 /* File: outputOptions.cpp
2  * Author: David Lordan, UMass Lowell Computer Science
3  * david_lordan@student.uml.edu
4  *
5  * Created on December 7th, 2014, 5:23 PM, modified on Dec 7th at 6:22 PM to
6  * add additional documentation.
7  *
8  * This is the header file for various program functions that
9  * manipulate the DOM structure. These functions allow the user to add a root,
10  * add an ordinary node, rename an existing node, or remove a node.
11  *
12  * This program is to demonstrate use of regular expressions to parse command line
13  * user input along with using the Xerces library to create a DOM structure.
14  * This is an expansion of the previous assignment which was to create a 'hard-coded'
15  * DOM structure in memory and to display it to the user. This assignment goes further
16  * by building the tree dynamically from the user's requests as well as giving the
17  * user various options for tree manipulation. All basic commands are parsed with
18  * regular expressions to extract keywords and variable reflecting the meaning of the user's input.
19  */
20 
21 #ifndef TREEMANIPULATION_H
22 #define TREEMANIPULATION_H
23 
24 /* Includes the necessary Xerces libraries and standard libraries. */
25 #include <xercesc/dom/DOM.hpp>
26 #include <iostream>
27 #include <string.h>
28 #include <stdlib.h>
29 
30 /* Uses the Xerces and std namespace.*/
31 XERCES_CPP_NAMESPACE_USE
32  using namespace std;
33 
41 void addRoot(DOMDocument* &doc, string rootName, string rootContent);
42 
51 void renameNode(DOMDocument* &doc, string selector, string oldNameOrParent, string newNameOrAtt, string newContentOrNewAtt);
52 
61 void addNode(DOMDocument* &doc, string addType, string parentName, string childOrAtt, string contentOrVal);
62 
70 void removeNode(DOMDocument * &doc, string removeType, string parentName, string childOrAtt);
71 
72 #endif /* TREEMANIPULATION_H */
73 
void removeNode(DOMDocument *&doc, string removeType, string parentName, string childOrAtt)
void renameNode(DOMDocument *&doc, string selector, string oldNameOrParent, string newNameOrAtt, string newContentOrNewAtt)
void addRoot(DOMDocument *&doc, string rootName, string rootContent)
void addNode(DOMDocument *&doc, string addType, string parentName, string childOrAtt, string contentOrVal)