#!/usr/bin/env python
# -*- coding: utf-8 -*- 

#
# Generated  by generateDS.py version 2.7b.
#

import sys
import getopt
import re as re_

etree_ = None
Verbose_import_ = False
(   XMLParser_import_none, XMLParser_import_lxml,
    XMLParser_import_elementtree
    ) = range(3)
XMLParser_import_library = None
try:
    # lxml
    from lxml import etree as etree_
    XMLParser_import_library = XMLParser_import_lxml
    if Verbose_import_:
        print("running with lxml.etree")
except ImportError:
    try:
        # cElementTree from Python 2.5+
        import xml.etree.cElementTree as etree_
        XMLParser_import_library = XMLParser_import_elementtree
        if Verbose_import_:
            print("running with cElementTree on Python 2.5+")
    except ImportError:
        try:
            # ElementTree from Python 2.5+
            import xml.etree.ElementTree as etree_
            XMLParser_import_library = XMLParser_import_elementtree
            if Verbose_import_:
                print("running with ElementTree on Python 2.5+")
        except ImportError:
            try:
                # normal cElementTree install
                import cElementTree as etree_
                XMLParser_import_library = XMLParser_import_elementtree
                if Verbose_import_:
                    print("running with cElementTree")
            except ImportError:
                try:
                    # normal ElementTree install
                    import elementtree.ElementTree as etree_
                    XMLParser_import_library = XMLParser_import_elementtree
                    if Verbose_import_:
                        print("running with ElementTree")
                except ImportError:
                    raise ImportError("Failed to import ElementTree from any known place")

def parsexml_(*args, **kwargs):
    if (XMLParser_import_library == XMLParser_import_lxml and
        'parser' not in kwargs):
        # Use the lxml ElementTree compatible parser so that, e.g.,
        #   we ignore comments.
        kwargs['parser'] = etree_.ETCompatXMLParser()
    doc = etree_.parse(*args, **kwargs)
    return doc

#
# User methods
#
# Calls to the methods in these classes are generated by generateDS.py.
# You can replace these methods by re-implementing the following class
#   in a module named generatedssuper.py.

try:
    from generatedssuper import GeneratedsSuper
except ImportError, exp:

    class GeneratedsSuper(object):
        def gds_format_string(self, input_data, input_name=''):
            return input_data
        def gds_validate_string(self, input_data, node, input_name=''):
            return input_data
        def gds_format_integer(self, input_data, input_name=''):
            return '%d' % input_data
        def gds_validate_integer(self, input_data, node, input_name=''):
            return input_data
        def gds_format_integer_list(self, input_data, input_name=''):
            return '%s' % input_data
        def gds_validate_integer_list(self, input_data, node, input_name=''):
            values = input_data.split()
            for value in values:
                try:
                    fvalue = float(value)
                except (TypeError, ValueError), exp:
                    raise_parse_error(node, 'Requires sequence of integers')
            return input_data
        def gds_format_float(self, input_data, input_name=''):
            return '%f' % input_data
        def gds_validate_float(self, input_data, node, input_name=''):
            return input_data
        def gds_format_float_list(self, input_data, input_name=''):
            return '%s' % input_data
        def gds_validate_float_list(self, input_data, node, input_name=''):
            values = input_data.split()
            for value in values:
                try:
                    fvalue = float(value)
                except (TypeError, ValueError), exp:
                    raise_parse_error(node, 'Requires sequence of floats')
            return input_data
        def gds_format_double(self, input_data, input_name=''):
            return '%e' % input_data
        def gds_validate_double(self, input_data, node, input_name=''):
            return input_data
        def gds_format_double_list(self, input_data, input_name=''):
            return '%s' % input_data
        def gds_validate_double_list(self, input_data, node, input_name=''):
            values = input_data.split()
            for value in values:
                try:
                    fvalue = float(value)
                except (TypeError, ValueError), exp:
                    raise_parse_error(node, 'Requires sequence of doubles')
            return input_data
        def gds_format_boolean(self, input_data, input_name=''):
            return '%s' % input_data
        def gds_validate_boolean(self, input_data, node, input_name=''):
            return input_data
        def gds_format_boolean_list(self, input_data, input_name=''):
            return '%s' % input_data
        def gds_validate_boolean_list(self, input_data, node, input_name=''):
            values = input_data.split()
            for value in values:
                if value not in ('true', '1', 'false', '0', ):
                    raise_parse_error(node, 'Requires sequence of booleans ("true", "1", "false", "0")')
            return input_data
        def gds_str_lower(self, instring):
            return instring.lower()
        def get_path_(self, node):
            path_list = []
            self.get_path_list_(node, path_list)
            path_list.reverse()
            path = '/'.join(path_list)
            return path
        Tag_strip_pattern_ = re_.compile(r'\{.*\}')
        def get_path_list_(self, node, path_list):
            if node is None:
                return
            tag = GeneratedsSuper.Tag_strip_pattern_.sub('', node.tag)
            if tag:
                path_list.append(tag)
            self.get_path_list_(node.getparent(), path_list)
        def get_class_obj_(self, node, default_class=None):
            class_obj1 = default_class
            if 'xsi' in node.nsmap:
                classname = node.get('{%s}type' % node.nsmap['xsi'])
                if classname is not None:
                    names = classname.split(':')
                    if len(names) == 2:
                        classname = names[1]
                    class_obj2 = globals().get(classname)
                    if class_obj2 is not None:
                        class_obj1 = class_obj2
            return class_obj1
        def gds_build_any(self, node, type_name=None):
            return None


#
# If you have installed IPython you can uncomment and use the following.
# IPython is available from http://ipython.scipy.org/.
#

## from IPython.Shell import IPShellEmbed
## args = ''
## ipshell = IPShellEmbed(args,
##     banner = 'Dropping into IPython',
##     exit_msg = 'Leaving Interpreter, back to program.')

# Then use the following line where and when you want to drop into the
# IPython shell:
#    ipshell('<some message> -- Entering ipshell.\nHit Ctrl-D to exit')

#
# Globals
#

ExternalEncoding = 'ascii'
Tag_pattern_ = re_.compile(r'({.*})?(.*)')
String_cleanup_pat_ = re_.compile(r"[\n\r\s]+")
Namespace_extract_pat_ = re_.compile(r'{(.*)}(.*)')

#
# Support/utility functions.
#

def showIndent(outfile, level):
    for idx in range(level):
        outfile.write('    ')

def quote_xml(inStr):
    if not inStr:
        return ''
    s1 = (isinstance(inStr, basestring) and inStr or
          '%s' % inStr)
    s1 = s1.replace('&', '&amp;')
    s1 = s1.replace('<', '&lt;')
    s1 = s1.replace('>', '&gt;')
    return s1

def quote_attrib(inStr):
    s1 = (isinstance(inStr, basestring) and inStr or
          '%s' % inStr)
    s1 = s1.replace('&', '&amp;')
    s1 = s1.replace('<', '&lt;')
    s1 = s1.replace('>', '&gt;')
    if '"' in s1:
        if "'" in s1:
            s1 = '"%s"' % s1.replace('"', "&quot;")
        else:
            s1 = "'%s'" % s1
    else:
        s1 = '"%s"' % s1
    return s1

def quote_python(inStr):
    s1 = inStr
    if s1.find("'") == -1:
        if s1.find('\n') == -1:
            return "'%s'" % s1
        else:
            return "'''%s'''" % s1
    else:
        if s1.find('"') != -1:
            s1 = s1.replace('"', '\\"')
        if s1.find('\n') == -1:
            return '"%s"' % s1
        else:
            return '"""%s"""' % s1

def get_all_text_(node):
    if node.text is not None:
        text = node.text
    else:
        text = ''
    for child in node:
        if child.tail is not None:
            text += child.tail
    return text

def find_attr_value_(attr_name, node):
    attrs = node.attrib
    attr_parts = attr_name.split(':')
    value = None
    if len(attr_parts) == 1:
        value = attrs.get(attr_name)
    elif len(attr_parts) == 2:
        prefix, name = attr_parts
        namespace = node.nsmap.get(prefix)
        if namespace is not None:
            value = attrs.get('{%s}%s' % (namespace, name, ))
    return value


class GDSParseError(Exception):
    pass

def raise_parse_error(node, msg):
    if XMLParser_import_library == XMLParser_import_lxml:
        msg = '%s (element %s/line %d)' % (msg, node.tag, node.sourceline, )
    else:
        msg = '%s (element %s)' % (msg, node.tag, )
    raise GDSParseError(msg)


class MixedContainer:
    # Constants for category:
    CategoryNone = 0
    CategoryText = 1
    CategorySimple = 2
    CategoryComplex = 3
    # Constants for content_type:
    TypeNone = 0
    TypeText = 1
    TypeString = 2
    TypeInteger = 3
    TypeFloat = 4
    TypeDecimal = 5
    TypeDouble = 6
    TypeBoolean = 7
    def __init__(self, category, content_type, name, value):
        self.category = category
        self.content_type = content_type
        self.name = name
        self.value = value
    def getCategory(self):
        return self.category
    def getContenttype(self, content_type):
        return self.content_type
    def getValue(self):
        return self.value
    def getName(self):
        return self.name
    def export(self, outfile, level, name, namespace):
        if self.category == MixedContainer.CategoryText:
            # Prevent exporting empty content as empty lines.
            if self.value.strip(): 
                outfile.write(self.value)
        elif self.category == MixedContainer.CategorySimple:
            self.exportSimple(outfile, level, name)
        else:    # category == MixedContainer.CategoryComplex
            self.value.export(outfile, level, namespace,name)
    def exportSimple(self, outfile, level, name):
        if self.content_type == MixedContainer.TypeString:
            outfile.write('<%s>%s</%s>' % (self.name, self.value, self.name))
        elif self.content_type == MixedContainer.TypeInteger or \
                self.content_type == MixedContainer.TypeBoolean:
            outfile.write('<%s>%d</%s>' % (self.name, self.value, self.name))
        elif self.content_type == MixedContainer.TypeFloat or \
                self.content_type == MixedContainer.TypeDecimal:
            outfile.write('<%s>%f</%s>' % (self.name, self.value, self.name))
        elif self.content_type == MixedContainer.TypeDouble:
            outfile.write('<%s>%g</%s>' % (self.name, self.value, self.name))
    def exportLiteral(self, outfile, level, name):
        if self.category == MixedContainer.CategoryText:
            showIndent(outfile, level)
            outfile.write('model_.MixedContainer(%d, %d, "%s", "%s"),\n' % \
                (self.category, self.content_type, self.name, self.value))
        elif self.category == MixedContainer.CategorySimple:
            showIndent(outfile, level)
            outfile.write('model_.MixedContainer(%d, %d, "%s", "%s"),\n' % \
                (self.category, self.content_type, self.name, self.value))
        else:    # category == MixedContainer.CategoryComplex
            showIndent(outfile, level)
            outfile.write('model_.MixedContainer(%d, %d, "%s",\n' % \
                (self.category, self.content_type, self.name,))
            self.value.exportLiteral(outfile, level + 1)
            showIndent(outfile, level)
            outfile.write(')\n')


class MemberSpec_(object):
    def __init__(self, name='', data_type='', container=0):
        self.name = name
        self.data_type = data_type
        self.container = container
    def set_name(self, name): self.name = name
    def get_name(self): return self.name
    def set_data_type(self, data_type): self.data_type = data_type
    def get_data_type_chain(self): return self.data_type
    def get_data_type(self):
        if isinstance(self.data_type, list):
            if len(self.data_type) > 0:
                return self.data_type[-1]
            else:
                return 'xs:string'
        else:
            return self.data_type
    def set_container(self, container): self.container = container
    def get_container(self): return self.container

def _cast(typ, value):
    if typ is None or value is None:
        return value
    return typ(value)

#
# Data representation classes.
#

class SSD_METADATA(GeneratedsSuper):
    subclass = None
    superclass = None
    def __init__(self, MD_SIGNATURE=None, MD_SIGN=None):
        self.MD_SIGNATURE = MD_SIGNATURE
        if MD_SIGN is None:
            self.MD_SIGN = []
        else:
            self.MD_SIGN = MD_SIGN
    def factory(*args_, **kwargs_):
        if SSD_METADATA.subclass:
            return SSD_METADATA.subclass(*args_, **kwargs_)
        else:
            return SSD_METADATA(*args_, **kwargs_)
    factory = staticmethod(factory)
    def get_MD_SIGNATURE(self): return self.MD_SIGNATURE
    def set_MD_SIGNATURE(self, MD_SIGNATURE): self.MD_SIGNATURE = MD_SIGNATURE
    def get_MD_SIGN(self): return self.MD_SIGN
    def set_MD_SIGN(self, MD_SIGN): self.MD_SIGN = MD_SIGN
    def add_MD_SIGN(self, value): self.MD_SIGN.append(value)
    def insert_MD_SIGN(self, index, value): self.MD_SIGN[index] = value
    def export(self, outfile, level, namespace_='', name_='SSD_METADATA', namespacedef_=''):
        showIndent(outfile, level)
        outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', ))
        already_processed = []
        self.exportAttributes(outfile, level, already_processed, namespace_, name_='SSD_METADATA')
        if self.hasContent_():
            outfile.write('>\n')
            self.exportChildren(outfile, level + 1, namespace_, name_)
            showIndent(outfile, level)
            outfile.write('</%s%s>\n' % (namespace_, name_))
        else:
            outfile.write('/>\n')
    def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='SSD_METADATA'):
        pass
    def exportChildren(self, outfile, level, namespace_='', name_='SSD_METADATA', fromsubclass_=False):
        if self.MD_SIGNATURE is not None:
            showIndent(outfile, level)
            outfile.write('<%sMD_SIGNATURE>%s</%sMD_SIGNATURE>\n' % (namespace_, self.gds_format_string(quote_xml(self.MD_SIGNATURE).encode(ExternalEncoding), input_name='MD_SIGNATURE'), namespace_))
        for MD_SIGN_ in self.MD_SIGN:
            MD_SIGN_.export(outfile, level, namespace_, name_='MD_SIGN')
    def hasContent_(self):
        if (
            self.MD_SIGNATURE is not None or
            self.MD_SIGN
            ):
            return True
        else:
            return False
    def exportLiteral(self, outfile, level, name_='SSD_METADATA'):
        level += 1
        self.exportLiteralAttributes(outfile, level, [], name_)
        if self.hasContent_():
            self.exportLiteralChildren(outfile, level, name_)
    def exportLiteralAttributes(self, outfile, level, already_processed, name_):
        pass
    def exportLiteralChildren(self, outfile, level, name_):
        if self.MD_SIGNATURE is not None:
            showIndent(outfile, level)
            outfile.write('MD_SIGNATURE=%s,\n' % quote_python(self.MD_SIGNATURE).encode(ExternalEncoding))
        showIndent(outfile, level)
        outfile.write('MD_SIGN=[\n')
        level += 1
        for MD_SIGN_ in self.MD_SIGN:
            showIndent(outfile, level)
            outfile.write('model_.MD_SIGNType(\n')
            MD_SIGN_.exportLiteral(outfile, level, name_='MD_SIGNType')
            showIndent(outfile, level)
            outfile.write('),\n')
        level -= 1
        showIndent(outfile, level)
        outfile.write('],\n')
    def build(self, node):
        self.buildAttributes(node, node.attrib, [])
        for child in node:
            nodeName_ = Tag_pattern_.match(child.tag).groups()[-1]
            self.buildChildren(child, node, nodeName_)
    def buildAttributes(self, node, attrs, already_processed):
        pass
    def buildChildren(self, child_, node, nodeName_, fromsubclass_=False):
        if nodeName_ == 'MD_SIGNATURE':
            MD_SIGNATURE_ = child_.text
            MD_SIGNATURE_ = self.gds_validate_string(MD_SIGNATURE_, node, 'MD_SIGNATURE')
            self.MD_SIGNATURE = MD_SIGNATURE_
        elif nodeName_ == 'MD_SIGN':
            obj_ = MD_SIGNType.factory()
            obj_.build(child_)
            self.MD_SIGN.append(obj_)
# end class SSD_METADATA


class MD_SIGNType(GeneratedsSuper):
    subclass = None
    superclass = None
    def __init__(self, MD_VERSION=None, MFG_ID=None, SW_VERSION=None, IMG_ENC_INFO=None, IEK_ENC_INFO=None, MD_SIG_INFO=None):
        self.MD_VERSION = MD_VERSION
        self.MFG_ID = MFG_ID
        self.SW_VERSION = SW_VERSION
        if IMG_ENC_INFO is None:
            self.IMG_ENC_INFO = []
        else:
            self.IMG_ENC_INFO = IMG_ENC_INFO
        if IEK_ENC_INFO is None:
            self.IEK_ENC_INFO = []
        else:
            self.IEK_ENC_INFO = IEK_ENC_INFO
        if MD_SIG_INFO is None:
            self.MD_SIG_INFO = []
        else:
            self.MD_SIG_INFO = MD_SIG_INFO
    def factory(*args_, **kwargs_):
        if MD_SIGNType.subclass:
            return MD_SIGNType.subclass(*args_, **kwargs_)
        else:
            return MD_SIGNType(*args_, **kwargs_)
    factory = staticmethod(factory)
    def get_MD_VERSION(self): return self.MD_VERSION
    def set_MD_VERSION(self, MD_VERSION): self.MD_VERSION = MD_VERSION
    def get_MFG_ID(self): return self.MFG_ID
    def set_MFG_ID(self, MFG_ID): self.MFG_ID = MFG_ID
    def get_SW_VERSION(self): return self.SW_VERSION
    def set_SW_VERSION(self, SW_VERSION): self.SW_VERSION = SW_VERSION
    def get_IMG_ENC_INFO(self): return self.IMG_ENC_INFO
    def set_IMG_ENC_INFO(self, IMG_ENC_INFO): self.IMG_ENC_INFO = IMG_ENC_INFO
    def add_IMG_ENC_INFO(self, value): self.IMG_ENC_INFO.append(value)
    def insert_IMG_ENC_INFO(self, index, value): self.IMG_ENC_INFO[index] = value
    def get_IEK_ENC_INFO(self): return self.IEK_ENC_INFO
    def set_IEK_ENC_INFO(self, IEK_ENC_INFO): self.IEK_ENC_INFO = IEK_ENC_INFO
    def add_IEK_ENC_INFO(self, value): self.IEK_ENC_INFO.append(value)
    def insert_IEK_ENC_INFO(self, index, value): self.IEK_ENC_INFO[index] = value
    def get_MD_SIG_INFO(self): return self.MD_SIG_INFO
    def set_MD_SIG_INFO(self, MD_SIG_INFO): self.MD_SIG_INFO = MD_SIG_INFO
    def add_MD_SIG_INFO(self, value): self.MD_SIG_INFO.append(value)
    def insert_MD_SIG_INFO(self, index, value): self.MD_SIG_INFO[index] = value
    def export(self, outfile, level, namespace_='', name_='MD_SIGNType', namespacedef_=''):
        showIndent(outfile, level)
        outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', ))
        already_processed = []
        self.exportAttributes(outfile, level, already_processed, namespace_, name_='MD_SIGNType')
        if self.hasContent_():
            outfile.write('>\n')
            self.exportChildren(outfile, level + 1, namespace_, name_)
            showIndent(outfile, level)
            outfile.write('</%s%s>\n' % (namespace_, name_))
        else:
            outfile.write('/>\n')
    def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='MD_SIGNType'):
        pass
    def exportChildren(self, outfile, level, namespace_='', name_='MD_SIGNType', fromsubclass_=False):
        if self.MD_VERSION is not None:
            showIndent(outfile, level)
            outfile.write('<%sMD_VERSION>%s</%sMD_VERSION>\n' % (namespace_, self.gds_format_string(quote_xml(self.MD_VERSION).encode(ExternalEncoding), input_name='MD_VERSION'), namespace_))
        if self.MFG_ID is not None:
            showIndent(outfile, level)
            outfile.write('<%sMFG_ID>%s</%sMFG_ID>\n' % (namespace_, self.gds_format_string(quote_xml(self.MFG_ID).encode(ExternalEncoding), input_name='MFG_ID'), namespace_))
        if self.SW_VERSION is not None:
            showIndent(outfile, level)
            outfile.write('<%sSW_VERSION>%s</%sSW_VERSION>\n' % (namespace_, self.gds_format_string(quote_xml(self.SW_VERSION).encode(ExternalEncoding), input_name='SW_VERSION'), namespace_))
        for IMG_ENC_INFO_ in self.IMG_ENC_INFO:
            IMG_ENC_INFO_.export(outfile, level, namespace_, name_='IMG_ENC_INFO')
        for IEK_ENC_INFO_ in self.IEK_ENC_INFO:
            IEK_ENC_INFO_.export(outfile, level, namespace_, name_='IEK_ENC_INFO')
        for MD_SIG_INFO_ in self.MD_SIG_INFO:
            MD_SIG_INFO_.export(outfile, level, namespace_, name_='MD_SIG_INFO')
    def hasContent_(self):
        if (
            self.MD_VERSION is not None or
            self.MFG_ID is not None or
            self.SW_VERSION is not None or
            self.IMG_ENC_INFO or
            self.IEK_ENC_INFO or
            self.MD_SIG_INFO
            ):
            return True
        else:
            return False
    def exportLiteral(self, outfile, level, name_='MD_SIGNType'):
        level += 1
        self.exportLiteralAttributes(outfile, level, [], name_)
        if self.hasContent_():
            self.exportLiteralChildren(outfile, level, name_)
    def exportLiteralAttributes(self, outfile, level, already_processed, name_):
        pass
    def exportLiteralChildren(self, outfile, level, name_):
        if self.MD_VERSION is not None:
            showIndent(outfile, level)
            outfile.write('MD_VERSION=%s,\n' % quote_python(self.MD_VERSION).encode(ExternalEncoding))
        if self.MFG_ID is not None:
            showIndent(outfile, level)
            outfile.write('MFG_ID=%s,\n' % quote_python(self.MFG_ID).encode(ExternalEncoding))
        if self.SW_VERSION is not None:
            showIndent(outfile, level)
            outfile.write('SW_VERSION=%s,\n' % quote_python(self.SW_VERSION).encode(ExternalEncoding))
        showIndent(outfile, level)
        outfile.write('IMG_ENC_INFO=[\n')
        level += 1
        for IMG_ENC_INFO_ in self.IMG_ENC_INFO:
            showIndent(outfile, level)
            outfile.write('model_.IMG_ENC_INFOType(\n')
            IMG_ENC_INFO_.exportLiteral(outfile, level, name_='IMG_ENC_INFOType')
            showIndent(outfile, level)
            outfile.write('),\n')
        level -= 1
        showIndent(outfile, level)
        outfile.write('],\n')
        showIndent(outfile, level)
        outfile.write('IEK_ENC_INFO=[\n')
        level += 1
        for IEK_ENC_INFO_ in self.IEK_ENC_INFO:
            showIndent(outfile, level)
            outfile.write('model_.IEK_ENC_INFOType(\n')
            IEK_ENC_INFO_.exportLiteral(outfile, level, name_='IEK_ENC_INFOType')
            showIndent(outfile, level)
            outfile.write('),\n')
        level -= 1
        showIndent(outfile, level)
        outfile.write('],\n')
        showIndent(outfile, level)
        outfile.write('MD_SIG_INFO=[\n')
        level += 1
        for MD_SIG_INFO_ in self.MD_SIG_INFO:
            showIndent(outfile, level)
            outfile.write('model_.MD_SIG_INFOType(\n')
            MD_SIG_INFO_.exportLiteral(outfile, level, name_='MD_SIG_INFOType')
            showIndent(outfile, level)
            outfile.write('),\n')
        level -= 1
        showIndent(outfile, level)
        outfile.write('],\n')
    def build(self, node):
        self.buildAttributes(node, node.attrib, [])
        for child in node:
            nodeName_ = Tag_pattern_.match(child.tag).groups()[-1]
            self.buildChildren(child, node, nodeName_)
    def buildAttributes(self, node, attrs, already_processed):
        pass
    def buildChildren(self, child_, node, nodeName_, fromsubclass_=False):
        if nodeName_ == 'MD_VERSION':
            MD_VERSION_ = child_.text
            MD_VERSION_ = self.gds_validate_string(MD_VERSION_, node, 'MD_VERSION')
            self.MD_VERSION = MD_VERSION_
        elif nodeName_ == 'MFG_ID':
            MFG_ID_ = child_.text
            MFG_ID_ = self.gds_validate_string(MFG_ID_, node, 'MFG_ID')
            self.MFG_ID = MFG_ID_
        elif nodeName_ == 'SW_VERSION':
            SW_VERSION_ = child_.text
            SW_VERSION_ = self.gds_validate_string(SW_VERSION_, node, 'SW_VERSION')
            self.SW_VERSION = SW_VERSION_
        elif nodeName_ == 'IMG_ENC_INFO':
            obj_ = IMG_ENC_INFOType.factory()
            obj_.build(child_)
            self.IMG_ENC_INFO.append(obj_)
        elif nodeName_ == 'IEK_ENC_INFO':
            obj_ = IEK_ENC_INFOType.factory()
            obj_.build(child_)
            self.IEK_ENC_INFO.append(obj_)
        elif nodeName_ == 'MD_SIG_INFO':
            obj_ = MD_SIG_INFOType.factory()
            obj_.build(child_)
            self.MD_SIG_INFO.append(obj_)
# end class MD_SIGNType


class IMG_ENC_INFOType(GeneratedsSuper):
    subclass = None
    superclass = None
    def __init__(self, IMG_ENC_ALGO=None, IMG_ENC_PADDING_TYPE=None, IMG_ENC_OPERATION_MODE=None, IMG_ENC_IV=None):
        self.IMG_ENC_ALGO = IMG_ENC_ALGO
        self.IMG_ENC_PADDING_TYPE = IMG_ENC_PADDING_TYPE
        self.IMG_ENC_OPERATION_MODE = IMG_ENC_OPERATION_MODE
        self.IMG_ENC_IV = IMG_ENC_IV
    def factory(*args_, **kwargs_):
        if IMG_ENC_INFOType.subclass:
            return IMG_ENC_INFOType.subclass(*args_, **kwargs_)
        else:
            return IMG_ENC_INFOType(*args_, **kwargs_)
    factory = staticmethod(factory)
    def get_IMG_ENC_ALGO(self): return self.IMG_ENC_ALGO
    def set_IMG_ENC_ALGO(self, IMG_ENC_ALGO): self.IMG_ENC_ALGO = IMG_ENC_ALGO
    def get_IMG_ENC_PADDING_TYPE(self): return self.IMG_ENC_PADDING_TYPE
    def set_IMG_ENC_PADDING_TYPE(self, IMG_ENC_PADDING_TYPE): self.IMG_ENC_PADDING_TYPE = IMG_ENC_PADDING_TYPE
    def get_IMG_ENC_OPERATION_MODE(self): return self.IMG_ENC_OPERATION_MODE
    def set_IMG_ENC_OPERATION_MODE(self, IMG_ENC_OPERATION_MODE): self.IMG_ENC_OPERATION_MODE = IMG_ENC_OPERATION_MODE
    def get_IMG_ENC_IV(self): return self.IMG_ENC_IV
    def set_IMG_ENC_IV(self, IMG_ENC_IV): self.IMG_ENC_IV = IMG_ENC_IV
    def export(self, outfile, level, namespace_='', name_='IMG_ENC_INFOType', namespacedef_=''):
        showIndent(outfile, level)
        outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', ))
        already_processed = []
        self.exportAttributes(outfile, level, already_processed, namespace_, name_='IMG_ENC_INFOType')
        if self.hasContent_():
            outfile.write('>\n')
            self.exportChildren(outfile, level + 1, namespace_, name_)
            showIndent(outfile, level)
            outfile.write('</%s%s>\n' % (namespace_, name_))
        else:
            outfile.write('/>\n')
    def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='IMG_ENC_INFOType'):
        pass
    def exportChildren(self, outfile, level, namespace_='', name_='IMG_ENC_INFOType', fromsubclass_=False):
        if self.IMG_ENC_ALGO is not None:
            showIndent(outfile, level)
            outfile.write('<%sIMG_ENC_ALGO>%s</%sIMG_ENC_ALGO>\n' % (namespace_, self.gds_format_string(quote_xml(self.IMG_ENC_ALGO).encode(ExternalEncoding), input_name='IMG_ENC_ALGO'), namespace_))
        if self.IMG_ENC_PADDING_TYPE is not None:
            showIndent(outfile, level)
            outfile.write('<%sIMG_ENC_PADDING_TYPE>%s</%sIMG_ENC_PADDING_TYPE>\n' % (namespace_, self.gds_format_string(quote_xml(self.IMG_ENC_PADDING_TYPE).encode(ExternalEncoding), input_name='IMG_ENC_PADDING_TYPE'), namespace_))
        if self.IMG_ENC_OPERATION_MODE is not None:
            showIndent(outfile, level)
            outfile.write('<%sIMG_ENC_OPERATION_MODE>%s</%sIMG_ENC_OPERATION_MODE>\n' % (namespace_, self.gds_format_string(quote_xml(self.IMG_ENC_OPERATION_MODE).encode(ExternalEncoding), input_name='IMG_ENC_OPERATION_MODE'), namespace_))
        if self.IMG_ENC_IV is not None:
            showIndent(outfile, level)
            outfile.write('<%sIMG_ENC_IV>%s</%sIMG_ENC_IV>\n' % (namespace_, self.gds_format_string(quote_xml(self.IMG_ENC_IV).encode(ExternalEncoding), input_name='IMG_ENC_IV'), namespace_))
    def hasContent_(self):
        if (
            self.IMG_ENC_ALGO is not None or
            self.IMG_ENC_PADDING_TYPE is not None or
            self.IMG_ENC_OPERATION_MODE is not None or
            self.IMG_ENC_IV is not None
            ):
            return True
        else:
            return False
    def exportLiteral(self, outfile, level, name_='IMG_ENC_INFOType'):
        level += 1
        self.exportLiteralAttributes(outfile, level, [], name_)
        if self.hasContent_():
            self.exportLiteralChildren(outfile, level, name_)
    def exportLiteralAttributes(self, outfile, level, already_processed, name_):
        pass
    def exportLiteralChildren(self, outfile, level, name_):
        if self.IMG_ENC_ALGO is not None:
            showIndent(outfile, level)
            outfile.write('IMG_ENC_ALGO=%s,\n' % quote_python(self.IMG_ENC_ALGO).encode(ExternalEncoding))
        if self.IMG_ENC_PADDING_TYPE is not None:
            showIndent(outfile, level)
            outfile.write('IMG_ENC_PADDING_TYPE=%s,\n' % quote_python(self.IMG_ENC_PADDING_TYPE).encode(ExternalEncoding))
        if self.IMG_ENC_OPERATION_MODE is not None:
            showIndent(outfile, level)
            outfile.write('IMG_ENC_OPERATION_MODE=%s,\n' % quote_python(self.IMG_ENC_OPERATION_MODE).encode(ExternalEncoding))
        if self.IMG_ENC_IV is not None:
            showIndent(outfile, level)
            outfile.write('IMG_ENC_IV=%s,\n' % quote_python(self.IMG_ENC_IV).encode(ExternalEncoding))
    def build(self, node):
        self.buildAttributes(node, node.attrib, [])
        for child in node:
            nodeName_ = Tag_pattern_.match(child.tag).groups()[-1]
            self.buildChildren(child, node, nodeName_)
    def buildAttributes(self, node, attrs, already_processed):
        pass
    def buildChildren(self, child_, node, nodeName_, fromsubclass_=False):
        if nodeName_ == 'IMG_ENC_ALGO':
            IMG_ENC_ALGO_ = child_.text
            IMG_ENC_ALGO_ = self.gds_validate_string(IMG_ENC_ALGO_, node, 'IMG_ENC_ALGO')
            self.IMG_ENC_ALGO = IMG_ENC_ALGO_
        elif nodeName_ == 'IMG_ENC_PADDING_TYPE':
            IMG_ENC_PADDING_TYPE_ = child_.text
            IMG_ENC_PADDING_TYPE_ = self.gds_validate_string(IMG_ENC_PADDING_TYPE_, node, 'IMG_ENC_PADDING_TYPE')
            self.IMG_ENC_PADDING_TYPE = IMG_ENC_PADDING_TYPE_
        elif nodeName_ == 'IMG_ENC_OPERATION_MODE':
            IMG_ENC_OPERATION_MODE_ = child_.text
            IMG_ENC_OPERATION_MODE_ = self.gds_validate_string(IMG_ENC_OPERATION_MODE_, node, 'IMG_ENC_OPERATION_MODE')
            self.IMG_ENC_OPERATION_MODE = IMG_ENC_OPERATION_MODE_
        elif nodeName_ == 'IMG_ENC_IV':
            IMG_ENC_IV_ = child_.text
            IMG_ENC_IV_ = self.gds_validate_string(IMG_ENC_IV_, node, 'IMG_ENC_IV')
            self.IMG_ENC_IV = IMG_ENC_IV_
# end class IMG_ENC_INFOType


class IEK_ENC_INFOType(GeneratedsSuper):
    subclass = None
    superclass = None
    def __init__(self, IEK_ENC_ALGO=None, IEK_ENC_PADDING_TYPE=None, IEK_ENC_PUB_KEY_ID=None, IEK_ENC_IV=None, IEK_CIPHER_VALUE=None):
        self.IEK_ENC_ALGO = IEK_ENC_ALGO
        self.IEK_ENC_PADDING_TYPE = IEK_ENC_PADDING_TYPE
        self.IEK_ENC_PUB_KEY_ID = IEK_ENC_PUB_KEY_ID
        self.IEK_ENC_IV = IEK_ENC_IV
        self.IEK_CIPHER_VALUE = IEK_CIPHER_VALUE
    def factory(*args_, **kwargs_):
        if IEK_ENC_INFOType.subclass:
            return IEK_ENC_INFOType.subclass(*args_, **kwargs_)
        else:
            return IEK_ENC_INFOType(*args_, **kwargs_)
    factory = staticmethod(factory)
    def get_IEK_ENC_ALGO(self): return self.IEK_ENC_ALGO
    def set_IEK_ENC_ALGO(self, IEK_ENC_ALGO): self.IEK_ENC_ALGO = IEK_ENC_ALGO
    def get_IEK_ENC_PADDING_TYPE(self): return self.IEK_ENC_PADDING_TYPE
    def set_IEK_ENC_PADDING_TYPE(self, IEK_ENC_PADDING_TYPE): self.IEK_ENC_PADDING_TYPE = IEK_ENC_PADDING_TYPE
    def get_IEK_ENC_PUB_KEY_ID(self): return self.IEK_ENC_PUB_KEY_ID
    def set_IEK_ENC_PUB_KEY_ID(self, IEK_ENC_PUB_KEY_ID): self.IEK_ENC_PUB_KEY_ID = IEK_ENC_PUB_KEY_ID
    def get_IEK_ENC_IV(self): return self.IEK_ENC_IV
    def set_IEK_ENC_IV(self, IEK_ENC_IV): self.IEK_ENC_IV = IEK_ENC_IV
    def get_IEK_CIPHER_VALUE(self): return self.IEK_CIPHER_VALUE
    def set_IEK_CIPHER_VALUE(self, IEK_CIPHER_VALUE): self.IEK_CIPHER_VALUE = IEK_CIPHER_VALUE
    def export(self, outfile, level, namespace_='', name_='IEK_ENC_INFOType', namespacedef_=''):
        showIndent(outfile, level)
        outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', ))
        already_processed = []
        self.exportAttributes(outfile, level, already_processed, namespace_, name_='IEK_ENC_INFOType')
        if self.hasContent_():
            outfile.write('>\n')
            self.exportChildren(outfile, level + 1, namespace_, name_)
            showIndent(outfile, level)
            outfile.write('</%s%s>\n' % (namespace_, name_))
        else:
            outfile.write('/>\n')
    def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='IEK_ENC_INFOType'):
        pass
    def exportChildren(self, outfile, level, namespace_='', name_='IEK_ENC_INFOType', fromsubclass_=False):
        if self.IEK_ENC_ALGO is not None:
            showIndent(outfile, level)
            outfile.write('<%sIEK_ENC_ALGO>%s</%sIEK_ENC_ALGO>\n' % (namespace_, self.gds_format_string(quote_xml(self.IEK_ENC_ALGO).encode(ExternalEncoding), input_name='IEK_ENC_ALGO'), namespace_))
        if self.IEK_ENC_PADDING_TYPE is not None:
            showIndent(outfile, level)
            outfile.write('<%sIEK_ENC_PADDING_TYPE>%s</%sIEK_ENC_PADDING_TYPE>\n' % (namespace_, self.gds_format_string(quote_xml(self.IEK_ENC_PADDING_TYPE).encode(ExternalEncoding), input_name='IEK_ENC_PADDING_TYPE'), namespace_))
        if self.IEK_ENC_PUB_KEY_ID is not None:
            showIndent(outfile, level)
            outfile.write('<%sIEK_ENC_PUB_KEY_ID>%s</%sIEK_ENC_PUB_KEY_ID>\n' % (namespace_, self.gds_format_string(quote_xml(self.IEK_ENC_PUB_KEY_ID).encode(ExternalEncoding), input_name='IEK_ENC_PUB_KEY_ID'), namespace_))
        if self.IEK_ENC_IV is not None:
            showIndent(outfile, level)
            outfile.write('<%sIEK_ENC_IV>%s</%sIEK_ENC_IV>\n' % (namespace_, self.gds_format_string(quote_xml(self.IEK_ENC_IV).encode(ExternalEncoding), input_name='IEK_ENC_IV'), namespace_))
        if self.IEK_CIPHER_VALUE is not None:
            showIndent(outfile, level)
            outfile.write('<%sIEK_CIPHER_VALUE>%s</%sIEK_CIPHER_VALUE>\n' % (namespace_, self.gds_format_string(quote_xml(self.IEK_CIPHER_VALUE).encode(ExternalEncoding), input_name='IEK_CIPHER_VALUE'), namespace_))
    def hasContent_(self):
        if (
            self.IEK_ENC_ALGO is not None or
            self.IEK_ENC_PADDING_TYPE is not None or
            self.IEK_ENC_PUB_KEY_ID is not None or
            self.IEK_ENC_IV is not None or
            self.IEK_CIPHER_VALUE is not None
            ):
            return True
        else:
            return False
    def exportLiteral(self, outfile, level, name_='IEK_ENC_INFOType'):
        level += 1
        self.exportLiteralAttributes(outfile, level, [], name_)
        if self.hasContent_():
            self.exportLiteralChildren(outfile, level, name_)
    def exportLiteralAttributes(self, outfile, level, already_processed, name_):
        pass
    def exportLiteralChildren(self, outfile, level, name_):
        if self.IEK_ENC_ALGO is not None:
            showIndent(outfile, level)
            outfile.write('IEK_ENC_ALGO=%s,\n' % quote_python(self.IEK_ENC_ALGO).encode(ExternalEncoding))
        if self.IEK_ENC_PADDING_TYPE is not None:
            showIndent(outfile, level)
            outfile.write('IEK_ENC_PADDING_TYPE=%s,\n' % quote_python(self.IEK_ENC_PADDING_TYPE).encode(ExternalEncoding))
        if self.IEK_ENC_PUB_KEY_ID is not None:
            showIndent(outfile, level)
            outfile.write('IEK_ENC_PUB_KEY_ID=%s,\n' % quote_python(self.IEK_ENC_PUB_KEY_ID).encode(ExternalEncoding))
        if self.IEK_ENC_IV is not None:
            showIndent(outfile, level)
            outfile.write('IEK_ENC_IV=%s,\n' % quote_python(self.IEK_ENC_IV).encode(ExternalEncoding))
        if self.IEK_CIPHER_VALUE is not None:
            showIndent(outfile, level)
            outfile.write('IEK_CIPHER_VALUE=%s,\n' % quote_python(self.IEK_CIPHER_VALUE).encode(ExternalEncoding))
    def build(self, node):
        self.buildAttributes(node, node.attrib, [])
        for child in node:
            nodeName_ = Tag_pattern_.match(child.tag).groups()[-1]
            self.buildChildren(child, node, nodeName_)
    def buildAttributes(self, node, attrs, already_processed):
        pass
    def buildChildren(self, child_, node, nodeName_, fromsubclass_=False):
        if nodeName_ == 'IEK_ENC_ALGO':
            IEK_ENC_ALGO_ = child_.text
            IEK_ENC_ALGO_ = self.gds_validate_string(IEK_ENC_ALGO_, node, 'IEK_ENC_ALGO')
            self.IEK_ENC_ALGO = IEK_ENC_ALGO_
        elif nodeName_ == 'IEK_ENC_PADDING_TYPE':
            IEK_ENC_PADDING_TYPE_ = child_.text
            IEK_ENC_PADDING_TYPE_ = self.gds_validate_string(IEK_ENC_PADDING_TYPE_, node, 'IEK_ENC_PADDING_TYPE')
            self.IEK_ENC_PADDING_TYPE = IEK_ENC_PADDING_TYPE_
        elif nodeName_ == 'IEK_ENC_PUB_KEY_ID':
            IEK_ENC_PUB_KEY_ID_ = child_.text
            IEK_ENC_PUB_KEY_ID_ = self.gds_validate_string(IEK_ENC_PUB_KEY_ID_, node, 'IEK_ENC_PUB_KEY_ID')
            self.IEK_ENC_PUB_KEY_ID = IEK_ENC_PUB_KEY_ID_
        elif nodeName_ == 'IEK_ENC_IV':
            IEK_ENC_IV_ = child_.text
            IEK_ENC_IV_ = self.gds_validate_string(IEK_ENC_IV_, node, 'IEK_ENC_IV')
            self.IEK_ENC_IV = IEK_ENC_IV_
        elif nodeName_ == 'IEK_CIPHER_VALUE':
            IEK_CIPHER_VALUE_ = child_.text
            IEK_CIPHER_VALUE_ = self.gds_validate_string(IEK_CIPHER_VALUE_, node, 'IEK_CIPHER_VALUE')
            self.IEK_CIPHER_VALUE = IEK_CIPHER_VALUE_
# end class IEK_ENC_INFOType


class MD_SIG_INFOType(GeneratedsSuper):
    subclass = None
    superclass = None
    def __init__(self, MD_SIG_ALGO=None, MD_SIG_DGST_ALGO=None, MD_SIG_PADDING_TYPE=None, MD_SIG_OEM_PUB_KEY_ID=None):
        self.MD_SIG_ALGO = MD_SIG_ALGO
        self.MD_SIG_DGST_ALGO = MD_SIG_DGST_ALGO
        self.MD_SIG_PADDING_TYPE = MD_SIG_PADDING_TYPE
        self.MD_SIG_OEM_PUB_KEY_ID = MD_SIG_OEM_PUB_KEY_ID
    def factory(*args_, **kwargs_):
        if MD_SIG_INFOType.subclass:
            return MD_SIG_INFOType.subclass(*args_, **kwargs_)
        else:
            return MD_SIG_INFOType(*args_, **kwargs_)
    factory = staticmethod(factory)
    def get_MD_SIG_ALGO(self): return self.MD_SIG_ALGO
    def set_MD_SIG_ALGO(self, MD_SIG_ALGO): self.MD_SIG_ALGO = MD_SIG_ALGO
    def get_MD_SIG_DGST_ALGO(self): return self.MD_SIG_DGST_ALGO
    def set_MD_SIG_DGST_ALGO(self, MD_SIG_DGST_ALGO): self.MD_SIG_DGST_ALGO = MD_SIG_DGST_ALGO
    def get_MD_SIG_PADDING_TYPE(self): return self.MD_SIG_PADDING_TYPE
    def set_MD_SIG_PADDING_TYPE(self, MD_SIG_PADDING_TYPE): self.MD_SIG_PADDING_TYPE = MD_SIG_PADDING_TYPE
    def get_MD_SIG_OEM_PUB_KEY_ID(self): return self.MD_SIG_OEM_PUB_KEY_ID
    def set_MD_SIG_OEM_PUB_KEY_ID(self, MD_SIG_OEM_PUB_KEY_ID): self.MD_SIG_OEM_PUB_KEY_ID = MD_SIG_OEM_PUB_KEY_ID
    def export(self, outfile, level, namespace_='', name_='MD_SIG_INFOType', namespacedef_=''):
        showIndent(outfile, level)
        outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', ))
        already_processed = []
        self.exportAttributes(outfile, level, already_processed, namespace_, name_='MD_SIG_INFOType')
        if self.hasContent_():
            outfile.write('>\n')
            self.exportChildren(outfile, level + 1, namespace_, name_)
            showIndent(outfile, level)
            outfile.write('</%s%s>\n' % (namespace_, name_))
        else:
            outfile.write('/>\n')
    def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='MD_SIG_INFOType'):
        pass
    def exportChildren(self, outfile, level, namespace_='', name_='MD_SIG_INFOType', fromsubclass_=False):
        if self.MD_SIG_ALGO is not None:
            showIndent(outfile, level)
            outfile.write('<%sMD_SIG_ALGO>%s</%sMD_SIG_ALGO>\n' % (namespace_, self.gds_format_string(quote_xml(self.MD_SIG_ALGO).encode(ExternalEncoding), input_name='MD_SIG_ALGO'), namespace_))
        if self.MD_SIG_DGST_ALGO is not None:
            showIndent(outfile, level)
            outfile.write('<%sMD_SIG_DGST_ALGO>%s</%sMD_SIG_DGST_ALGO>\n' % (namespace_, self.gds_format_string(quote_xml(self.MD_SIG_DGST_ALGO).encode(ExternalEncoding), input_name='MD_SIG_DGST_ALGO'), namespace_))
        if self.MD_SIG_PADDING_TYPE is not None:
            showIndent(outfile, level)
            outfile.write('<%sMD_SIG_PADDING_TYPE>%s</%sMD_SIG_PADDING_TYPE>\n' % (namespace_, self.gds_format_string(quote_xml(self.MD_SIG_PADDING_TYPE).encode(ExternalEncoding), input_name='MD_SIG_PADDING_TYPE'), namespace_))
        if self.MD_SIG_OEM_PUB_KEY_ID is not None:
            showIndent(outfile, level)
            outfile.write('<%sMD_SIG_OEM_PUB_KEY_ID>%s</%sMD_SIG_OEM_PUB_KEY_ID>\n' % (namespace_, self.gds_format_string(quote_xml(self.MD_SIG_OEM_PUB_KEY_ID).encode(ExternalEncoding), input_name='MD_SIG_OEM_PUB_KEY_ID'), namespace_))
    def hasContent_(self):
        if (
            self.MD_SIG_ALGO is not None or
            self.MD_SIG_DGST_ALGO is not None or
            self.MD_SIG_PADDING_TYPE is not None or
            self.MD_SIG_OEM_PUB_KEY_ID is not None
            ):
            return True
        else:
            return False
    def exportLiteral(self, outfile, level, name_='MD_SIG_INFOType'):
        level += 1
        self.exportLiteralAttributes(outfile, level, [], name_)
        if self.hasContent_():
            self.exportLiteralChildren(outfile, level, name_)
    def exportLiteralAttributes(self, outfile, level, already_processed, name_):
        pass
    def exportLiteralChildren(self, outfile, level, name_):
        if self.MD_SIG_ALGO is not None:
            showIndent(outfile, level)
            outfile.write('MD_SIG_ALGO=%s,\n' % quote_python(self.MD_SIG_ALGO).encode(ExternalEncoding))
        if self.MD_SIG_DGST_ALGO is not None:
            showIndent(outfile, level)
            outfile.write('MD_SIG_DGST_ALGO=%s,\n' % quote_python(self.MD_SIG_DGST_ALGO).encode(ExternalEncoding))
        if self.MD_SIG_PADDING_TYPE is not None:
            showIndent(outfile, level)
            outfile.write('MD_SIG_PADDING_TYPE=%s,\n' % quote_python(self.MD_SIG_PADDING_TYPE).encode(ExternalEncoding))
        if self.MD_SIG_OEM_PUB_KEY_ID is not None:
            showIndent(outfile, level)
            outfile.write('MD_SIG_OEM_PUB_KEY_ID=%s,\n' % quote_python(self.MD_SIG_OEM_PUB_KEY_ID).encode(ExternalEncoding))
    def build(self, node):
        self.buildAttributes(node, node.attrib, [])
        for child in node:
            nodeName_ = Tag_pattern_.match(child.tag).groups()[-1]
            self.buildChildren(child, node, nodeName_)
    def buildAttributes(self, node, attrs, already_processed):
        pass
    def buildChildren(self, child_, node, nodeName_, fromsubclass_=False):
        if nodeName_ == 'MD_SIG_ALGO':
            MD_SIG_ALGO_ = child_.text
            MD_SIG_ALGO_ = self.gds_validate_string(MD_SIG_ALGO_, node, 'MD_SIG_ALGO')
            self.MD_SIG_ALGO = MD_SIG_ALGO_
        elif nodeName_ == 'MD_SIG_DGST_ALGO':
            MD_SIG_DGST_ALGO_ = child_.text
            MD_SIG_DGST_ALGO_ = self.gds_validate_string(MD_SIG_DGST_ALGO_, node, 'MD_SIG_DGST_ALGO')
            self.MD_SIG_DGST_ALGO = MD_SIG_DGST_ALGO_
        elif nodeName_ == 'MD_SIG_PADDING_TYPE':
            MD_SIG_PADDING_TYPE_ = child_.text
            MD_SIG_PADDING_TYPE_ = self.gds_validate_string(MD_SIG_PADDING_TYPE_, node, 'MD_SIG_PADDING_TYPE')
            self.MD_SIG_PADDING_TYPE = MD_SIG_PADDING_TYPE_
        elif nodeName_ == 'MD_SIG_OEM_PUB_KEY_ID':
            MD_SIG_OEM_PUB_KEY_ID_ = child_.text
            MD_SIG_OEM_PUB_KEY_ID_ = self.gds_validate_string(MD_SIG_OEM_PUB_KEY_ID_, node, 'MD_SIG_OEM_PUB_KEY_ID')
            self.MD_SIG_OEM_PUB_KEY_ID = MD_SIG_OEM_PUB_KEY_ID_
# end class MD_SIG_INFOType


USAGE_TEXT = """
Usage: python <Parser>.py [ -s ] <in_xml_file>
"""

def usage():
    print USAGE_TEXT
    sys.exit(1)


def get_root_tag(node):
    tag = Tag_pattern_.match(node.tag).groups()[-1]
    rootClass = globals().get(tag)
    return tag, rootClass


def parse(inFileName):
    doc = parsexml_(inFileName)
    rootNode = doc.getroot()
    rootTag, rootClass = get_root_tag(rootNode)
    if rootClass is None:
        rootTag = 'SSD_METADATA'
        rootClass = SSD_METADATA
    rootObj = rootClass.factory()
    rootObj.build(rootNode)
    # Enable Python to collect the space used by the DOM.
    doc = None
    sys.stdout.write('<?xml version="1.0" ?>\n')
    rootObj.export(sys.stdout, 0, name_=rootTag, 
        namespacedef_='')
    return rootObj


def parseString(inString):
    from StringIO import StringIO
    doc = parsexml_(StringIO(inString))
    rootNode = doc.getroot()
    rootTag, rootClass = get_root_tag(rootNode)
    if rootClass is None:
        rootTag = 'SSD_METADATA'
        rootClass = SSD_METADATA
    rootObj = rootClass.factory()
    rootObj.build(rootNode)
    # Enable Python to collect the space used by the DOM.
    doc = None
    sys.stdout.write('<?xml version="1.0" ?>\n')
    rootObj.export(sys.stdout, 0, name_="SSD_METADATA",
        namespacedef_='')
    return rootObj


def parseLiteral(inFileName):
    doc = parsexml_(inFileName)
    rootNode = doc.getroot()
    rootTag, rootClass = get_root_tag(rootNode)
    if rootClass is None:
        rootTag = 'SSD_METADATA'
        rootClass = SSD_METADATA
    rootObj = rootClass.factory()
    rootObj.build(rootNode)
    # Enable Python to collect the space used by the DOM.
    doc = None
    sys.stdout.write('#from auto_gen_ssd_xml_config import *\n\n')
    sys.stdout.write('import auto_gen_ssd_xml_config as model_\n\n')
    sys.stdout.write('rootObj = model_.rootTag(\n')
    rootObj.exportLiteral(sys.stdout, 0, name_=rootTag)
    sys.stdout.write(')\n')
    return rootObj


def main():
    args = sys.argv[1:]
    if len(args) == 1:
        parse(args[0])
    else:
        usage()


if __name__ == '__main__':
    #import pdb; pdb.set_trace()
    main()


__all__ = [
    "IEK_ENC_INFOType",
    "IMG_ENC_INFOType",
    "MD_SIGNType",
    "MD_SIG_INFOType",
    "SSD_METADATA"
    ]
