/**
* Outputs the tree built from parsing the xml file.
* @param root root of the xml tree
*/
void outputTree(Element* root)
{
Element* elementP;
for(int i = 0; i < root->getLevel(); i++)
{
cout<<"*";
}
cout<<"Element "<<root->getName()<<" was found at line "<<root->getlineNumber();
if(root->getContent() == " ")
{
cout<<" with no content and "<<root->getNumberChildren()<<" children"
<<endl;
}
else
{
cout<<" with content: "<<root->getContent()<<" and "
<<root->getNumberChildren()<<" children"<<endl;
}
// cout<<" and "<<root->getNumberChildren()<<" children"<<endl;
vector<Element*>::iterator it;
int size = root->getNumberChildren();
for(it = root->getVecChildren().begin();
it != root->getVecChildren().end();
it++)
{
elementP = (*it)->getChild();
if(elementP != NULL)
{
// for(int i = 0; i <= root->getLevel(); i++)
// {
// cout<<"*";
// }
//
// //cout<<"Child = "<<(*it)->getName();
// if((*it)->getContent() == " ")
// {
// cout<<" with no content and "<<(*it)->getNumberChildren()<<
// " children"<<endl;
// }
// else
// {
// cout<<" with content: "<<(*it)->getContent()<<" and "
// <<(*it)->getNumberChildren()<<" children"<<endl;
// }
//
return(outputTree((*it), 0));
}
else;
{
// for(int i = 0; i <= root->getLevel(); i++)
// {
// cout<<"*";
// }
// cout<<"Child = "<<(*it)->getName()<<" is empty";
// if((*it)->getContent() == " ")
// {
// cout<<" with no content and "<<(*it)->getNumberChildren()<<
// " children"<<endl;
// }
// else
// {
// cout<<" with content: "<<(*it)->getContent()<<" and "
// <<(*it)->getNumberChildren()<<" children"<<endl;
// }
// }
}
}
}