# Path: lib/metricxmloutput.py
# DATECREATEDFIELD = "GenerationDate"
# 
# VERSIONFIELD = "ModelVersion"


import xml.etree.ElementTree as ET
import xml.dom.minidom
import datetime
    import validation
from lib.metricxmloutput import DATECREATEDFIELD, VERSIONFIELD
    nodError.text = str(dataStats["status"])

    nodError = ET.SubElement(nodStatus, 'Errors')
    nodError.text = str(dataStats["errors"])

    nodWarning = ET.SubElement(nodStatus, 'Warnings')
    nodWarning.text = str(dataStats["warnings"])

    nodNotTested = ET.SubElement(nodStatus, 'NotTested')
    nodNotTested.text = str(dataStats["nottested"])

    nodStatusLayers = ET.SubElement(nodStatus, 'Layers')
    if "layers" in dataStats:
        for layername, value in dataStats['layers'].iteritems():
            nodNotTested = ET.SubElement(nodStatusLayers, layername)
            nodNotTested.text = str(value)


    nodLayers = ET.SubElement(tree.getroot(), 'Layers')
    for name,layer in dataObj.iteritems():
        nodLayer = ET.SubElement(nodLayers, 'Layer')
        nodName = ET.SubElement(nodLayer, 'Name')
        nodName.text = name
        nodTests = ET.SubElement(nodLayer, 'Tests')
        for test in layer:
            nodTest = ET.SubElement(nodTests, 'Test')
            writeDictionaryToXML(nodTest, test)

    rough_string = ET.tostring(tree.getroot(), 'utf-8')
    reparsed = xml.dom.minidom.parseString(rough_string)

# Path: lib/metricxmloutput.py
# DATECREATEDFIELD = "GenerationDate"
# 
# VERSIONFIELD = "ModelVersion"


# Path: tools/validation/writetoxml.py
import xml.etree.ElementTree as ET
import xml.dom.minidom
import datetime
    import validation
from lib.metricxmloutput import DATECREATEDFIELD, VERSIONFIELD

    nodError.text = str(dataStats["status"])

    nodError = ET.SubElement(nodStatus, 'Errors')
    nodError.text = str(dataStats["errors"])

    nodWarning = ET.SubElement(nodStatus, 'Warnings')
    nodWarning.text = str(dataStats["warnings"])

    nodNotTested = ET.SubElement(nodStatus, 'NotTested')
    nodNotTested.text = str(dataStats["nottested"])

    nodStatusLayers = ET.SubElement(nodStatus, 'Layers')
    if "layers" in dataStats:
        for layername, value in dataStats['layers'].iteritems():
            nodNotTested = ET.SubElement(nodStatusLayers, layername)
            nodNotTested.text = str(value)


    nodLayers = ET.SubElement(tree.getroot(), 'Layers')
    for name,layer in dataObj.iteritems():
        nodLayer = ET.SubElement(nodLayers, 'Layer')
        nodName = ET.SubElement(nodLayer, 'Name')
        nodName.text = name
        nodTests = ET.SubElement(nodLayer, 'Tests')
        for test in layer:
            nodTest = ET.SubElement(nodTests, 'Test')
            writeDictionaryToXML(nodTest, test)

    rough_string = ET.tostring(tree.getroot(), 'utf-8')
    reparsed = xml.dom.minidom.parseString(rough_string)

    pretty = reparsed.toprettyxml(indent="\t")