fork download
  1. /**
  2.  * Outputs the tree built from parsing the xml file.
  3.  * @param root root of the xml tree
  4.  */
  5. void outputTree(Element* root)
  6. {
  7. Element* elementP;
  8.  
  9. for(int i = 0; i < root->getLevel(); i++)
  10. {
  11. cout<<"*";
  12. }
  13. cout<<"Element "<<root->getName()<<" was found at line "<<root->getlineNumber();
  14. if(root->getContent() == " ")
  15. {
  16. cout<<" with no content and "<<root->getNumberChildren()<<" children"
  17. <<endl;
  18. }
  19. else
  20. {
  21. cout<<" with content: "<<root->getContent()<<" and "
  22. <<root->getNumberChildren()<<" children"<<endl;
  23. }
  24.  
  25. // cout<<" and "<<root->getNumberChildren()<<" children"<<endl;
  26.  
  27.  
  28. vector<Element*>::iterator it;
  29. int size = root->getNumberChildren();
  30.  
  31. for(it = root->getVecChildren().begin();
  32. it != root->getVecChildren().end();
  33. it++)
  34. {
  35. elementP = (*it)->getChild();
  36. if(elementP != NULL)
  37. {
  38.  
  39. // for(int i = 0; i <= root->getLevel(); i++)
  40. // {
  41. // cout<<"*";
  42. // }
  43. //
  44. // //cout<<"Child = "<<(*it)->getName();
  45. // if((*it)->getContent() == " ")
  46. // {
  47. // cout<<" with no content and "<<(*it)->getNumberChildren()<<
  48. // " children"<<endl;
  49. // }
  50. // else
  51. // {
  52. // cout<<" with content: "<<(*it)->getContent()<<" and "
  53. // <<(*it)->getNumberChildren()<<" children"<<endl;
  54. // }
  55. //
  56. return(outputTree((*it), 0));
  57. }
  58. else;
  59. {
  60.  
  61. // for(int i = 0; i <= root->getLevel(); i++)
  62. // {
  63. // cout<<"*";
  64. // }
  65. // cout<<"Child = "<<(*it)->getName()<<" is empty";
  66. // if((*it)->getContent() == " ")
  67. // {
  68. // cout<<" with no content and "<<(*it)->getNumberChildren()<<
  69. // " children"<<endl;
  70. // }
  71. // else
  72. // {
  73. // cout<<" with content: "<<(*it)->getContent()<<" and "
  74. // <<(*it)->getNumberChildren()<<" children"<<endl;
  75. // }
  76. // }
  77. }
  78.  
  79.  
  80.  
  81. }
  82.  
  83.  
  84.  
  85.  
  86.  
  87.  
  88.  
  89.  
  90.  
  91.  
  92. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:5:17: error: variable or field ‘outputTree’ declared void
 void outputTree(Element* root)
                 ^
prog.cpp:5:17: error: ‘Element’ was not declared in this scope
prog.cpp:5:26: error: ‘root’ was not declared in this scope
 void outputTree(Element* root)
                          ^
stdout
Standard output is empty