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

#
# Generated  by generateDS.py.
# Python 2.7.13 (default, May  2 2017, 14:07:15)  [GCC 6.3.0 20170406]
#
# Command line options:
#   ('--no-dates', '')
#   ('--no-versions', '')
#   ('--member-specs', 'list')
#   ('-f', '')
#   ('-o', 'tests/validate_simpletypes2_sup.py')
#   ('-s', 'tests/validate_simpletypes2_sub.py')
#   ('--super', 'validate_simpletypes2_sup')
#
# Command line arguments:
#   tests/validate_simpletypes.xsd
#
# Command line:
#   generateDS.py --no-dates --no-versions --member-specs="list" -f -o "tests/validate_simpletypes2_sup.py" -s "tests/validate_simpletypes2_sub.py" --super="validate_simpletypes2_sup" tests/validate_simpletypes.xsd
#
# Current working directory (os.getcwd()):
#   generateds
#

import sys
import re as re_
import base64
import datetime as datetime_
import warnings as warnings_
try:
    from lxml import etree as etree_
except ImportError:
    from xml.etree import ElementTree as etree_


Validate_simpletypes_ = True
if sys.version_info.major == 2:
    BaseStrType_ = basestring
else:
    BaseStrType_ = str


def parsexml_(infile, parser=None, **kwargs):
    if parser is None:
        # Use the lxml ElementTree compatible parser so that, e.g.,
        #   we ignore comments.
        try:
            parser = etree_.ETCompatXMLParser()
        except AttributeError:
            # fallback to xml.etree
            parser = etree_.XMLParser()
    doc = etree_.parse(infile, parser=parser, **kwargs)
    return doc

#
# Namespace prefix definition table (and other attributes, too)
#
# The module generatedsnamespaces, if it is importable, must contain
# a dictionary named GeneratedsNamespaceDefs.  This Python dictionary
# should map element type names (strings) to XML schema namespace prefix
# definitions.  The export method for any class for which there is
# a namespace prefix definition, will export that definition in the
# XML representation of that element.  See the export method of
# any generated element type class for a example of the use of this
# table.
# A sample table is:
#
#     # File: generatedsnamespaces.py
#
#     GenerateDSNamespaceDefs = {
#         "ElementtypeA": "http://www.xxx.com/namespaceA",
#         "ElementtypeB": "http://www.xxx.com/namespaceB",
#     }
#

try:
    from generatedsnamespaces import GenerateDSNamespaceDefs as GenerateDSNamespaceDefs_
except ImportError:
    GenerateDSNamespaceDefs_ = {}

#
# The root super-class for element type classes
#
# 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 as exp:
    
    class GeneratedsSuper(object):
        tzoff_pattern = re_.compile(r'(\+|-)((0\d|1[0-3]):[0-5]\d|14:00)$')
        class _FixedOffsetTZ(datetime_.tzinfo):
            def __init__(self, offset, name):
                self.__offset = datetime_.timedelta(minutes=offset)
                self.__name = name
            def utcoffset(self, dt):
                return self.__offset
            def tzname(self, dt):
                return self.__name
            def dst(self, dt):
                return None
        def gds_format_string(self, input_data, input_name=''):
            return input_data
        def gds_validate_string(self, input_data, node=None, input_name=''):
            if not input_data:
                return ''
            else:
                return input_data
        def gds_format_base64(self, input_data, input_name=''):
            return base64.b64encode(input_data)
        def gds_validate_base64(self, input_data, node=None, 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=None, input_name=''):
            return input_data
        def gds_format_integer_list(self, input_data, input_name=''):
            return '%s' % ' '.join(input_data)
        def gds_validate_integer_list(
                self, input_data, node=None, input_name=''):
            values = input_data.split()
            for value in values:
                try:
                    int(value)
                except (TypeError, ValueError):
                    raise_parse_error(node, 'Requires sequence of integers')
            return values
        def gds_format_float(self, input_data, input_name=''):
            return ('%.15f' % input_data).rstrip('0')
        def gds_validate_float(self, input_data, node=None, input_name=''):
            return input_data
        def gds_format_float_list(self, input_data, input_name=''):
            return '%s' % ' '.join(input_data)
        def gds_validate_float_list(
                self, input_data, node=None, input_name=''):
            values = input_data.split()
            for value in values:
                try:
                    float(value)
                except (TypeError, ValueError):
                    raise_parse_error(node, 'Requires sequence of floats')
            return values
        def gds_format_double(self, input_data, input_name=''):
            return '%e' % input_data
        def gds_validate_double(self, input_data, node=None, input_name=''):
            return input_data
        def gds_format_double_list(self, input_data, input_name=''):
            return '%s' % ' '.join(input_data)
        def gds_validate_double_list(
                self, input_data, node=None, input_name=''):
            values = input_data.split()
            for value in values:
                try:
                    float(value)
                except (TypeError, ValueError):
                    raise_parse_error(node, 'Requires sequence of doubles')
            return values
        def gds_format_boolean(self, input_data, input_name=''):
            return ('%s' % input_data).lower()
        def gds_validate_boolean(self, input_data, node=None, input_name=''):
            return input_data
        def gds_format_boolean_list(self, input_data, input_name=''):
            return '%s' % ' '.join(input_data)
        def gds_validate_boolean_list(
                self, input_data, node=None, 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 values
        def gds_validate_datetime(self, input_data, node=None, input_name=''):
            return input_data
        def gds_format_datetime(self, input_data, input_name=''):
            if input_data.microsecond == 0:
                _svalue = '%04d-%02d-%02dT%02d:%02d:%02d' % (
                    input_data.year,
                    input_data.month,
                    input_data.day,
                    input_data.hour,
                    input_data.minute,
                    input_data.second,
                )
            else:
                _svalue = '%04d-%02d-%02dT%02d:%02d:%02d.%s' % (
                    input_data.year,
                    input_data.month,
                    input_data.day,
                    input_data.hour,
                    input_data.minute,
                    input_data.second,
                    ('%f' % (float(input_data.microsecond) / 1000000))[2:],
                )
            if input_data.tzinfo is not None:
                tzoff = input_data.tzinfo.utcoffset(input_data)
                if tzoff is not None:
                    total_seconds = tzoff.seconds + (86400 * tzoff.days)
                    if total_seconds == 0:
                        _svalue += 'Z'
                    else:
                        if total_seconds < 0:
                            _svalue += '-'
                            total_seconds *= -1
                        else:
                            _svalue += '+'
                        hours = total_seconds // 3600
                        minutes = (total_seconds - (hours * 3600)) // 60
                        _svalue += '{0:02d}:{1:02d}'.format(hours, minutes)
            return _svalue
        @classmethod
        def gds_parse_datetime(cls, input_data):
            tz = None
            if input_data[-1] == 'Z':
                tz = GeneratedsSuper._FixedOffsetTZ(0, 'UTC')
                input_data = input_data[:-1]
            else:
                results = GeneratedsSuper.tzoff_pattern.search(input_data)
                if results is not None:
                    tzoff_parts = results.group(2).split(':')
                    tzoff = int(tzoff_parts[0]) * 60 + int(tzoff_parts[1])
                    if results.group(1) == '-':
                        tzoff *= -1
                    tz = GeneratedsSuper._FixedOffsetTZ(
                        tzoff, results.group(0))
                    input_data = input_data[:-6]
            time_parts = input_data.split('.')
            if len(time_parts) > 1:
                micro_seconds = int(float('0.' + time_parts[1]) * 1000000)
                input_data = '%s.%s' % (time_parts[0], micro_seconds, )
                dt = datetime_.datetime.strptime(
                    input_data, '%Y-%m-%dT%H:%M:%S.%f')
            else:
                dt = datetime_.datetime.strptime(
                    input_data, '%Y-%m-%dT%H:%M:%S')
            dt = dt.replace(tzinfo=tz)
            return dt
        def gds_validate_date(self, input_data, node=None, input_name=''):
            return input_data
        def gds_format_date(self, input_data, input_name=''):
            _svalue = '%04d-%02d-%02d' % (
                input_data.year,
                input_data.month,
                input_data.day,
            )
            try:
                if input_data.tzinfo is not None:
                    tzoff = input_data.tzinfo.utcoffset(input_data)
                    if tzoff is not None:
                        total_seconds = tzoff.seconds + (86400 * tzoff.days)
                        if total_seconds == 0:
                            _svalue += 'Z'
                        else:
                            if total_seconds < 0:
                                _svalue += '-'
                                total_seconds *= -1
                            else:
                                _svalue += '+'
                            hours = total_seconds // 3600
                            minutes = (total_seconds - (hours * 3600)) // 60
                            _svalue += '{0:02d}:{1:02d}'.format(
                                hours, minutes)
            except AttributeError:
                pass
            return _svalue
        @classmethod
        def gds_parse_date(cls, input_data):
            tz = None
            if input_data[-1] == 'Z':
                tz = GeneratedsSuper._FixedOffsetTZ(0, 'UTC')
                input_data = input_data[:-1]
            else:
                results = GeneratedsSuper.tzoff_pattern.search(input_data)
                if results is not None:
                    tzoff_parts = results.group(2).split(':')
                    tzoff = int(tzoff_parts[0]) * 60 + int(tzoff_parts[1])
                    if results.group(1) == '-':
                        tzoff *= -1
                    tz = GeneratedsSuper._FixedOffsetTZ(
                        tzoff, results.group(0))
                    input_data = input_data[:-6]
            dt = datetime_.datetime.strptime(input_data, '%Y-%m-%d')
            dt = dt.replace(tzinfo=tz)
            return dt.date()
        def gds_validate_time(self, input_data, node=None, input_name=''):
            return input_data
        def gds_format_time(self, input_data, input_name=''):
            if input_data.microsecond == 0:
                _svalue = '%02d:%02d:%02d' % (
                    input_data.hour,
                    input_data.minute,
                    input_data.second,
                )
            else:
                _svalue = '%02d:%02d:%02d.%s' % (
                    input_data.hour,
                    input_data.minute,
                    input_data.second,
                    ('%f' % (float(input_data.microsecond) / 1000000))[2:],
                )
            if input_data.tzinfo is not None:
                tzoff = input_data.tzinfo.utcoffset(input_data)
                if tzoff is not None:
                    total_seconds = tzoff.seconds + (86400 * tzoff.days)
                    if total_seconds == 0:
                        _svalue += 'Z'
                    else:
                        if total_seconds < 0:
                            _svalue += '-'
                            total_seconds *= -1
                        else:
                            _svalue += '+'
                        hours = total_seconds // 3600
                        minutes = (total_seconds - (hours * 3600)) // 60
                        _svalue += '{0:02d}:{1:02d}'.format(hours, minutes)
            return _svalue
        def gds_validate_simple_patterns(self, patterns, target):
            # pat is a list of lists of strings/patterns.  We should:
            # - AND the outer elements
            # - OR the inner elements
            found1 = True
            for patterns1 in patterns:
                found2 = False
                for patterns2 in patterns1:
                    if re_.search(patterns2, target) is not None:
                        found2 = True
                        break
                if not found2:
                    found1 = False
                    break
            return found1
        @classmethod
        def gds_parse_time(cls, input_data):
            tz = None
            if input_data[-1] == 'Z':
                tz = GeneratedsSuper._FixedOffsetTZ(0, 'UTC')
                input_data = input_data[:-1]
            else:
                results = GeneratedsSuper.tzoff_pattern.search(input_data)
                if results is not None:
                    tzoff_parts = results.group(2).split(':')
                    tzoff = int(tzoff_parts[0]) * 60 + int(tzoff_parts[1])
                    if results.group(1) == '-':
                        tzoff *= -1
                    tz = GeneratedsSuper._FixedOffsetTZ(
                        tzoff, results.group(0))
                    input_data = input_data[:-6]
            if len(input_data.split('.')) > 1:
                dt = datetime_.datetime.strptime(input_data, '%H:%M:%S.%f')
            else:
                dt = datetime_.datetime.strptime(input_data, '%H:%M:%S')
            dt = dt.replace(tzinfo=tz)
            return dt.time()
        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
        @classmethod
        def gds_reverse_node_mapping(cls, mapping):
            return dict(((v, k) for k, v in mapping.iteritems()))
        @staticmethod
        def gds_encode(instring):
            if sys.version_info.major == 2:
                return instring.encode(ExternalEncoding)
            else:
                return instring
        @staticmethod
        def convert_unicode(instring):
            if isinstance(instring, str):
                result = quote_xml(instring)
            elif sys.version_info.major == 2 and isinstance(instring, unicode):
                result = quote_xml(instring).encode('utf8')
            else:
                result = GeneratedsSuper.gds_encode(str(instring))
            return result
        def __eq__(self, other):
            if type(self) != type(other):
                return False
            return self.__dict__ == other.__dict__
        def __ne__(self, other):
            return not self.__eq__(other)
    
    def getSubclassFromModule_(module, class_):
        '''Get the subclass of a class from a specific module.'''
        name = class_.__name__ + 'Sub'
        if hasattr(module, name):
            return getattr(module, name)
        else:
            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'{(.*)}(.*)')
CDATA_pattern_ = re_.compile(r"<!\[CDATA\[.*?\]\]>", re_.DOTALL)

# Change this to redirect the generated superclass module to use a
# specific subclass module.
CurrentSubclassModule_ = None

#
# Support/utility functions.
#


def showIndent(outfile, level, pretty_print=True):
    if pretty_print:
        for idx in range(level):
            outfile.write('    ')


def quote_xml(inStr):
    "Escape markup chars, but do not modify CDATA sections."
    if not inStr:
        return ''
    s1 = (isinstance(inStr, BaseStrType_) and inStr or '%s' % inStr)
    s2 = ''
    pos = 0
    matchobjects = CDATA_pattern_.finditer(s1)
    for mo in matchobjects:
        s3 = s1[pos:mo.start()]
        s2 += quote_xml_aux(s3)
        s2 += s1[mo.start():mo.end()]
        pos = mo.end()
    s3 = s1[pos:]
    s2 += quote_xml_aux(s3)
    return s2


def quote_xml_aux(inStr):
    s1 = inStr.replace('&', '&amp;')
    s1 = s1.replace('<', '&lt;')
    s1 = s1.replace('>', '&gt;')
    return s1


def quote_attrib(inStr):
    s1 = (isinstance(inStr, BaseStrType_) 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):
    msg = '%s (element %s/line %d)' % (msg, node.tag, node.sourceline, )
    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
    TypeBase64 = 8
    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,
               pretty_print=True):
        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,
                pretty_print=pretty_print)
    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))
        elif self.content_type == MixedContainer.TypeBase64:
            outfile.write('<%s>%s</%s>' % (
                self.name,
                base64.b64encode(self.value),
                self.name))
    def to_etree(self, element):
        if self.category == MixedContainer.CategoryText:
            # Prevent exporting empty content as empty lines.
            if self.value.strip():
                if len(element) > 0:
                    if element[-1].tail is None:
                        element[-1].tail = self.value
                    else:
                        element[-1].tail += self.value
                else:
                    if element.text is None:
                        element.text = self.value
                    else:
                        element.text += self.value
        elif self.category == MixedContainer.CategorySimple:
            subelement = etree_.SubElement(
                element, '%s' % self.name)
            subelement.text = self.to_etree_simple()
        else:    # category == MixedContainer.CategoryComplex
            self.value.to_etree(element)
    def to_etree_simple(self):
        if self.content_type == MixedContainer.TypeString:
            text = self.value
        elif (self.content_type == MixedContainer.TypeInteger or
                self.content_type == MixedContainer.TypeBoolean):
            text = '%d' % self.value
        elif (self.content_type == MixedContainer.TypeFloat or
                self.content_type == MixedContainer.TypeDecimal):
            text = '%f' % self.value
        elif self.content_type == MixedContainer.TypeDouble:
            text = '%g' % self.value
        elif self.content_type == MixedContainer.TypeBase64:
            text = '%s' % base64.b64encode(self.value)
        return text
    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,
            optional=0, child_attrs=None, choice=None):
        self.name = name
        self.data_type = data_type
        self.container = container
        self.child_attrs = child_attrs
        self.choice = choice
        self.optional = optional
    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 set_child_attrs(self, child_attrs): self.child_attrs = child_attrs
    def get_child_attrs(self): return self.child_attrs
    def set_choice(self, choice): self.choice = choice
    def get_choice(self): return self.choice
    def set_optional(self, optional): self.optional = optional
    def get_optional(self): return self.optional


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

#
# Data representation classes.
#


class containerType(GeneratedsSuper):
    member_data_items_ = [
        MemberSpec_('sample1', 'simpleOneType', 1, 0, {u'maxOccurs': u'unbounded', u'type': u'simpleOneType', u'name': u'sample1'}, None),
        MemberSpec_('sample2_bad', 'simpleOneType', 1, 0, {u'maxOccurs': u'unbounded', u'type': u'simpleOneType', u'name': u'sample2_bad'}, None),
        MemberSpec_('sample3_bad', 'simpleOneType', 1, 0, {u'maxOccurs': u'unbounded', u'type': u'simpleOneType', u'name': u'sample3_bad'}, None),
        MemberSpec_('sample4_bad', 'simpleOneType', 1, 0, {u'maxOccurs': u'unbounded', u'type': u'simpleOneType', u'name': u'sample4_bad'}, None),
        MemberSpec_('sample2', 'simpleTwoType', 1, 0, {u'maxOccurs': u'unbounded', u'type': u'simpleTwoType', u'name': u'sample2'}, None),
    ]
    subclass = None
    superclass = None
    def __init__(self, sample1=None, sample2_bad=None, sample3_bad=None, sample4_bad=None, sample2=None):
        self.original_tagname_ = None
        if sample1 is None:
            self.sample1 = []
        else:
            self.sample1 = sample1
        if sample2_bad is None:
            self.sample2_bad = []
        else:
            self.sample2_bad = sample2_bad
        if sample3_bad is None:
            self.sample3_bad = []
        else:
            self.sample3_bad = sample3_bad
        if sample4_bad is None:
            self.sample4_bad = []
        else:
            self.sample4_bad = sample4_bad
        if sample2 is None:
            self.sample2 = []
        else:
            self.sample2 = sample2
    def factory(*args_, **kwargs_):
        if CurrentSubclassModule_ is not None:
            subclass = getSubclassFromModule_(
                CurrentSubclassModule_, containerType)
            if subclass is not None:
                return subclass(*args_, **kwargs_)
        if containerType.subclass:
            return containerType.subclass(*args_, **kwargs_)
        else:
            return containerType(*args_, **kwargs_)
    factory = staticmethod(factory)
    def get_sample1(self): return self.sample1
    def set_sample1(self, sample1): self.sample1 = sample1
    def add_sample1(self, value): self.sample1.append(value)
    def insert_sample1_at(self, index, value): self.sample1.insert(index, value)
    def replace_sample1_at(self, index, value): self.sample1[index] = value
    def get_sample2_bad(self): return self.sample2_bad
    def set_sample2_bad(self, sample2_bad): self.sample2_bad = sample2_bad
    def add_sample2_bad(self, value): self.sample2_bad.append(value)
    def insert_sample2_bad_at(self, index, value): self.sample2_bad.insert(index, value)
    def replace_sample2_bad_at(self, index, value): self.sample2_bad[index] = value
    def get_sample3_bad(self): return self.sample3_bad
    def set_sample3_bad(self, sample3_bad): self.sample3_bad = sample3_bad
    def add_sample3_bad(self, value): self.sample3_bad.append(value)
    def insert_sample3_bad_at(self, index, value): self.sample3_bad.insert(index, value)
    def replace_sample3_bad_at(self, index, value): self.sample3_bad[index] = value
    def get_sample4_bad(self): return self.sample4_bad
    def set_sample4_bad(self, sample4_bad): self.sample4_bad = sample4_bad
    def add_sample4_bad(self, value): self.sample4_bad.append(value)
    def insert_sample4_bad_at(self, index, value): self.sample4_bad.insert(index, value)
    def replace_sample4_bad_at(self, index, value): self.sample4_bad[index] = value
    def get_sample2(self): return self.sample2
    def set_sample2(self, sample2): self.sample2 = sample2
    def add_sample2(self, value): self.sample2.append(value)
    def insert_sample2_at(self, index, value): self.sample2.insert(index, value)
    def replace_sample2_at(self, index, value): self.sample2[index] = value
    def hasContent_(self):
        if (
            self.sample1 or
            self.sample2_bad or
            self.sample3_bad or
            self.sample4_bad or
            self.sample2
        ):
            return True
        else:
            return False
    def export(self, outfile, level, namespace_='', name_='containerType', namespacedef_='', pretty_print=True):
        imported_ns_def_ = GenerateDSNamespaceDefs_.get('containerType')
        if imported_ns_def_ is not None:
            namespacedef_ = imported_ns_def_
        if pretty_print:
            eol_ = '\n'
        else:
            eol_ = ''
        if self.original_tagname_ is not None:
            name_ = self.original_tagname_
        showIndent(outfile, level, pretty_print)
        outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', ))
        already_processed = set()
        self.exportAttributes(outfile, level, already_processed, namespace_, name_='containerType')
        if self.hasContent_():
            outfile.write('>%s' % (eol_, ))
            self.exportChildren(outfile, level + 1, namespace_='', name_='containerType', pretty_print=pretty_print)
            showIndent(outfile, level, pretty_print)
            outfile.write('</%s%s>%s' % (namespace_, name_, eol_))
        else:
            outfile.write('/>%s' % (eol_, ))
    def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='containerType'):
        pass
    def exportChildren(self, outfile, level, namespace_='', name_='containerType', fromsubclass_=False, pretty_print=True):
        if pretty_print:
            eol_ = '\n'
        else:
            eol_ = ''
        for sample1_ in self.sample1:
            sample1_.export(outfile, level, namespace_, name_='sample1', pretty_print=pretty_print)
        for sample2_bad_ in self.sample2_bad:
            sample2_bad_.export(outfile, level, namespace_, name_='sample2_bad', pretty_print=pretty_print)
        for sample3_bad_ in self.sample3_bad:
            sample3_bad_.export(outfile, level, namespace_, name_='sample3_bad', pretty_print=pretty_print)
        for sample4_bad_ in self.sample4_bad:
            sample4_bad_.export(outfile, level, namespace_, name_='sample4_bad', pretty_print=pretty_print)
        for sample2_ in self.sample2:
            sample2_.export(outfile, level, namespace_, name_='sample2', pretty_print=pretty_print)
    def build(self, node):
        already_processed = set()
        self.buildAttributes(node, node.attrib, already_processed)
        for child in node:
            nodeName_ = Tag_pattern_.match(child.tag).groups()[-1]
            self.buildChildren(child, node, nodeName_)
        return self
    def buildAttributes(self, node, attrs, already_processed):
        pass
    def buildChildren(self, child_, node, nodeName_, fromsubclass_=False):
        if nodeName_ == 'sample1':
            obj_ = simpleOneType.factory()
            obj_.build(child_)
            self.sample1.append(obj_)
            obj_.original_tagname_ = 'sample1'
        elif nodeName_ == 'sample2_bad':
            obj_ = simpleOneType.factory()
            obj_.build(child_)
            self.sample2_bad.append(obj_)
            obj_.original_tagname_ = 'sample2_bad'
        elif nodeName_ == 'sample3_bad':
            obj_ = simpleOneType.factory()
            obj_.build(child_)
            self.sample3_bad.append(obj_)
            obj_.original_tagname_ = 'sample3_bad'
        elif nodeName_ == 'sample4_bad':
            obj_ = simpleOneType.factory()
            obj_.build(child_)
            self.sample4_bad.append(obj_)
            obj_.original_tagname_ = 'sample4_bad'
        elif nodeName_ == 'sample2':
            obj_ = simpleTwoType.factory()
            obj_.build(child_)
            self.sample2.append(obj_)
            obj_.original_tagname_ = 'sample2'
# end class containerType


class simpleOneType(GeneratedsSuper):
    member_data_items_ = [
        MemberSpec_('integer_range_1_value', ['integer_range_1_st', 'integer_range_2_st', 'xs:integer'], 0, 0, {u'type': u'xs:integer', u'name': u'integer_range_1_value'}, None),
        MemberSpec_('pattern_value', ['pattern_st', 'pattern_1_st', 'min_length_st', 'xs:string'], 0, 0, {u'type': u'xs:string', u'name': u'pattern_value'}, None),
        MemberSpec_('token_enum_value', ['token_enum_st', 'xs:NMTOKEN'], 0, 0, {u'type': u'xs:NMTOKEN', u'name': u'token_enum_value'}, None),
        MemberSpec_('integer_range_incl_value', ['integer_range_incl_st', 'xs:integer'], 0, 0, {u'type': u'xs:integer', u'name': u'integer_range_incl_value'}, None),
        MemberSpec_('integer_range_excl_value', ['integer_range_excl_st', 'xs:integer'], 0, 0, {u'type': u'xs:integer', u'name': u'integer_range_excl_value'}, None),
        MemberSpec_('min_max_length_value', ['min_max_length_st', 'xs:string'], 0, 0, {u'type': u'xs:string', u'name': u'min_max_length_value'}, None),
        MemberSpec_('length_value', ['length_st', 'xs:string'], 0, 0, {u'type': u'xs:string', u'name': u'length_value'}, None),
        MemberSpec_('totalDigits_value', ['totalDigits_st', 'xs:decimal'], 0, 0, {u'type': u'xs:decimal', u'name': u'totalDigits_value'}, None),
        MemberSpec_('date_minincl_value', ['date_minincl_st', 'xs:date'], 0, 0, {u'type': u'xs:date', u'name': u'date_minincl_value'}, None),
        MemberSpec_('date_maxincl_value', ['date_maxincl_st', 'xs:date'], 0, 0, {u'type': u'xs:date', u'name': u'date_maxincl_value'}, None),
        MemberSpec_('date_minexcl_value', ['date_minexcl_st', 'xs:date'], 0, 0, {u'type': u'xs:date', u'name': u'date_minexcl_value'}, None),
        MemberSpec_('date_maxexcl_value', ['date_maxexcl_st', 'xs:date'], 0, 0, {u'type': u'xs:date', u'name': u'date_maxexcl_value'}, None),
        MemberSpec_('time_minincl_value', ['time_minincl_st', 'xs:time'], 0, 0, {u'type': u'xs:time', u'name': u'time_minincl_value'}, None),
        MemberSpec_('time_maxincl_value', ['time_maxincl_st', 'xs:time'], 0, 0, {u'type': u'xs:time', u'name': u'time_maxincl_value'}, None),
        MemberSpec_('time_minexcl_value', ['time_minexcl_st', 'xs:time'], 0, 0, {u'type': u'xs:time', u'name': u'time_minexcl_value'}, None),
        MemberSpec_('time_maxexcl_value', ['time_maxexcl_st', 'xs:time'], 0, 0, {u'type': u'xs:time', u'name': u'time_maxexcl_value'}, None),
        MemberSpec_('datetime_minincl_value', ['datetime_minincl_st', 'xs:dateTime'], 0, 0, {u'type': u'xs:dateTime', u'name': u'datetime_minincl_value'}, None),
        MemberSpec_('datetime_maxincl_value', ['datetime_maxincl_st', 'xs:dateTime'], 0, 0, {u'type': u'xs:dateTime', u'name': u'datetime_maxincl_value'}, None),
        MemberSpec_('datetime_minexcl_value', ['datetime_minexcl_st', 'xs:dateTime'], 0, 0, {u'type': u'xs:dateTime', u'name': u'datetime_minexcl_value'}, None),
        MemberSpec_('datetime_maxexcl_value', ['datetime_maxexcl_st', 'xs:dateTime'], 0, 0, {u'type': u'xs:dateTime', u'name': u'datetime_maxexcl_value'}, None),
        MemberSpec_('vbar_pattern_value', ['vbar_pattern_st', 'xs:string'], 0, 0, {u'type': u'xs:string', u'name': u'vbar_pattern_value'}, None),
        MemberSpec_('anonymous_float_value', ['anonymous_float_valueType', 'xs:float'], 0, 0, {u'type': u'xs:float', u'name': u'anonymous_float_value'}, None),
        MemberSpec_('primative_integer', 'xs:integer', 0, 0, {u'type': u'xs:integer', u'name': u'primative_integer'}, None),
        MemberSpec_('primative_float', 'xs:float', 0, 0, {u'type': u'xs:float', u'name': u'primative_float'}, None),
    ]
    subclass = None
    superclass = None
    def __init__(self, integer_range_1_value=None, pattern_value=None, token_enum_value=None, integer_range_incl_value=None, integer_range_excl_value=None, min_max_length_value=None, length_value=None, totalDigits_value=None, date_minincl_value=None, date_maxincl_value=None, date_minexcl_value=None, date_maxexcl_value=None, time_minincl_value=None, time_maxincl_value=None, time_minexcl_value=None, time_maxexcl_value=None, datetime_minincl_value=None, datetime_maxincl_value=None, datetime_minexcl_value=None, datetime_maxexcl_value=None, vbar_pattern_value=None, anonymous_float_value=None, primative_integer=None, primative_float=None):
        self.original_tagname_ = None
        self.integer_range_1_value = integer_range_1_value
        self.validate_integer_range_1_st(self.integer_range_1_value)
        self.pattern_value = pattern_value
        self.validate_pattern_st(self.pattern_value)
        self.token_enum_value = token_enum_value
        self.validate_token_enum_st(self.token_enum_value)
        self.integer_range_incl_value = integer_range_incl_value
        self.validate_integer_range_incl_st(self.integer_range_incl_value)
        self.integer_range_excl_value = integer_range_excl_value
        self.validate_integer_range_excl_st(self.integer_range_excl_value)
        self.min_max_length_value = min_max_length_value
        self.validate_min_max_length_st(self.min_max_length_value)
        self.length_value = length_value
        self.validate_length_st(self.length_value)
        self.totalDigits_value = totalDigits_value
        self.validate_totalDigits_st(self.totalDigits_value)
        if isinstance(date_minincl_value, BaseStrType_):
            initvalue_ = datetime_.datetime.strptime(date_minincl_value, '%Y-%m-%d').date()
        else:
            initvalue_ = date_minincl_value
        self.date_minincl_value = initvalue_
        if isinstance(date_maxincl_value, BaseStrType_):
            initvalue_ = datetime_.datetime.strptime(date_maxincl_value, '%Y-%m-%d').date()
        else:
            initvalue_ = date_maxincl_value
        self.date_maxincl_value = initvalue_
        if isinstance(date_minexcl_value, BaseStrType_):
            initvalue_ = datetime_.datetime.strptime(date_minexcl_value, '%Y-%m-%d').date()
        else:
            initvalue_ = date_minexcl_value
        self.date_minexcl_value = initvalue_
        if isinstance(date_maxexcl_value, BaseStrType_):
            initvalue_ = datetime_.datetime.strptime(date_maxexcl_value, '%Y-%m-%d').date()
        else:
            initvalue_ = date_maxexcl_value
        self.date_maxexcl_value = initvalue_
        if isinstance(time_minincl_value, BaseStrType_):
            initvalue_ = datetime_.datetime.strptime(time_minincl_value, '%H:%M:%S').time()
        else:
            initvalue_ = time_minincl_value
        self.time_minincl_value = initvalue_
        if isinstance(time_maxincl_value, BaseStrType_):
            initvalue_ = datetime_.datetime.strptime(time_maxincl_value, '%H:%M:%S').time()
        else:
            initvalue_ = time_maxincl_value
        self.time_maxincl_value = initvalue_
        if isinstance(time_minexcl_value, BaseStrType_):
            initvalue_ = datetime_.datetime.strptime(time_minexcl_value, '%H:%M:%S').time()
        else:
            initvalue_ = time_minexcl_value
        self.time_minexcl_value = initvalue_
        if isinstance(time_maxexcl_value, BaseStrType_):
            initvalue_ = datetime_.datetime.strptime(time_maxexcl_value, '%H:%M:%S').time()
        else:
            initvalue_ = time_maxexcl_value
        self.time_maxexcl_value = initvalue_
        if isinstance(datetime_minincl_value, BaseStrType_):
            initvalue_ = datetime_.datetime.strptime(datetime_minincl_value, '%Y-%m-%dT%H:%M:%S')
        else:
            initvalue_ = datetime_minincl_value
        self.datetime_minincl_value = initvalue_
        if isinstance(datetime_maxincl_value, BaseStrType_):
            initvalue_ = datetime_.datetime.strptime(datetime_maxincl_value, '%Y-%m-%dT%H:%M:%S')
        else:
            initvalue_ = datetime_maxincl_value
        self.datetime_maxincl_value = initvalue_
        if isinstance(datetime_minexcl_value, BaseStrType_):
            initvalue_ = datetime_.datetime.strptime(datetime_minexcl_value, '%Y-%m-%dT%H:%M:%S')
        else:
            initvalue_ = datetime_minexcl_value
        self.datetime_minexcl_value = initvalue_
        if isinstance(datetime_maxexcl_value, BaseStrType_):
            initvalue_ = datetime_.datetime.strptime(datetime_maxexcl_value, '%Y-%m-%dT%H:%M:%S')
        else:
            initvalue_ = datetime_maxexcl_value
        self.datetime_maxexcl_value = initvalue_
        self.vbar_pattern_value = vbar_pattern_value
        self.validate_vbar_pattern_st(self.vbar_pattern_value)
        self.anonymous_float_value = anonymous_float_value
        self.validate_anonymous_float_valueType(self.anonymous_float_value)
        self.primative_integer = primative_integer
        self.primative_float = primative_float
    def factory(*args_, **kwargs_):
        if CurrentSubclassModule_ is not None:
            subclass = getSubclassFromModule_(
                CurrentSubclassModule_, simpleOneType)
            if subclass is not None:
                return subclass(*args_, **kwargs_)
        if simpleOneType.subclass:
            return simpleOneType.subclass(*args_, **kwargs_)
        else:
            return simpleOneType(*args_, **kwargs_)
    factory = staticmethod(factory)
    def get_integer_range_1_value(self): return self.integer_range_1_value
    def set_integer_range_1_value(self, integer_range_1_value): self.integer_range_1_value = integer_range_1_value
    def get_pattern_value(self): return self.pattern_value
    def set_pattern_value(self, pattern_value): self.pattern_value = pattern_value
    def get_token_enum_value(self): return self.token_enum_value
    def set_token_enum_value(self, token_enum_value): self.token_enum_value = token_enum_value
    def get_integer_range_incl_value(self): return self.integer_range_incl_value
    def set_integer_range_incl_value(self, integer_range_incl_value): self.integer_range_incl_value = integer_range_incl_value
    def get_integer_range_excl_value(self): return self.integer_range_excl_value
    def set_integer_range_excl_value(self, integer_range_excl_value): self.integer_range_excl_value = integer_range_excl_value
    def get_min_max_length_value(self): return self.min_max_length_value
    def set_min_max_length_value(self, min_max_length_value): self.min_max_length_value = min_max_length_value
    def get_length_value(self): return self.length_value
    def set_length_value(self, length_value): self.length_value = length_value
    def get_totalDigits_value(self): return self.totalDigits_value
    def set_totalDigits_value(self, totalDigits_value): self.totalDigits_value = totalDigits_value
    def get_date_minincl_value(self): return self.date_minincl_value
    def set_date_minincl_value(self, date_minincl_value): self.date_minincl_value = date_minincl_value
    def get_date_maxincl_value(self): return self.date_maxincl_value
    def set_date_maxincl_value(self, date_maxincl_value): self.date_maxincl_value = date_maxincl_value
    def get_date_minexcl_value(self): return self.date_minexcl_value
    def set_date_minexcl_value(self, date_minexcl_value): self.date_minexcl_value = date_minexcl_value
    def get_date_maxexcl_value(self): return self.date_maxexcl_value
    def set_date_maxexcl_value(self, date_maxexcl_value): self.date_maxexcl_value = date_maxexcl_value
    def get_time_minincl_value(self): return self.time_minincl_value
    def set_time_minincl_value(self, time_minincl_value): self.time_minincl_value = time_minincl_value
    def get_time_maxincl_value(self): return self.time_maxincl_value
    def set_time_maxincl_value(self, time_maxincl_value): self.time_maxincl_value = time_maxincl_value
    def get_time_minexcl_value(self): return self.time_minexcl_value
    def set_time_minexcl_value(self, time_minexcl_value): self.time_minexcl_value = time_minexcl_value
    def get_time_maxexcl_value(self): return self.time_maxexcl_value
    def set_time_maxexcl_value(self, time_maxexcl_value): self.time_maxexcl_value = time_maxexcl_value
    def get_datetime_minincl_value(self): return self.datetime_minincl_value
    def set_datetime_minincl_value(self, datetime_minincl_value): self.datetime_minincl_value = datetime_minincl_value
    def get_datetime_maxincl_value(self): return self.datetime_maxincl_value
    def set_datetime_maxincl_value(self, datetime_maxincl_value): self.datetime_maxincl_value = datetime_maxincl_value
    def get_datetime_minexcl_value(self): return self.datetime_minexcl_value
    def set_datetime_minexcl_value(self, datetime_minexcl_value): self.datetime_minexcl_value = datetime_minexcl_value
    def get_datetime_maxexcl_value(self): return self.datetime_maxexcl_value
    def set_datetime_maxexcl_value(self, datetime_maxexcl_value): self.datetime_maxexcl_value = datetime_maxexcl_value
    def get_vbar_pattern_value(self): return self.vbar_pattern_value
    def set_vbar_pattern_value(self, vbar_pattern_value): self.vbar_pattern_value = vbar_pattern_value
    def get_anonymous_float_value(self): return self.anonymous_float_value
    def set_anonymous_float_value(self, anonymous_float_value): self.anonymous_float_value = anonymous_float_value
    def get_primative_integer(self): return self.primative_integer
    def set_primative_integer(self, primative_integer): self.primative_integer = primative_integer
    def get_primative_float(self): return self.primative_float
    def set_primative_float(self, primative_float): self.primative_float = primative_float
    def validate_integer_range_1_st(self, value):
        # Validate type integer_range_1_st, a restriction on integer_range_2_st.
        if value is not None and Validate_simpletypes_:
            if value <= 4:
                warnings_.warn('Value "%(value)s" does not match xsd minExclusive restriction on integer_range_1_st' % {"value" : value} )
            if value >= 8:
                warnings_.warn('Value "%(value)s" does not match xsd maxExclusive restriction on integer_range_1_st' % {"value" : value} )
    def validate_pattern_st(self, value):
        # Validate type pattern_st, a restriction on pattern_1_st.
        if value is not None and Validate_simpletypes_:
            if len(str(value)) < 10:
                warnings_.warn('Value "%(value)s" does not match xsd minLength restriction on pattern_st' % {"value" : value} )
            if not self.gds_validate_simple_patterns(
                    self.validate_pattern_st_patterns_, value):
                warnings_.warn('Value "%s" does not match xsd pattern restrictions: %s' % (value.encode('utf-8'), self.validate_pattern_st_patterns_, ))
    validate_pattern_st_patterns_ = [['^aaa.*zzz$', '^bbb.*xxx$'], ['^.*123.*$', '^.*456.*$']]
    def validate_token_enum_st(self, value):
        # Validate type token_enum_st, a restriction on xs:NMTOKEN.
        if value is not None and Validate_simpletypes_:
            value = str(value)
            enumerations = ['float', 'int', 'Name', 'token']
            enumeration_respectee = False
            for enum in enumerations:
                if value == enum:
                    enumeration_respectee = True
                    break
            if not enumeration_respectee:
                warnings_.warn('Value "%(value)s" does not match xsd enumeration restriction on token_enum_st' % {"value" : value.encode("utf-8")} )
    def validate_integer_range_incl_st(self, value):
        # Validate type integer_range_incl_st, a restriction on xs:integer.
        if value is not None and Validate_simpletypes_:
            if value < -5:
                warnings_.warn('Value "%(value)s" does not match xsd minInclusive restriction on integer_range_incl_st' % {"value" : value} )
            if value > 10:
                warnings_.warn('Value "%(value)s" does not match xsd maxInclusive restriction on integer_range_incl_st' % {"value" : value} )
    def validate_integer_range_excl_st(self, value):
        # Validate type integer_range_excl_st, a restriction on xs:integer.
        if value is not None and Validate_simpletypes_:
            if value <= -5:
                warnings_.warn('Value "%(value)s" does not match xsd minExclusive restriction on integer_range_excl_st' % {"value" : value} )
            if value >= 10:
                warnings_.warn('Value "%(value)s" does not match xsd maxExclusive restriction on integer_range_excl_st' % {"value" : value} )
    def validate_min_max_length_st(self, value):
        # Validate type min_max_length_st, a restriction on xs:string.
        if value is not None and Validate_simpletypes_:
            if len(value) > 20:
                warnings_.warn('Value "%(value)s" does not match xsd maxLength restriction on min_max_length_st' % {"value" : value.encode("utf-8")} )
            if len(value) < 10:
                warnings_.warn('Value "%(value)s" does not match xsd minLength restriction on min_max_length_st' % {"value" : value.encode("utf-8")} )
    def validate_length_st(self, value):
        # Validate type length_st, a restriction on xs:string.
        if value is not None and Validate_simpletypes_:
            if len(value) != 10:
                warnings_.warn('Value "%(value)s" does not match xsd length restriction on length_st' % {"value" : value.encode("utf-8")} )
    def validate_totalDigits_st(self, value):
        # Validate type totalDigits_st, a restriction on xs:decimal.
        if value is not None and Validate_simpletypes_:
            if len(str(value)) >= 15:
                warnings_.warn('Value "%(value)s" does not match xsd maxInclusive restriction on totalDigits_st' % {"value" : value} )
    def validate_date_minincl_st(self, value):
        # Validate type date_minincl_st, a restriction on xs:date.
        if value is not None and Validate_simpletypes_:
            if value < self.gds_parse_date('2015-06-01'):
                warnings_.warn('Value "%(value)s" does not match xsd minInclusive restriction on date_minincl_st' % {"value" : value} )
    def validate_date_maxincl_st(self, value):
        # Validate type date_maxincl_st, a restriction on xs:date.
        if value is not None and Validate_simpletypes_:
            if value > self.gds_parse_date('2015-10-31'):
                warnings_.warn('Value "%(value)s" does not match xsd maxInclusive restriction on date_maxincl_st' % {"value" : value} )
    def validate_date_minexcl_st(self, value):
        # Validate type date_minexcl_st, a restriction on xs:date.
        if value is not None and Validate_simpletypes_:
            if value <= self.gds_parse_date('2015-06-01'):
                warnings_.warn('Value "%(value)s" does not match xsd minExclusive restriction on date_minexcl_st' % {"value" : value} )
    def validate_date_maxexcl_st(self, value):
        # Validate type date_maxexcl_st, a restriction on xs:date.
        if value is not None and Validate_simpletypes_:
            if value >= self.gds_parse_date('2015-10-31'):
                warnings_.warn('Value "%(value)s" does not match xsd maxExclusive restriction on date_maxexcl_st' % {"value" : value} )
    def validate_time_minincl_st(self, value):
        # Validate type time_minincl_st, a restriction on xs:time.
        if value is not None and Validate_simpletypes_:
            if value < self.gds_parse_time('14:20:10'):
                warnings_.warn('Value "%(value)s" does not match xsd minInclusive restriction on time_minincl_st' % {"value" : value} )
    def validate_time_maxincl_st(self, value):
        # Validate type time_maxincl_st, a restriction on xs:time.
        if value is not None and Validate_simpletypes_:
            if value > self.gds_parse_time('16:20:10'):
                warnings_.warn('Value "%(value)s" does not match xsd maxInclusive restriction on time_maxincl_st' % {"value" : value} )
    def validate_time_minexcl_st(self, value):
        # Validate type time_minexcl_st, a restriction on xs:time.
        if value is not None and Validate_simpletypes_:
            if value <= self.gds_parse_time('14:20:10'):
                warnings_.warn('Value "%(value)s" does not match xsd minExclusive restriction on time_minexcl_st' % {"value" : value} )
    def validate_time_maxexcl_st(self, value):
        # Validate type time_maxexcl_st, a restriction on xs:time.
        if value is not None and Validate_simpletypes_:
            if value >= self.gds_parse_time('16:20:10'):
                warnings_.warn('Value "%(value)s" does not match xsd maxExclusive restriction on time_maxexcl_st' % {"value" : value} )
    def validate_datetime_minincl_st(self, value):
        # Validate type datetime_minincl_st, a restriction on xs:dateTime.
        if value is not None and Validate_simpletypes_:
            if value < self.gds_parse_datetime('2015-06-01T14:20:10'):
                warnings_.warn('Value "%(value)s" does not match xsd minInclusive restriction on datetime_minincl_st' % {"value" : value} )
    def validate_datetime_maxincl_st(self, value):
        # Validate type datetime_maxincl_st, a restriction on xs:dateTime.
        if value is not None and Validate_simpletypes_:
            if value > self.gds_parse_datetime('2015-10-31T16:20:10'):
                warnings_.warn('Value "%(value)s" does not match xsd maxInclusive restriction on datetime_maxincl_st' % {"value" : value} )
    def validate_datetime_minexcl_st(self, value):
        # Validate type datetime_minexcl_st, a restriction on xs:dateTime.
        if value is not None and Validate_simpletypes_:
            if value <= self.gds_parse_datetime('2015-06-01T14:20:10'):
                warnings_.warn('Value "%(value)s" does not match xsd minExclusive restriction on datetime_minexcl_st' % {"value" : value} )
    def validate_datetime_maxexcl_st(self, value):
        # Validate type datetime_maxexcl_st, a restriction on xs:dateTime.
        if value is not None and Validate_simpletypes_:
            if value >= self.gds_parse_datetime('2015-10-31T16:20:10'):
                warnings_.warn('Value "%(value)s" does not match xsd maxExclusive restriction on datetime_maxexcl_st' % {"value" : value} )
    def validate_vbar_pattern_st(self, value):
        # Validate type vbar_pattern_st, a restriction on xs:string.
        if value is not None and Validate_simpletypes_:
            if not self.gds_validate_simple_patterns(
                    self.validate_vbar_pattern_st_patterns_, value):
                warnings_.warn('Value "%s" does not match xsd pattern restrictions: %s' % (value.encode('utf-8'), self.validate_vbar_pattern_st_patterns_, ))
    validate_vbar_pattern_st_patterns_ = [['^abcd$|^ef\\|gh$']]
    def validate_anonymous_float_valueType(self, value):
        # Validate type anonymous_float_valueType, a restriction on xs:float.
        if value is not None and Validate_simpletypes_:
            if value < 1.1:
                warnings_.warn('Value "%(value)s" does not match xsd minInclusive restriction on anonymous_float_valueType' % {"value" : value} )
            if value > 4.4:
                warnings_.warn('Value "%(value)s" does not match xsd maxInclusive restriction on anonymous_float_valueType' % {"value" : value} )
    def hasContent_(self):
        if (
            self.integer_range_1_value is not None or
            self.pattern_value is not None or
            self.token_enum_value is not None or
            self.integer_range_incl_value is not None or
            self.integer_range_excl_value is not None or
            self.min_max_length_value is not None or
            self.length_value is not None or
            self.totalDigits_value is not None or
            self.date_minincl_value is not None or
            self.date_maxincl_value is not None or
            self.date_minexcl_value is not None or
            self.date_maxexcl_value is not None or
            self.time_minincl_value is not None or
            self.time_maxincl_value is not None or
            self.time_minexcl_value is not None or
            self.time_maxexcl_value is not None or
            self.datetime_minincl_value is not None or
            self.datetime_maxincl_value is not None or
            self.datetime_minexcl_value is not None or
            self.datetime_maxexcl_value is not None or
            self.vbar_pattern_value is not None or
            self.anonymous_float_value is not None or
            self.primative_integer is not None or
            self.primative_float is not None
        ):
            return True
        else:
            return False
    def export(self, outfile, level, namespace_='', name_='simpleOneType', namespacedef_='', pretty_print=True):
        imported_ns_def_ = GenerateDSNamespaceDefs_.get('simpleOneType')
        if imported_ns_def_ is not None:
            namespacedef_ = imported_ns_def_
        if pretty_print:
            eol_ = '\n'
        else:
            eol_ = ''
        if self.original_tagname_ is not None:
            name_ = self.original_tagname_
        showIndent(outfile, level, pretty_print)
        outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', ))
        already_processed = set()
        self.exportAttributes(outfile, level, already_processed, namespace_, name_='simpleOneType')
        if self.hasContent_():
            outfile.write('>%s' % (eol_, ))
            self.exportChildren(outfile, level + 1, namespace_='', name_='simpleOneType', pretty_print=pretty_print)
            showIndent(outfile, level, pretty_print)
            outfile.write('</%s%s>%s' % (namespace_, name_, eol_))
        else:
            outfile.write('/>%s' % (eol_, ))
    def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='simpleOneType'):
        pass
    def exportChildren(self, outfile, level, namespace_='', name_='simpleOneType', fromsubclass_=False, pretty_print=True):
        if pretty_print:
            eol_ = '\n'
        else:
            eol_ = ''
        if self.integer_range_1_value is not None:
            showIndent(outfile, level, pretty_print)
            outfile.write('<%sinteger_range_1_value>%s</%sinteger_range_1_value>%s' % (namespace_, self.gds_format_integer(self.integer_range_1_value, input_name='integer_range_1_value'), namespace_, eol_))
        if self.pattern_value is not None:
            showIndent(outfile, level, pretty_print)
            outfile.write('<%spattern_value>%s</%spattern_value>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.pattern_value), input_name='pattern_value')), namespace_, eol_))
        if self.token_enum_value is not None:
            showIndent(outfile, level, pretty_print)
            outfile.write('<%stoken_enum_value>%s</%stoken_enum_value>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.token_enum_value), input_name='token_enum_value')), namespace_, eol_))
        if self.integer_range_incl_value is not None:
            showIndent(outfile, level, pretty_print)
            outfile.write('<%sinteger_range_incl_value>%s</%sinteger_range_incl_value>%s' % (namespace_, self.gds_format_integer(self.integer_range_incl_value, input_name='integer_range_incl_value'), namespace_, eol_))
        if self.integer_range_excl_value is not None:
            showIndent(outfile, level, pretty_print)
            outfile.write('<%sinteger_range_excl_value>%s</%sinteger_range_excl_value>%s' % (namespace_, self.gds_format_integer(self.integer_range_excl_value, input_name='integer_range_excl_value'), namespace_, eol_))
        if self.min_max_length_value is not None:
            showIndent(outfile, level, pretty_print)
            outfile.write('<%smin_max_length_value>%s</%smin_max_length_value>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.min_max_length_value), input_name='min_max_length_value')), namespace_, eol_))
        if self.length_value is not None:
            showIndent(outfile, level, pretty_print)
            outfile.write('<%slength_value>%s</%slength_value>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.length_value), input_name='length_value')), namespace_, eol_))
        if self.totalDigits_value is not None:
            showIndent(outfile, level, pretty_print)
            outfile.write('<%stotalDigits_value>%s</%stotalDigits_value>%s' % (namespace_, self.gds_format_float(self.totalDigits_value, input_name='totalDigits_value'), namespace_, eol_))
        if self.date_minincl_value is not None:
            showIndent(outfile, level, pretty_print)
            outfile.write('<%sdate_minincl_value>%s</%sdate_minincl_value>%s' % (namespace_, self.gds_format_date(self.date_minincl_value, input_name='date_minincl_value'), namespace_, eol_))
        if self.date_maxincl_value is not None:
            showIndent(outfile, level, pretty_print)
            outfile.write('<%sdate_maxincl_value>%s</%sdate_maxincl_value>%s' % (namespace_, self.gds_format_date(self.date_maxincl_value, input_name='date_maxincl_value'), namespace_, eol_))
        if self.date_minexcl_value is not None:
            showIndent(outfile, level, pretty_print)
            outfile.write('<%sdate_minexcl_value>%s</%sdate_minexcl_value>%s' % (namespace_, self.gds_format_date(self.date_minexcl_value, input_name='date_minexcl_value'), namespace_, eol_))
        if self.date_maxexcl_value is not None:
            showIndent(outfile, level, pretty_print)
            outfile.write('<%sdate_maxexcl_value>%s</%sdate_maxexcl_value>%s' % (namespace_, self.gds_format_date(self.date_maxexcl_value, input_name='date_maxexcl_value'), namespace_, eol_))
        if self.time_minincl_value is not None:
            showIndent(outfile, level, pretty_print)
            outfile.write('<%stime_minincl_value>%s</%stime_minincl_value>%s' % (namespace_, self.gds_format_time(self.time_minincl_value, input_name='time_minincl_value'), namespace_, eol_))
        if self.time_maxincl_value is not None:
            showIndent(outfile, level, pretty_print)
            outfile.write('<%stime_maxincl_value>%s</%stime_maxincl_value>%s' % (namespace_, self.gds_format_time(self.time_maxincl_value, input_name='time_maxincl_value'), namespace_, eol_))
        if self.time_minexcl_value is not None:
            showIndent(outfile, level, pretty_print)
            outfile.write('<%stime_minexcl_value>%s</%stime_minexcl_value>%s' % (namespace_, self.gds_format_time(self.time_minexcl_value, input_name='time_minexcl_value'), namespace_, eol_))
        if self.time_maxexcl_value is not None:
            showIndent(outfile, level, pretty_print)
            outfile.write('<%stime_maxexcl_value>%s</%stime_maxexcl_value>%s' % (namespace_, self.gds_format_time(self.time_maxexcl_value, input_name='time_maxexcl_value'), namespace_, eol_))
        if self.datetime_minincl_value is not None:
            showIndent(outfile, level, pretty_print)
            outfile.write('<%sdatetime_minincl_value>%s</%sdatetime_minincl_value>%s' % (namespace_, self.gds_format_datetime(self.datetime_minincl_value, input_name='datetime_minincl_value'), namespace_, eol_))
        if self.datetime_maxincl_value is not None:
            showIndent(outfile, level, pretty_print)
            outfile.write('<%sdatetime_maxincl_value>%s</%sdatetime_maxincl_value>%s' % (namespace_, self.gds_format_datetime(self.datetime_maxincl_value, input_name='datetime_maxincl_value'), namespace_, eol_))
        if self.datetime_minexcl_value is not None:
            showIndent(outfile, level, pretty_print)
            outfile.write('<%sdatetime_minexcl_value>%s</%sdatetime_minexcl_value>%s' % (namespace_, self.gds_format_datetime(self.datetime_minexcl_value, input_name='datetime_minexcl_value'), namespace_, eol_))
        if self.datetime_maxexcl_value is not None:
            showIndent(outfile, level, pretty_print)
            outfile.write('<%sdatetime_maxexcl_value>%s</%sdatetime_maxexcl_value>%s' % (namespace_, self.gds_format_datetime(self.datetime_maxexcl_value, input_name='datetime_maxexcl_value'), namespace_, eol_))
        if self.vbar_pattern_value is not None:
            showIndent(outfile, level, pretty_print)
            outfile.write('<%svbar_pattern_value>%s</%svbar_pattern_value>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.vbar_pattern_value), input_name='vbar_pattern_value')), namespace_, eol_))
        if self.anonymous_float_value is not None:
            showIndent(outfile, level, pretty_print)
            outfile.write('<%sanonymous_float_value>%s</%sanonymous_float_value>%s' % (namespace_, self.gds_format_float(self.anonymous_float_value, input_name='anonymous_float_value'), namespace_, eol_))
        if self.primative_integer is not None:
            showIndent(outfile, level, pretty_print)
            outfile.write('<%sprimative_integer>%s</%sprimative_integer>%s' % (namespace_, self.gds_format_integer(self.primative_integer, input_name='primative_integer'), namespace_, eol_))
        if self.primative_float is not None:
            showIndent(outfile, level, pretty_print)
            outfile.write('<%sprimative_float>%s</%sprimative_float>%s' % (namespace_, self.gds_format_float(self.primative_float, input_name='primative_float'), namespace_, eol_))
    def build(self, node):
        already_processed = set()
        self.buildAttributes(node, node.attrib, already_processed)
        for child in node:
            nodeName_ = Tag_pattern_.match(child.tag).groups()[-1]
            self.buildChildren(child, node, nodeName_)
        return self
    def buildAttributes(self, node, attrs, already_processed):
        pass
    def buildChildren(self, child_, node, nodeName_, fromsubclass_=False):
        if nodeName_ == 'integer_range_1_value':
            sval_ = child_.text
            try:
                ival_ = int(sval_)
            except (TypeError, ValueError) as exp:
                raise_parse_error(child_, 'requires integer: %s' % exp)
            ival_ = self.gds_validate_integer(ival_, node, 'integer_range_1_value')
            self.integer_range_1_value = ival_
            # validate type integer_range_1_st
            self.validate_integer_range_1_st(self.integer_range_1_value)
        elif nodeName_ == 'pattern_value':
            pattern_value_ = child_.text
            pattern_value_ = self.gds_validate_string(pattern_value_, node, 'pattern_value')
            self.pattern_value = pattern_value_
            # validate type pattern_st
            self.validate_pattern_st(self.pattern_value)
        elif nodeName_ == 'token_enum_value':
            token_enum_value_ = child_.text
            token_enum_value_ = self.gds_validate_string(token_enum_value_, node, 'token_enum_value')
            self.token_enum_value = token_enum_value_
            # validate type token_enum_st
            self.validate_token_enum_st(self.token_enum_value)
        elif nodeName_ == 'integer_range_incl_value':
            sval_ = child_.text
            try:
                ival_ = int(sval_)
            except (TypeError, ValueError) as exp:
                raise_parse_error(child_, 'requires integer: %s' % exp)
            ival_ = self.gds_validate_integer(ival_, node, 'integer_range_incl_value')
            self.integer_range_incl_value = ival_
            # validate type integer_range_incl_st
            self.validate_integer_range_incl_st(self.integer_range_incl_value)
        elif nodeName_ == 'integer_range_excl_value':
            sval_ = child_.text
            try:
                ival_ = int(sval_)
            except (TypeError, ValueError) as exp:
                raise_parse_error(child_, 'requires integer: %s' % exp)
            ival_ = self.gds_validate_integer(ival_, node, 'integer_range_excl_value')
            self.integer_range_excl_value = ival_
            # validate type integer_range_excl_st
            self.validate_integer_range_excl_st(self.integer_range_excl_value)
        elif nodeName_ == 'min_max_length_value':
            min_max_length_value_ = child_.text
            min_max_length_value_ = self.gds_validate_string(min_max_length_value_, node, 'min_max_length_value')
            self.min_max_length_value = min_max_length_value_
            # validate type min_max_length_st
            self.validate_min_max_length_st(self.min_max_length_value)
        elif nodeName_ == 'length_value':
            length_value_ = child_.text
            length_value_ = self.gds_validate_string(length_value_, node, 'length_value')
            self.length_value = length_value_
            # validate type length_st
            self.validate_length_st(self.length_value)
        elif nodeName_ == 'totalDigits_value':
            sval_ = child_.text
            try:
                fval_ = float(sval_)
            except (TypeError, ValueError) as exp:
                raise_parse_error(child_, 'requires float or double: %s' % exp)
            fval_ = self.gds_validate_float(fval_, node, 'totalDigits_value')
            self.totalDigits_value = fval_
            # validate type totalDigits_st
            self.validate_totalDigits_st(self.totalDigits_value)
        elif nodeName_ == 'date_minincl_value':
            sval_ = child_.text
            dval_ = self.gds_parse_date(sval_)
            self.date_minincl_value = dval_
            # validate type date_minincl_st
            self.validate_date_minincl_st(self.date_minincl_value)
        elif nodeName_ == 'date_maxincl_value':
            sval_ = child_.text
            dval_ = self.gds_parse_date(sval_)
            self.date_maxincl_value = dval_
            # validate type date_maxincl_st
            self.validate_date_maxincl_st(self.date_maxincl_value)
        elif nodeName_ == 'date_minexcl_value':
            sval_ = child_.text
            dval_ = self.gds_parse_date(sval_)
            self.date_minexcl_value = dval_
            # validate type date_minexcl_st
            self.validate_date_minexcl_st(self.date_minexcl_value)
        elif nodeName_ == 'date_maxexcl_value':
            sval_ = child_.text
            dval_ = self.gds_parse_date(sval_)
            self.date_maxexcl_value = dval_
            # validate type date_maxexcl_st
            self.validate_date_maxexcl_st(self.date_maxexcl_value)
        elif nodeName_ == 'time_minincl_value':
            sval_ = child_.text
            dval_ = self.gds_parse_time(sval_)
            self.time_minincl_value = dval_
            # validate type time_minincl_st
            self.validate_time_minincl_st(self.time_minincl_value)
        elif nodeName_ == 'time_maxincl_value':
            sval_ = child_.text
            dval_ = self.gds_parse_time(sval_)
            self.time_maxincl_value = dval_
            # validate type time_maxincl_st
            self.validate_time_maxincl_st(self.time_maxincl_value)
        elif nodeName_ == 'time_minexcl_value':
            sval_ = child_.text
            dval_ = self.gds_parse_time(sval_)
            self.time_minexcl_value = dval_
            # validate type time_minexcl_st
            self.validate_time_minexcl_st(self.time_minexcl_value)
        elif nodeName_ == 'time_maxexcl_value':
            sval_ = child_.text
            dval_ = self.gds_parse_time(sval_)
            self.time_maxexcl_value = dval_
            # validate type time_maxexcl_st
            self.validate_time_maxexcl_st(self.time_maxexcl_value)
        elif nodeName_ == 'datetime_minincl_value':
            sval_ = child_.text
            dval_ = self.gds_parse_datetime(sval_)
            self.datetime_minincl_value = dval_
            # validate type datetime_minincl_st
            self.validate_datetime_minincl_st(self.datetime_minincl_value)
        elif nodeName_ == 'datetime_maxincl_value':
            sval_ = child_.text
            dval_ = self.gds_parse_datetime(sval_)
            self.datetime_maxincl_value = dval_
            # validate type datetime_maxincl_st
            self.validate_datetime_maxincl_st(self.datetime_maxincl_value)
        elif nodeName_ == 'datetime_minexcl_value':
            sval_ = child_.text
            dval_ = self.gds_parse_datetime(sval_)
            self.datetime_minexcl_value = dval_
            # validate type datetime_minexcl_st
            self.validate_datetime_minexcl_st(self.datetime_minexcl_value)
        elif nodeName_ == 'datetime_maxexcl_value':
            sval_ = child_.text
            dval_ = self.gds_parse_datetime(sval_)
            self.datetime_maxexcl_value = dval_
            # validate type datetime_maxexcl_st
            self.validate_datetime_maxexcl_st(self.datetime_maxexcl_value)
        elif nodeName_ == 'vbar_pattern_value':
            vbar_pattern_value_ = child_.text
            vbar_pattern_value_ = self.gds_validate_string(vbar_pattern_value_, node, 'vbar_pattern_value')
            self.vbar_pattern_value = vbar_pattern_value_
            # validate type vbar_pattern_st
            self.validate_vbar_pattern_st(self.vbar_pattern_value)
        elif nodeName_ == 'anonymous_float_value':
            sval_ = child_.text
            try:
                fval_ = float(sval_)
            except (TypeError, ValueError) as exp:
                raise_parse_error(child_, 'requires float or double: %s' % exp)
            fval_ = self.gds_validate_float(fval_, node, 'anonymous_float_value')
            self.anonymous_float_value = fval_
            # validate type anonymous_float_valueType
            self.validate_anonymous_float_valueType(self.anonymous_float_value)
        elif nodeName_ == 'primative_integer':
            sval_ = child_.text
            try:
                ival_ = int(sval_)
            except (TypeError, ValueError) as exp:
                raise_parse_error(child_, 'requires integer: %s' % exp)
            ival_ = self.gds_validate_integer(ival_, node, 'primative_integer')
            self.primative_integer = ival_
        elif nodeName_ == 'primative_float':
            sval_ = child_.text
            try:
                fval_ = float(sval_)
            except (TypeError, ValueError) as exp:
                raise_parse_error(child_, 'requires float or double: %s' % exp)
            fval_ = self.gds_validate_float(fval_, node, 'primative_float')
            self.primative_float = fval_
# end class simpleOneType


class simpleTwoType(GeneratedsSuper):
    member_data_items_ = [
        MemberSpec_('simpleTwoElementOne', 'simpleTwoElementOneType', 0, 0, {u'type': u'simpleTwoElementOneType', u'name': u'simpleTwoElementOne'}, None),
    ]
    subclass = None
    superclass = None
    def __init__(self, simpleTwoElementOne=None):
        self.original_tagname_ = None
        self.simpleTwoElementOne = simpleTwoElementOne
    def factory(*args_, **kwargs_):
        if CurrentSubclassModule_ is not None:
            subclass = getSubclassFromModule_(
                CurrentSubclassModule_, simpleTwoType)
            if subclass is not None:
                return subclass(*args_, **kwargs_)
        if simpleTwoType.subclass:
            return simpleTwoType.subclass(*args_, **kwargs_)
        else:
            return simpleTwoType(*args_, **kwargs_)
    factory = staticmethod(factory)
    def get_simpleTwoElementOne(self): return self.simpleTwoElementOne
    def set_simpleTwoElementOne(self, simpleTwoElementOne): self.simpleTwoElementOne = simpleTwoElementOne
    def hasContent_(self):
        if (
            self.simpleTwoElementOne is not None
        ):
            return True
        else:
            return False
    def export(self, outfile, level, namespace_='', name_='simpleTwoType', namespacedef_='', pretty_print=True):
        imported_ns_def_ = GenerateDSNamespaceDefs_.get('simpleTwoType')
        if imported_ns_def_ is not None:
            namespacedef_ = imported_ns_def_
        if pretty_print:
            eol_ = '\n'
        else:
            eol_ = ''
        if self.original_tagname_ is not None:
            name_ = self.original_tagname_
        showIndent(outfile, level, pretty_print)
        outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', ))
        already_processed = set()
        self.exportAttributes(outfile, level, already_processed, namespace_, name_='simpleTwoType')
        if self.hasContent_():
            outfile.write('>%s' % (eol_, ))
            self.exportChildren(outfile, level + 1, namespace_='', name_='simpleTwoType', pretty_print=pretty_print)
            showIndent(outfile, level, pretty_print)
            outfile.write('</%s%s>%s' % (namespace_, name_, eol_))
        else:
            outfile.write('/>%s' % (eol_, ))
    def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='simpleTwoType'):
        pass
    def exportChildren(self, outfile, level, namespace_='', name_='simpleTwoType', fromsubclass_=False, pretty_print=True):
        if pretty_print:
            eol_ = '\n'
        else:
            eol_ = ''
        if self.simpleTwoElementOne is not None:
            self.simpleTwoElementOne.export(outfile, level, namespace_, name_='simpleTwoElementOne', pretty_print=pretty_print)
    def build(self, node):
        already_processed = set()
        self.buildAttributes(node, node.attrib, already_processed)
        for child in node:
            nodeName_ = Tag_pattern_.match(child.tag).groups()[-1]
            self.buildChildren(child, node, nodeName_)
        return self
    def buildAttributes(self, node, attrs, already_processed):
        pass
    def buildChildren(self, child_, node, nodeName_, fromsubclass_=False):
        if nodeName_ == 'simpleTwoElementOne':
            obj_ = simpleTwoElementOneType.factory()
            obj_.build(child_)
            self.simpleTwoElementOne = obj_
            obj_.original_tagname_ = 'simpleTwoElementOne'
# end class simpleTwoType


class simpleTwoElementOneType(GeneratedsSuper):
    member_data_items_ = [
        MemberSpec_('simpleTwoElementTwo', ['simpleTwoElementTwoType', 'xs:string'], 0, 0, {u'type': u'xs:string', u'name': u'simpleTwoElementTwo'}, None),
    ]
    subclass = None
    superclass = None
    def __init__(self, simpleTwoElementTwo=None):
        self.original_tagname_ = None
        self.simpleTwoElementTwo = simpleTwoElementTwo
        self.validate_simpleTwoElementTwoType(self.simpleTwoElementTwo)
    def factory(*args_, **kwargs_):
        if CurrentSubclassModule_ is not None:
            subclass = getSubclassFromModule_(
                CurrentSubclassModule_, simpleTwoElementOneType)
            if subclass is not None:
                return subclass(*args_, **kwargs_)
        if simpleTwoElementOneType.subclass:
            return simpleTwoElementOneType.subclass(*args_, **kwargs_)
        else:
            return simpleTwoElementOneType(*args_, **kwargs_)
    factory = staticmethod(factory)
    def get_simpleTwoElementTwo(self): return self.simpleTwoElementTwo
    def set_simpleTwoElementTwo(self, simpleTwoElementTwo): self.simpleTwoElementTwo = simpleTwoElementTwo
    def validate_simpleTwoElementTwoType(self, value):
        # Validate type simpleTwoElementTwoType, a restriction on xs:string.
        if value is not None and Validate_simpletypes_:
            if len(value) > 24:
                warnings_.warn('Value "%(value)s" does not match xsd maxLength restriction on simpleTwoElementTwoType' % {"value" : value.encode("utf-8")} )
            if len(value) < 12:
                warnings_.warn('Value "%(value)s" does not match xsd minLength restriction on simpleTwoElementTwoType' % {"value" : value.encode("utf-8")} )
    def hasContent_(self):
        if (
            self.simpleTwoElementTwo is not None
        ):
            return True
        else:
            return False
    def export(self, outfile, level, namespace_='', name_='simpleTwoElementOneType', namespacedef_='', pretty_print=True):
        imported_ns_def_ = GenerateDSNamespaceDefs_.get('simpleTwoElementOneType')
        if imported_ns_def_ is not None:
            namespacedef_ = imported_ns_def_
        if pretty_print:
            eol_ = '\n'
        else:
            eol_ = ''
        if self.original_tagname_ is not None:
            name_ = self.original_tagname_
        showIndent(outfile, level, pretty_print)
        outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', ))
        already_processed = set()
        self.exportAttributes(outfile, level, already_processed, namespace_, name_='simpleTwoElementOneType')
        if self.hasContent_():
            outfile.write('>%s' % (eol_, ))
            self.exportChildren(outfile, level + 1, namespace_='', name_='simpleTwoElementOneType', pretty_print=pretty_print)
            showIndent(outfile, level, pretty_print)
            outfile.write('</%s%s>%s' % (namespace_, name_, eol_))
        else:
            outfile.write('/>%s' % (eol_, ))
    def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='simpleTwoElementOneType'):
        pass
    def exportChildren(self, outfile, level, namespace_='', name_='simpleTwoElementOneType', fromsubclass_=False, pretty_print=True):
        if pretty_print:
            eol_ = '\n'
        else:
            eol_ = ''
        if self.simpleTwoElementTwo is not None:
            showIndent(outfile, level, pretty_print)
            outfile.write('<%ssimpleTwoElementTwo>%s</%ssimpleTwoElementTwo>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.simpleTwoElementTwo), input_name='simpleTwoElementTwo')), namespace_, eol_))
    def build(self, node):
        already_processed = set()
        self.buildAttributes(node, node.attrib, already_processed)
        for child in node:
            nodeName_ = Tag_pattern_.match(child.tag).groups()[-1]
            self.buildChildren(child, node, nodeName_)
        return self
    def buildAttributes(self, node, attrs, already_processed):
        pass
    def buildChildren(self, child_, node, nodeName_, fromsubclass_=False):
        if nodeName_ == 'simpleTwoElementTwo':
            simpleTwoElementTwo_ = child_.text
            simpleTwoElementTwo_ = self.gds_validate_string(simpleTwoElementTwo_, node, 'simpleTwoElementTwo')
            self.simpleTwoElementTwo = simpleTwoElementTwo_
            # validate type simpleTwoElementTwoType
            self.validate_simpleTwoElementTwoType(self.simpleTwoElementTwo)
# end class simpleTwoElementOneType


GDSClassesMapping = {
    'container': containerType,
    'sample1': simpleOneType,
    'sample2': simpleTwoType,
    'sample2_bad': simpleOneType,
    'sample3_bad': simpleOneType,
    'sample4_bad': simpleOneType,
    'simpleTwoElementOne': simpleTwoElementOneType,
    'simpleTypeData': simpleTwoType,
}


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 = GDSClassesMapping.get(tag)
    if rootClass is None:
        rootClass = globals().get(tag)
    return tag, rootClass


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


def parseEtree(inFileName, silence=False):
    parser = None
    doc = parsexml_(inFileName, parser)
    rootNode = doc.getroot()
    rootTag, rootClass = get_root_tag(rootNode)
    if rootClass is None:
        rootTag = 'containerType'
        rootClass = containerType
    rootObj = rootClass.factory()
    rootObj.build(rootNode)
    # Enable Python to collect the space used by the DOM.
    doc = None
    mapping = {}
    rootElement = rootObj.to_etree(None, name_=rootTag, mapping_=mapping)
    reverse_mapping = rootObj.gds_reverse_node_mapping(mapping)
    if not silence:
        content = etree_.tostring(
            rootElement, pretty_print=True,
            xml_declaration=True, encoding="utf-8")
        sys.stdout.write(content)
        sys.stdout.write('\n')
    return rootObj, rootElement, mapping, reverse_mapping


def parseString(inString, silence=False):
    if sys.version_info.major == 2:
        from StringIO import StringIO as IOBuffer
    else:
        from io import BytesIO as IOBuffer
    parser = None
    doc = parsexml_(IOBuffer(inString), parser)
    rootNode = doc.getroot()
    rootTag, rootClass = get_root_tag(rootNode)
    if rootClass is None:
        rootTag = 'containerType'
        rootClass = containerType
    rootObj = rootClass.factory()
    rootObj.build(rootNode)
    # Enable Python to collect the space used by the DOM.
    doc = None
    if not silence:
        sys.stdout.write('<?xml version="1.0" ?>\n')
        rootObj.export(
            sys.stdout, 0, name_=rootTag,
            namespacedef_='')
    return rootObj


def parseLiteral(inFileName, silence=False):
    parser = None
    doc = parsexml_(inFileName, parser)
    rootNode = doc.getroot()
    rootTag, rootClass = get_root_tag(rootNode)
    if rootClass is None:
        rootTag = 'containerType'
        rootClass = containerType
    rootObj = rootClass.factory()
    rootObj.build(rootNode)
    # Enable Python to collect the space used by the DOM.
    doc = None
    if not silence:
        sys.stdout.write('#from validate_simpletypes2_sup import *\n\n')
        sys.stdout.write('import validate_simpletypes2_sup as model_\n\n')
        sys.stdout.write('rootObj = model_.rootClass(\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__ = [
    "containerType",
    "simpleOneType",
    "simpleTwoElementOneType",
    "simpleTwoType"
]
