Comp_4_Assignment_7_DavidLordan
 All Files Functions
Functions
treeManipulation.cpp File Reference
#include <string.h>
#include <stdlib.h>
#include "treeManipulation.h"
#include <boost/regex.hpp>

Go to the source code of this file.

Functions

XMLCh * X (string input)
 
void addRoot (DOMDocument *&doc, string rootName, string rootContent)
 
void renameNode (DOMDocument *&doc, string selector, string oldNameOrParent, string newNameOrAtt, string newContentOrNewAtt)
 
void addNode (DOMDocument *&doc, string addType, string parentName, string childOrAtt, string contentOrVal)
 
void removeNode (DOMDocument *&doc, string removeType, string parentName, string childOrAtt)
 

Function Documentation

void addNode ( DOMDocument *&  doc,
string  addType,
string  parentName,
string  childOrAtt,
string  contentOrVal 
)

A function to create and add a new node to the DOM structure.

Parameters
doc- The DOM document to which the new node will be added.
addType- A selector for specifying whether an element or attribute is to be added.
parentName- The parent to which the new node will be attached.
childOrAtt- The name of the new node.
contentOrVal- The content or value of the new node.

Definition at line 161 of file treeManipulation.cpp.

void addRoot ( DOMDocument *&  doc,
string  rootName,
string  rootContent 
)

A function to create and add the DOM structure's root element. Checks if the root already exists and will not allow the creation of additional roots.

Parameters
doc- The DOMDocument to which the root will be added.
rootName- The user's name for the root element.
rootContent- Option content that the user may add to the root.

Definition at line 51 of file treeManipulation.cpp.

void removeNode ( DOMDocument *&  doc,
string  removeType,
string  parentName,
string  childOrAtt 
)

Function to remove a user specified element or attribute from the DOM structure.

Parameters
doc- The DOMDocument which is being manipulated.
removeType- A selector for whether or not a element or attribute is being removed.
parentName- The parent of the node to be removed.
childOrAtt- The element or attribute name which is to be removed.

Definition at line 226 of file treeManipulation.cpp.

void renameNode ( DOMDocument *&  doc,
string  selector,
string  oldNameOrParent,
string  newNameOrAtt,
string  newContentOrNewAtt 
)

A function that allows the user to rename an existing element or attribute.

Parameters
doc- The DOMDocument which is to be manipulated.
selector- Allows the user to specify whether an element or attribute is being renamed.
oldNameOrParent- The element to be renamed, or the parent of the attribute to be renamed.
newNameOrAtt- The user provided new name of an element, or the name of the attribute to rename.
newContentOrNewAtt- Optional new content to be added, or the new name of the specified attribute.

Definition at line 85 of file treeManipulation.cpp.

XMLCh* X ( string  input)

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

Parameters
input- A string which will be converted to an XMLCh*
Returns
- An XMLCh* which can be used to properly create DOMNodes.

Definition at line 38 of file treeManipulation.cpp.