3 import xml.etree.ElementTree 
as ET
 
    5 from docs.docs 
import ClassDoc, Doc, Docs, FreeDoc
 
    7 DOXYGEN_CONF = 
'doxygen.conf' 
   12         """Parse the Doxygen generated XML files. 
   15         input_path -- path to the input folder or file 
   16         output_path -- path to the output folder 
   21     def run(self, quiet=True):
 
   22         """Run the Doxygen XML parser. 
   25         quiet -- turn on/off the messages that are generated to standard 
   26                  output by Doxygen (default = True) 
   29             A Docs template storing all the class and free documentation in the 
   37                 if f.endswith(
'.xml'):
 
   38                     file_path = path.join(root, f)
 
   39                     tree = ET.parse(file_path)
 
   41                     if tree.getroot().tag == 
'compounddef':
 
   42                         first_compound_def = tree.getroot()
 
   44                         first_compound_def = tree.find(
 
   45                             './/{}'.
format(
'compounddef'))
 
   47                     if first_compound_def 
is None:
 
   50                     category = first_compound_def.get(
'kind')
 
   52                     if category == 
'class':
 
   53                         class_docs[file_path] = ClassDoc(tree)
 
   55         return Docs(class_docs, free_docs)
 
   60     '''Parse the file for documentation and output it as in an xml format''' 
   62         print(
'--------------Generating XML--------------')
 
   64     input_path = path.relpath(input_path, os.getcwd())
 
   65     conf_path = path.relpath(path.join(path.dirname(__file__), DOXYGEN_CONF))
 
   66     output_path = path.relpath(output_path)
 
   68     if not path.isdir(output_path):
 
   71     command = 
'( cat {conf_path} ; echo "INPUT={input_path}" ; echo "OUTPUT_DIRECTORY={output_path}" ; echo "EXTRACT_ALL={quiet}" ) | doxygen -'.
format(
 
   73         input_path=input_path,
 
   74         output_path=output_path,
 
   75         quiet=
'YES' if quiet 
else 'NO'