text: #!/usr/bin/env python
  # -*- coding: utf-8 -*-
  
  #
  # Generated  by generateDS.py.
  #
  # Command line options:
  #   ('--no-dates', '')
  #   ('--no-versions', '')
  #   ('--silence', '')
  #   ('--member-specs', 'list')
  #   ('-f', '')
  #   ('-o', 'tests/extensions2_sup.py')
  #   ('-s', 'tests/extensions2_sub.py')
  #   ('--super', 'extensions2_sup')
  #
  # Command line arguments:
  #   tests/extensions.xsd
  #
  # Command line:
  #   generateDS.py --no-dates --no-versions --silence --member-specs="list" -f -o "tests/extensions2_sup.py" -s "tests/extensions2_sub.py" --super="extensions2_sup" tests/extensions.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
  
  #
  # 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 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
  
      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):
          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 SpecialDate(GeneratedsSuper):
      member_data_items_ = [
          MemberSpec_('SpecialProperty', 'xs:string', 0),
          MemberSpec_('valueOf_', 'xs:date', 0),
      ]
      subclass = None
      superclass = None
      def __init__(self, SpecialProperty=None, valueOf_=None):
          self.original_tagname_ = None
          self.SpecialProperty = _cast(None, SpecialProperty)
          self.valueOf_ = valueOf_
      def factory(*args_, **kwargs_):
          if CurrentSubclassModule_ is not None:
              subclass = getSubclassFromModule_(
                  CurrentSubclassModule_, SpecialDate)
              if subclass is not None:
                  return subclass(*args_, **kwargs_)
          if SpecialDate.subclass:
              return SpecialDate.subclass(*args_, **kwargs_)
          else:
              return SpecialDate(*args_, **kwargs_)
      factory = staticmethod(factory)
      def get_SpecialProperty(self): return self.SpecialProperty
      def set_SpecialProperty(self, SpecialProperty): self.SpecialProperty = SpecialProperty
      def get_valueOf_(self): return self.valueOf_
      def set_valueOf_(self, valueOf_): self.valueOf_ = valueOf_
      def hasContent_(self):
          if (
              1 if type(self.valueOf_) in [int,float] else self.valueOf_
          ):
              return True
          else:
              return False
      def export(self, outfile, level, namespace_='', name_='SpecialDate', namespacedef_='', pretty_print=True):
          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_='SpecialDate')
          if self.hasContent_():
              outfile.write('>')
              outfile.write((quote_xml(self.valueOf_) if type(self.valueOf_) is str else self.gds_encode(str(self.valueOf_))))
              self.exportChildren(outfile, level + 1, namespace_='', name_='SpecialDate', pretty_print=pretty_print)
              outfile.write('</%s%s>%s' % (namespace_, name_, eol_))
          else:
              outfile.write('/>%s' % (eol_, ))
      def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='SpecialDate'):
          if self.SpecialProperty is not None and 'SpecialProperty' not in already_processed:
              already_processed.add('SpecialProperty')
              outfile.write(' SpecialProperty=%s' % (self.gds_encode(self.gds_format_string(quote_attrib(self.SpecialProperty), input_name='SpecialProperty')), ))
      def exportChildren(self, outfile, level, namespace_='', name_='SpecialDate', fromsubclass_=False, pretty_print=True):
          pass
      def build(self, node):
          already_processed = set()
          self.buildAttributes(node, node.attrib, already_processed)
          self.valueOf_ = get_all_text_(node)
          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):
          value = find_attr_value_('SpecialProperty', node)
          if value is not None and 'SpecialProperty' not in already_processed:
              already_processed.add('SpecialProperty')
              self.SpecialProperty = value
      def buildChildren(self, child_, node, nodeName_, fromsubclass_=False):
          pass
  # end class SpecialDate
  
  
  class ExtremeDate(GeneratedsSuper):
      member_data_items_ = [
          MemberSpec_('ExtremeProperty', 'xs:string', 0),
          MemberSpec_('valueOf_', ['RelationType', 'RelationType2', 'RelationType3', 'xs:string'], 0),
      ]
      subclass = None
      superclass = None
      def __init__(self, ExtremeProperty=None, valueOf_=None):
          self.original_tagname_ = None
          self.ExtremeProperty = _cast(None, ExtremeProperty)
          self.valueOf_ = valueOf_
      def factory(*args_, **kwargs_):
          if CurrentSubclassModule_ is not None:
              subclass = getSubclassFromModule_(
                  CurrentSubclassModule_, ExtremeDate)
              if subclass is not None:
                  return subclass(*args_, **kwargs_)
          if ExtremeDate.subclass:
              return ExtremeDate.subclass(*args_, **kwargs_)
          else:
              return ExtremeDate(*args_, **kwargs_)
      factory = staticmethod(factory)
      def get_ExtremeProperty(self): return self.ExtremeProperty
      def set_ExtremeProperty(self, ExtremeProperty): self.ExtremeProperty = ExtremeProperty
      def get_valueOf_(self): return self.valueOf_
      def set_valueOf_(self, valueOf_): self.valueOf_ = valueOf_
      def hasContent_(self):
          if (
              1 if type(self.valueOf_) in [int,float] else self.valueOf_
          ):
              return True
          else:
              return False
      def export(self, outfile, level, namespace_='', name_='ExtremeDate', namespacedef_='', pretty_print=True):
          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_='ExtremeDate')
          if self.hasContent_():
              outfile.write('>')
              outfile.write((quote_xml(self.valueOf_) if type(self.valueOf_) is str else self.gds_encode(str(self.valueOf_))))
              self.exportChildren(outfile, level + 1, namespace_='', name_='ExtremeDate', pretty_print=pretty_print)
              outfile.write('</%s%s>%s' % (namespace_, name_, eol_))
          else:
              outfile.write('/>%s' % (eol_, ))
      def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='ExtremeDate'):
          if self.ExtremeProperty is not None and 'ExtremeProperty' not in already_processed:
              already_processed.add('ExtremeProperty')
              outfile.write(' ExtremeProperty=%s' % (self.gds_encode(self.gds_format_string(quote_attrib(self.ExtremeProperty), input_name='ExtremeProperty')), ))
      def exportChildren(self, outfile, level, namespace_='', name_='ExtremeDate', fromsubclass_=False, pretty_print=True):
          pass
      def build(self, node):
          already_processed = set()
          self.buildAttributes(node, node.attrib, already_processed)
          self.valueOf_ = get_all_text_(node)
          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):
          value = find_attr_value_('ExtremeProperty', node)
          if value is not None and 'ExtremeProperty' not in already_processed:
              already_processed.add('ExtremeProperty')
              self.ExtremeProperty = value
      def buildChildren(self, child_, node, nodeName_, fromsubclass_=False):
          pass
  # end class ExtremeDate
  
  
  class singleExtremeDate(GeneratedsSuper):
      member_data_items_ = [
          MemberSpec_('ExtremeProperty', 'xs:string', 0),
          MemberSpec_('valueOf_', 'xs:string', 0),
      ]
      subclass = None
      superclass = None
      def __init__(self, ExtremeProperty=None, valueOf_=None):
          self.original_tagname_ = None
          self.ExtremeProperty = _cast(None, ExtremeProperty)
          self.valueOf_ = valueOf_
      def factory(*args_, **kwargs_):
          if CurrentSubclassModule_ is not None:
              subclass = getSubclassFromModule_(
                  CurrentSubclassModule_, singleExtremeDate)
              if subclass is not None:
                  return subclass(*args_, **kwargs_)
          if singleExtremeDate.subclass:
              return singleExtremeDate.subclass(*args_, **kwargs_)
          else:
              return singleExtremeDate(*args_, **kwargs_)
      factory = staticmethod(factory)
      def get_ExtremeProperty(self): return self.ExtremeProperty
      def set_ExtremeProperty(self, ExtremeProperty): self.ExtremeProperty = ExtremeProperty
      def get_valueOf_(self): return self.valueOf_
      def set_valueOf_(self, valueOf_): self.valueOf_ = valueOf_
      def hasContent_(self):
          if (
              1 if type(self.valueOf_) in [int,float] else self.valueOf_
          ):
              return True
          else:
              return False
      def export(self, outfile, level, namespace_='', name_='singleExtremeDate', namespacedef_='', pretty_print=True):
          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_='singleExtremeDate')
          if self.hasContent_():
              outfile.write('>')
              outfile.write((quote_xml(self.valueOf_) if type(self.valueOf_) is str else self.gds_encode(str(self.valueOf_))))
              self.exportChildren(outfile, level + 1, namespace_='', name_='singleExtremeDate', pretty_print=pretty_print)
              outfile.write('</%s%s>%s' % (namespace_, name_, eol_))
          else:
              outfile.write('/>%s' % (eol_, ))
      def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='singleExtremeDate'):
          if self.ExtremeProperty is not None and 'ExtremeProperty' not in already_processed:
              already_processed.add('ExtremeProperty')
              outfile.write(' ExtremeProperty=%s' % (self.gds_encode(self.gds_format_string(quote_attrib(self.ExtremeProperty), input_name='ExtremeProperty')), ))
      def exportChildren(self, outfile, level, namespace_='', name_='singleExtremeDate', fromsubclass_=False, pretty_print=True):
          pass
      def build(self, node):
          already_processed = set()
          self.buildAttributes(node, node.attrib, already_processed)
          self.valueOf_ = get_all_text_(node)
          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):
          value = find_attr_value_('ExtremeProperty', node)
          if value is not None and 'ExtremeProperty' not in already_processed:
              already_processed.add('ExtremeProperty')
              self.ExtremeProperty = value
      def buildChildren(self, child_, node, nodeName_, fromsubclass_=False):
          pass
  # end class singleExtremeDate
  
  
  class containerType(GeneratedsSuper):
      member_data_items_ = [
          MemberSpec_('simplefactoid', 'simpleFactoidType', 1),
          MemberSpec_('mixedfactoid', 'mixedFactoidType', 0),
      ]
      subclass = None
      superclass = None
      def __init__(self, simplefactoid=None, mixedfactoid=None):
          self.original_tagname_ = None
          if simplefactoid is None:
              self.simplefactoid = []
          else:
              self.simplefactoid = simplefactoid
          self.mixedfactoid = mixedfactoid
      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_simplefactoid(self): return self.simplefactoid
      def set_simplefactoid(self, simplefactoid): self.simplefactoid = simplefactoid
      def add_simplefactoid(self, value): self.simplefactoid.append(value)
      def insert_simplefactoid_at(self, index, value): self.simplefactoid.insert(index, value)
      def replace_simplefactoid_at(self, index, value): self.simplefactoid[index] = value
      def get_mixedfactoid(self): return self.mixedfactoid
      def set_mixedfactoid(self, mixedfactoid): self.mixedfactoid = mixedfactoid
      def hasContent_(self):
          if (
              self.simplefactoid or
              self.mixedfactoid is not None
          ):
              return True
          else:
              return False
      def export(self, outfile, level, namespace_='', name_='containerType', namespacedef_='', pretty_print=True):
          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 simplefactoid_ in self.simplefactoid:
              simplefactoid_.export(outfile, level, namespace_, name_='simplefactoid', pretty_print=pretty_print)
          if self.mixedfactoid is not None:
              self.mixedfactoid.export(outfile, level, namespace_, name_='mixedfactoid', 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_ == 'simplefactoid':
              obj_ = simpleFactoidType.factory()
              obj_.build(child_)
              self.simplefactoid.append(obj_)
              obj_.original_tagname_ = 'simplefactoid'
          elif nodeName_ == 'mixedfactoid':
              obj_ = mixedFactoidType.factory()
              obj_.build(child_)
              self.mixedfactoid = obj_
              obj_.original_tagname_ = 'mixedfactoid'
  # end class containerType
  
  
  class simpleFactoidType(GeneratedsSuper):
      member_data_items_ = [
          MemberSpec_('relation', ['RelationType', 'RelationType2', 'RelationType3', 'xs:string'], 0),
      ]
      subclass = None
      superclass = None
      def __init__(self, relation=None):
          self.original_tagname_ = None
          self.relation = relation
          self.validate_RelationType(self.relation)
      def factory(*args_, **kwargs_):
          if CurrentSubclassModule_ is not None:
              subclass = getSubclassFromModule_(
                  CurrentSubclassModule_, simpleFactoidType)
              if subclass is not None:
                  return subclass(*args_, **kwargs_)
          if simpleFactoidType.subclass:
              return simpleFactoidType.subclass(*args_, **kwargs_)
          else:
              return simpleFactoidType(*args_, **kwargs_)
      factory = staticmethod(factory)
      def get_relation(self): return self.relation
      def set_relation(self, relation): self.relation = relation
      def validate_RelationType(self, value):
          # Validate type RelationType, a restriction on RelationType2.
          if value is not None and Validate_simpletypes_:
              value = str(value)
              enumerations = ['down', 'add']
              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 RelationType' % {"value" : value.encode("utf-8")} )
              value = str(value)
              enumerations = ['up', 'subtract']
              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 RelationType' % {"value" : value.encode("utf-8")} )
              value = str(value)
              enumerations = ['right', 'divide']
              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 RelationType' % {"value" : value.encode("utf-8")} )
      def hasContent_(self):
          if (
              self.relation is not None
          ):
              return True
          else:
              return False
      def export(self, outfile, level, namespace_='', name_='simpleFactoidType', namespacedef_='', pretty_print=True):
          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_='simpleFactoidType')
          if self.hasContent_():
              outfile.write('>%s' % (eol_, ))
              self.exportChildren(outfile, level + 1, namespace_='', name_='simpleFactoidType', 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_='simpleFactoidType'):
          pass
      def exportChildren(self, outfile, level, namespace_='', name_='simpleFactoidType', fromsubclass_=False, pretty_print=True):
          if pretty_print:
              eol_ = '\n'
          else:
              eol_ = ''
          if self.relation is not None:
              showIndent(outfile, level, pretty_print)
              outfile.write('<%srelation>%s</%srelation>%s' % (namespace_, self.gds_encode(self.gds_format_string(quote_xml(self.relation), input_name='relation')), 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_ == 'relation':
              relation_ = child_.text
              relation_ = self.gds_validate_string(relation_, node, 'relation')
              self.relation = relation_
              # validate type RelationType
              self.validate_RelationType(self.relation)
  # end class simpleFactoidType
  
  
  class mixedFactoidType(GeneratedsSuper):
      member_data_items_ = [
          MemberSpec_('relation', ['RelationType', 'RelationType2', 'RelationType3', 'xs:string'], 0),
          MemberSpec_('valueOf_', [], 0),
      ]
      subclass = None
      superclass = None
      def __init__(self, relation=None, valueOf_=None, mixedclass_=None, content_=None):
          self.original_tagname_ = None
          self.relation = relation
          self.validate_RelationType(self.relation)
          self.valueOf_ = valueOf_
          if mixedclass_ is None:
              self.mixedclass_ = MixedContainer
          else:
              self.mixedclass_ = mixedclass_
          if content_ is None:
              self.content_ = []
          else:
              self.content_ = content_
          self.valueOf_ = valueOf_
      def factory(*args_, **kwargs_):
          if CurrentSubclassModule_ is not None:
              subclass = getSubclassFromModule_(
                  CurrentSubclassModule_, mixedFactoidType)
              if subclass is not None:
                  return subclass(*args_, **kwargs_)
          if mixedFactoidType.subclass:
              return mixedFactoidType.subclass(*args_, **kwargs_)
          else:
              return mixedFactoidType(*args_, **kwargs_)
      factory = staticmethod(factory)
      def get_relation(self): return self.relation
      def set_relation(self, relation): self.relation = relation
      def get_valueOf_(self): return self.valueOf_
      def set_valueOf_(self, valueOf_): self.valueOf_ = valueOf_
      def validate_RelationType(self, value):
          # Validate type RelationType, a restriction on RelationType2.
          if value is not None and Validate_simpletypes_:
              value = str(value)
              enumerations = ['down', 'add']
              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 RelationType' % {"value" : value.encode("utf-8")} )
              value = str(value)
              enumerations = ['up', 'subtract']
              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 RelationType' % {"value" : value.encode("utf-8")} )
              value = str(value)
              enumerations = ['right', 'divide']
              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 RelationType' % {"value" : value.encode("utf-8")} )
      def hasContent_(self):
          if (
              self.relation is not None or
              1 if type(self.valueOf_) in [int,float] else self.valueOf_
          ):
              return True
          else:
              return False
      def export(self, outfile, level, namespace_='', name_='mixedFactoidType', namespacedef_='', pretty_print=True):
          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_='mixedFactoidType')
          if self.hasContent_():
              outfile.write('>%s' % (eol_, ))
              self.exportChildren(outfile, level + 1, namespace_='', name_='mixedFactoidType', 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_='mixedFactoidType'):
          pass
      def exportChildren(self, outfile, level, namespace_='', name_='mixedFactoidType', fromsubclass_=False, pretty_print=True):
          if not fromsubclass_:
              for item_ in self.content_:
                  item_.export(outfile, level, item_.name, namespace_, pretty_print=pretty_print)
      def build(self, node):
          already_processed = set()
          self.buildAttributes(node, node.attrib, already_processed)
          self.valueOf_ = get_all_text_(node)
          if node.text is not None:
              obj_ = self.mixedclass_(MixedContainer.CategoryText,
                  MixedContainer.TypeNone, '', node.text)
              self.content_.append(obj_)
          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_ == 'relation' and child_.text is not None:
              valuestr_ = child_.text
              obj_ = self.mixedclass_(MixedContainer.CategorySimple,
                  MixedContainer.TypeString, 'relation', valuestr_)
              self.content_.append(obj_)
          if not fromsubclass_ and child_.tail is not None:
              obj_ = self.mixedclass_(MixedContainer.CategoryText,
                  MixedContainer.TypeNone, '', child_.tail)
              self.content_.append(obj_)
  # end class mixedFactoidType
  
  
  class BaseType(GeneratedsSuper):
      member_data_items_ = [
          MemberSpec_('BaseProperty1', 'xs:string', 0),
          MemberSpec_('BaseProperty2', 'xs:string', 0),
          MemberSpec_('valueOf_', 'xs:string', 0),
      ]
      subclass = None
      superclass = None
      def __init__(self, BaseProperty1=None, BaseProperty2=None, valueOf_=None, extensiontype_=None):
          self.original_tagname_ = None
          self.BaseProperty1 = _cast(None, BaseProperty1)
          self.BaseProperty2 = _cast(None, BaseProperty2)
          self.valueOf_ = valueOf_
          self.extensiontype_ = extensiontype_
      def factory(*args_, **kwargs_):
          if CurrentSubclassModule_ is not None:
              subclass = getSubclassFromModule_(
                  CurrentSubclassModule_, BaseType)
              if subclass is not None:
                  return subclass(*args_, **kwargs_)
          if BaseType.subclass:
              return BaseType.subclass(*args_, **kwargs_)
          else:
              return BaseType(*args_, **kwargs_)
      factory = staticmethod(factory)
      def get_BaseProperty1(self): return self.BaseProperty1
      def set_BaseProperty1(self, BaseProperty1): self.BaseProperty1 = BaseProperty1
      def get_BaseProperty2(self): return self.BaseProperty2
      def set_BaseProperty2(self, BaseProperty2): self.BaseProperty2 = BaseProperty2
      def get_valueOf_(self): return self.valueOf_
      def set_valueOf_(self, valueOf_): self.valueOf_ = valueOf_
      def get_extensiontype_(self): return self.extensiontype_
      def set_extensiontype_(self, extensiontype_): self.extensiontype_ = extensiontype_
      def hasContent_(self):
          if (
              1 if type(self.valueOf_) in [int,float] else self.valueOf_
          ):
              return True
          else:
              return False
      def export(self, outfile, level, namespace_='', name_='BaseType', namespacedef_='', pretty_print=True):
          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_='BaseType')
          if self.hasContent_():
              outfile.write('>')
              outfile.write((quote_xml(self.valueOf_) if type(self.valueOf_) is str else self.gds_encode(str(self.valueOf_))))
              self.exportChildren(outfile, level + 1, namespace_='', name_='BaseType', pretty_print=pretty_print)
              outfile.write('</%s%s>%s' % (namespace_, name_, eol_))
          else:
              outfile.write('/>%s' % (eol_, ))
      def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='BaseType'):
          if self.BaseProperty1 is not None and 'BaseProperty1' not in already_processed:
              already_processed.add('BaseProperty1')
              outfile.write(' BaseProperty1=%s' % (self.gds_encode(self.gds_format_string(quote_attrib(self.BaseProperty1), input_name='BaseProperty1')), ))
          if self.BaseProperty2 is not None and 'BaseProperty2' not in already_processed:
              already_processed.add('BaseProperty2')
              outfile.write(' BaseProperty2=%s' % (self.gds_encode(self.gds_format_string(quote_attrib(self.BaseProperty2), input_name='BaseProperty2')), ))
          if self.extensiontype_ is not None and 'xsi:type' not in already_processed:
              already_processed.add('xsi:type')
              outfile.write(' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"')
              outfile.write(' xsi:type="%s"' % self.extensiontype_)
      def exportChildren(self, outfile, level, namespace_='', name_='BaseType', fromsubclass_=False, pretty_print=True):
          pass
      def build(self, node):
          already_processed = set()
          self.buildAttributes(node, node.attrib, already_processed)
          self.valueOf_ = get_all_text_(node)
          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):
          value = find_attr_value_('BaseProperty1', node)
          if value is not None and 'BaseProperty1' not in already_processed:
              already_processed.add('BaseProperty1')
              self.BaseProperty1 = value
          value = find_attr_value_('BaseProperty2', node)
          if value is not None and 'BaseProperty2' not in already_processed:
              already_processed.add('BaseProperty2')
              self.BaseProperty2 = value
          value = find_attr_value_('xsi:type', node)
          if value is not None and 'xsi:type' not in already_processed:
              already_processed.add('xsi:type')
              self.extensiontype_ = value
      def buildChildren(self, child_, node, nodeName_, fromsubclass_=False):
          pass
  # end class BaseType
  
  
  class DerivedType(BaseType):
      member_data_items_ = [
          MemberSpec_('DerivedProperty1', 'xs:string', 0),
          MemberSpec_('DerivedProperty2', 'xs:string', 0),
          MemberSpec_('valueOf_', 'BaseType', 0),
      ]
      subclass = None
      superclass = BaseType
      def __init__(self, BaseProperty1=None, BaseProperty2=None, DerivedProperty1=None, DerivedProperty2=None, valueOf_=None):
          self.original_tagname_ = None
          super(DerivedType, self).__init__(BaseProperty1, BaseProperty2, valueOf_, )
          self.DerivedProperty1 = _cast(None, DerivedProperty1)
          self.DerivedProperty2 = _cast(None, DerivedProperty2)
          self.valueOf_ = valueOf_
      def factory(*args_, **kwargs_):
          if CurrentSubclassModule_ is not None:
              subclass = getSubclassFromModule_(
                  CurrentSubclassModule_, DerivedType)
              if subclass is not None:
                  return subclass(*args_, **kwargs_)
          if DerivedType.subclass:
              return DerivedType.subclass(*args_, **kwargs_)
          else:
              return DerivedType(*args_, **kwargs_)
      factory = staticmethod(factory)
      def get_DerivedProperty1(self): return self.DerivedProperty1
      def set_DerivedProperty1(self, DerivedProperty1): self.DerivedProperty1 = DerivedProperty1
      def get_DerivedProperty2(self): return self.DerivedProperty2
      def set_DerivedProperty2(self, DerivedProperty2): self.DerivedProperty2 = DerivedProperty2
      def get_valueOf_(self): return self.valueOf_
      def set_valueOf_(self, valueOf_): self.valueOf_ = valueOf_
      def hasContent_(self):
          if (
              1 if type(self.valueOf_) in [int,float] else self.valueOf_ or
              super(DerivedType, self).hasContent_()
          ):
              return True
          else:
              return False
      def export(self, outfile, level, namespace_='', name_='DerivedType', namespacedef_='', pretty_print=True):
          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_='DerivedType')
          if self.hasContent_():
              outfile.write('>')
              outfile.write((quote_xml(self.valueOf_) if type(self.valueOf_) is str else self.gds_encode(str(self.valueOf_))))
              self.exportChildren(outfile, level + 1, namespace_='', name_='DerivedType', pretty_print=pretty_print)
              outfile.write('</%s%s>%s' % (namespace_, name_, eol_))
          else:
              outfile.write('/>%s' % (eol_, ))
      def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='DerivedType'):
          super(DerivedType, self).exportAttributes(outfile, level, already_processed, namespace_, name_='DerivedType')
          if self.DerivedProperty1 is not None and 'DerivedProperty1' not in already_processed:
              already_processed.add('DerivedProperty1')
              outfile.write(' DerivedProperty1=%s' % (self.gds_encode(self.gds_format_string(quote_attrib(self.DerivedProperty1), input_name='DerivedProperty1')), ))
          if self.DerivedProperty2 is not None and 'DerivedProperty2' not in already_processed:
              already_processed.add('DerivedProperty2')
              outfile.write(' DerivedProperty2=%s' % (self.gds_encode(self.gds_format_string(quote_attrib(self.DerivedProperty2), input_name='DerivedProperty2')), ))
      def exportChildren(self, outfile, level, namespace_='', name_='DerivedType', fromsubclass_=False, pretty_print=True):
          super(DerivedType, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print)
          pass
      def build(self, node):
          already_processed = set()
          self.buildAttributes(node, node.attrib, already_processed)
          self.valueOf_ = get_all_text_(node)
          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):
          value = find_attr_value_('DerivedProperty1', node)
          if value is not None and 'DerivedProperty1' not in already_processed:
              already_processed.add('DerivedProperty1')
              self.DerivedProperty1 = value
          value = find_attr_value_('DerivedProperty2', node)
          if value is not None and 'DerivedProperty2' not in already_processed:
              already_processed.add('DerivedProperty2')
              self.DerivedProperty2 = value
          super(DerivedType, self).buildAttributes(node, attrs, already_processed)
      def buildChildren(self, child_, node, nodeName_, fromsubclass_=False):
          pass
  # end class DerivedType
  
  
  class MyInteger(GeneratedsSuper):
      member_data_items_ = [
          MemberSpec_('MyAttr', 'xs:string', 0),
          MemberSpec_('valueOf_', 'xs:integer', 0),
      ]
      subclass = None
      superclass = None
      def __init__(self, MyAttr=None, valueOf_=None):
          self.original_tagname_ = None
          self.MyAttr = _cast(None, MyAttr)
          self.valueOf_ = valueOf_
      def factory(*args_, **kwargs_):
          if CurrentSubclassModule_ is not None:
              subclass = getSubclassFromModule_(
                  CurrentSubclassModule_, MyInteger)
              if subclass is not None:
                  return subclass(*args_, **kwargs_)
          if MyInteger.subclass:
              return MyInteger.subclass(*args_, **kwargs_)
          else:
              return MyInteger(*args_, **kwargs_)
      factory = staticmethod(factory)
      def get_MyAttr(self): return self.MyAttr
      def set_MyAttr(self, MyAttr): self.MyAttr = MyAttr
      def get_valueOf_(self): return self.valueOf_
      def set_valueOf_(self, valueOf_): self.valueOf_ = valueOf_
      def hasContent_(self):
          if (
              1 if type(self.valueOf_) in [int,float] else self.valueOf_
          ):
              return True
          else:
              return False
      def export(self, outfile, level, namespace_='', name_='MyInteger', namespacedef_='', pretty_print=True):
          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_='MyInteger')
          if self.hasContent_():
              outfile.write('>')
              outfile.write((quote_xml(self.valueOf_) if type(self.valueOf_) is str else self.gds_encode(str(self.valueOf_))))
              self.exportChildren(outfile, level + 1, namespace_='', name_='MyInteger', pretty_print=pretty_print)
              outfile.write('</%s%s>%s' % (namespace_, name_, eol_))
          else:
              outfile.write('/>%s' % (eol_, ))
      def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='MyInteger'):
          if self.MyAttr is not None and 'MyAttr' not in already_processed:
              already_processed.add('MyAttr')
              outfile.write(' MyAttr=%s' % (self.gds_encode(self.gds_format_string(quote_attrib(self.MyAttr), input_name='MyAttr')), ))
      def exportChildren(self, outfile, level, namespace_='', name_='MyInteger', fromsubclass_=False, pretty_print=True):
          pass
      def build(self, node):
          already_processed = set()
          self.buildAttributes(node, node.attrib, already_processed)
          self.valueOf_ = get_all_text_(node)
          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):
          value = find_attr_value_('MyAttr', node)
          if value is not None and 'MyAttr' not in already_processed:
              already_processed.add('MyAttr')
              self.MyAttr = value
      def buildChildren(self, child_, node, nodeName_, fromsubclass_=False):
          pass
  # end class MyInteger
  
  
  class MyBoolean(GeneratedsSuper):
      member_data_items_ = [
          MemberSpec_('MyAttr', 'xs:string', 0),
          MemberSpec_('valueOf_', 'xs:boolean', 0),
      ]
      subclass = None
      superclass = None
      def __init__(self, MyAttr=None, valueOf_=None):
          self.original_tagname_ = None
          self.MyAttr = _cast(None, MyAttr)
          self.valueOf_ = valueOf_
      def factory(*args_, **kwargs_):
          if CurrentSubclassModule_ is not None:
              subclass = getSubclassFromModule_(
                  CurrentSubclassModule_, MyBoolean)
              if subclass is not None:
                  return subclass(*args_, **kwargs_)
          if MyBoolean.subclass:
              return MyBoolean.subclass(*args_, **kwargs_)
          else:
              return MyBoolean(*args_, **kwargs_)
      factory = staticmethod(factory)
      def get_MyAttr(self): return self.MyAttr
      def set_MyAttr(self, MyAttr): self.MyAttr = MyAttr
      def get_valueOf_(self): return self.valueOf_
      def set_valueOf_(self, valueOf_): self.valueOf_ = valueOf_
      def hasContent_(self):
          if (
              1 if type(self.valueOf_) in [int,float] else self.valueOf_
          ):
              return True
          else:
              return False
      def export(self, outfile, level, namespace_='', name_='MyBoolean', namespacedef_='', pretty_print=True):
          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_='MyBoolean')
          if self.hasContent_():
              outfile.write('>')
              outfile.write((quote_xml(self.valueOf_) if type(self.valueOf_) is str else self.gds_encode(str(self.valueOf_))))
              self.exportChildren(outfile, level + 1, namespace_='', name_='MyBoolean', pretty_print=pretty_print)
              outfile.write('</%s%s>%s' % (namespace_, name_, eol_))
          else:
              outfile.write('/>%s' % (eol_, ))
      def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='MyBoolean'):
          if self.MyAttr is not None and 'MyAttr' not in already_processed:
              already_processed.add('MyAttr')
              outfile.write(' MyAttr=%s' % (self.gds_encode(self.gds_format_string(quote_attrib(self.MyAttr), input_name='MyAttr')), ))
      def exportChildren(self, outfile, level, namespace_='', name_='MyBoolean', fromsubclass_=False, pretty_print=True):
          pass
      def build(self, node):
          already_processed = set()
          self.buildAttributes(node, node.attrib, already_processed)
          self.valueOf_ = get_all_text_(node)
          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):
          value = find_attr_value_('MyAttr', node)
          if value is not None and 'MyAttr' not in already_processed:
              already_processed.add('MyAttr')
              self.MyAttr = value
      def buildChildren(self, child_, node, nodeName_, fromsubclass_=False):
          pass
  # end class MyBoolean
  
  
  class MyFloat(GeneratedsSuper):
      member_data_items_ = [
          MemberSpec_('MyAttr', 'xs:string', 0),
          MemberSpec_('valueOf_', 'xs:float', 0),
      ]
      subclass = None
      superclass = None
      def __init__(self, MyAttr=None, valueOf_=None):
          self.original_tagname_ = None
          self.MyAttr = _cast(None, MyAttr)
          self.valueOf_ = valueOf_
      def factory(*args_, **kwargs_):
          if CurrentSubclassModule_ is not None:
              subclass = getSubclassFromModule_(
                  CurrentSubclassModule_, MyFloat)
              if subclass is not None:
                  return subclass(*args_, **kwargs_)
          if MyFloat.subclass:
              return MyFloat.subclass(*args_, **kwargs_)
          else:
              return MyFloat(*args_, **kwargs_)
      factory = staticmethod(factory)
      def get_MyAttr(self): return self.MyAttr
      def set_MyAttr(self, MyAttr): self.MyAttr = MyAttr
      def get_valueOf_(self): return self.valueOf_
      def set_valueOf_(self, valueOf_): self.valueOf_ = valueOf_
      def hasContent_(self):
          if (
              1 if type(self.valueOf_) in [int,float] else self.valueOf_
          ):
              return True
          else:
              return False
      def export(self, outfile, level, namespace_='', name_='MyFloat', namespacedef_='', pretty_print=True):
          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_='MyFloat')
          if self.hasContent_():
              outfile.write('>')
              outfile.write((quote_xml(self.valueOf_) if type(self.valueOf_) is str else self.gds_encode(str(self.valueOf_))))
              self.exportChildren(outfile, level + 1, namespace_='', name_='MyFloat', pretty_print=pretty_print)
              outfile.write('</%s%s>%s' % (namespace_, name_, eol_))
          else:
              outfile.write('/>%s' % (eol_, ))
      def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='MyFloat'):
          if self.MyAttr is not None and 'MyAttr' not in already_processed:
              already_processed.add('MyAttr')
              outfile.write(' MyAttr=%s' % (self.gds_encode(self.gds_format_string(quote_attrib(self.MyAttr), input_name='MyAttr')), ))
      def exportChildren(self, outfile, level, namespace_='', name_='MyFloat', fromsubclass_=False, pretty_print=True):
          pass
      def build(self, node):
          already_processed = set()
          self.buildAttributes(node, node.attrib, already_processed)
          self.valueOf_ = get_all_text_(node)
          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):
          value = find_attr_value_('MyAttr', node)
          if value is not None and 'MyAttr' not in already_processed:
              already_processed.add('MyAttr')
              self.MyAttr = value
      def buildChildren(self, child_, node, nodeName_, fromsubclass_=False):
          pass
  # end class MyFloat
  
  
  class MyDouble(GeneratedsSuper):
      member_data_items_ = [
          MemberSpec_('MyAttr', 'xs:string', 0),
          MemberSpec_('valueOf_', 'xs:double', 0),
      ]
      subclass = None
      superclass = None
      def __init__(self, MyAttr=None, valueOf_=None):
          self.original_tagname_ = None
          self.MyAttr = _cast(None, MyAttr)
          self.valueOf_ = valueOf_
      def factory(*args_, **kwargs_):
          if CurrentSubclassModule_ is not None:
              subclass = getSubclassFromModule_(
                  CurrentSubclassModule_, MyDouble)
              if subclass is not None:
                  return subclass(*args_, **kwargs_)
          if MyDouble.subclass:
              return MyDouble.subclass(*args_, **kwargs_)
          else:
              return MyDouble(*args_, **kwargs_)
      factory = staticmethod(factory)
      def get_MyAttr(self): return self.MyAttr
      def set_MyAttr(self, MyAttr): self.MyAttr = MyAttr
      def get_valueOf_(self): return self.valueOf_
      def set_valueOf_(self, valueOf_): self.valueOf_ = valueOf_
      def hasContent_(self):
          if (
              1 if type(self.valueOf_) in [int,float] else self.valueOf_
          ):
              return True
          else:
              return False
      def export(self, outfile, level, namespace_='', name_='MyDouble', namespacedef_='', pretty_print=True):
          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_='MyDouble')
          if self.hasContent_():
              outfile.write('>')
              outfile.write((quote_xml(self.valueOf_) if type(self.valueOf_) is str else self.gds_encode(str(self.valueOf_))))
              self.exportChildren(outfile, level + 1, namespace_='', name_='MyDouble', pretty_print=pretty_print)
              outfile.write('</%s%s>%s' % (namespace_, name_, eol_))
          else:
              outfile.write('/>%s' % (eol_, ))
      def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='MyDouble'):
          if self.MyAttr is not None and 'MyAttr' not in already_processed:
              already_processed.add('MyAttr')
              outfile.write(' MyAttr=%s' % (self.gds_encode(self.gds_format_string(quote_attrib(self.MyAttr), input_name='MyAttr')), ))
      def exportChildren(self, outfile, level, namespace_='', name_='MyDouble', fromsubclass_=False, pretty_print=True):
          pass
      def build(self, node):
          already_processed = set()
          self.buildAttributes(node, node.attrib, already_processed)
          self.valueOf_ = get_all_text_(node)
          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):
          value = find_attr_value_('MyAttr', node)
          if value is not None and 'MyAttr' not in already_processed:
              already_processed.add('MyAttr')
              self.MyAttr = value
      def buildChildren(self, child_, node, nodeName_, fromsubclass_=False):
          pass
  # end class MyDouble
  
  
  GDSClassesMapping = {
      'container': containerType,
      'mixedfactoid': mixedFactoidType,
      'simplefactoid': simpleFactoidType,
  }
  
  
  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):
      from StringIO import StringIO
      parser = None
      doc = parsexml_(StringIO(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 extensions2_sup import *\n\n')
  ##         sys.stdout.write('import extensions2_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__ = [
      "BaseType",
      "DerivedType",
      "ExtremeDate",
      "MyBoolean",
      "MyDouble",
      "MyFloat",
      "MyInteger",
      "SpecialDate",
      "containerType",
      "mixedFactoidType",
      "simpleFactoidType",
      "singleExtremeDate"
  ]
  