# 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

    nodMeta = ET.SubElement(tree.getroot(), 'Meta')

    datetag = ET.SubElement(nodMeta, DATECREATEDFIELD)
    datetag.text = datetime.datetime.now().isoformat()

    nodVer = ET.SubElement(nodMeta, VERSIONFIELD)
    nodVer.text = validation.__version__

    nodStatus = ET.SubElement(tree.getroot(), 'Status')

    nodError = ET.SubElement(nodStatus, 'Overall')
    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)



# 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


    nodMeta = ET.SubElement(tree.getroot(), 'Meta')

    datetag = ET.SubElement(nodMeta, DATECREATEDFIELD)
    datetag.text = datetime.datetime.now().isoformat()

    nodVer = ET.SubElement(nodMeta, VERSIONFIELD)
    nodVer.text = validation.__version__

    nodStatus = ET.SubElement(tree.getroot(), 'Status')

    nodError = ET.SubElement(nodStatus, 'Overall')
    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')