#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2011,2012,2013 American Registry for Internet Numbers
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
# IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#
# Generated Sat Aug 31 15:00:09 2013 by generateDS.py version 2.10a.
#

import sys
import getopt
import re as re_
import base64
import datetime as datetime_

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


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

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

try:
    from generatedssuper import GeneratedsSuper
except ImportError, exp:

    class GeneratedsSuper(object):
        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, input_name=''):
            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, input_name=''):
            return input_data
        def gds_format_integer(self, input_data, input_name=''):
            return '%d' % input_data
        def gds_validate_integer(self, input_data, node, input_name=''):
            return input_data
        def gds_format_integer_list(self, input_data, input_name=''):
            return '%s' % input_data
        def gds_validate_integer_list(self, input_data, node, input_name=''):
            values = input_data.split()
            for value in values:
                try:
                    float(value)
                except (TypeError, ValueError):
                    raise_parse_error(node, 'Requires sequence of integers')
            return input_data
        def gds_format_float(self, input_data, input_name=''):
            return '%f' % input_data
        def gds_validate_float(self, input_data, node, input_name=''):
            return input_data
        def gds_format_float_list(self, input_data, input_name=''):
            return '%s' % input_data
        def gds_validate_float_list(self, input_data, node, input_name=''):
            values = input_data.split()
            for value in values:
                try:
                    float(value)
                except (TypeError, ValueError):
                    raise_parse_error(node, 'Requires sequence of floats')
            return input_data
        def gds_format_double(self, input_data, input_name=''):
            return '%e' % input_data
        def gds_validate_double(self, input_data, node, input_name=''):
            return input_data
        def gds_format_double_list(self, input_data, input_name=''):
            return '%s' % input_data
        def gds_validate_double_list(self, input_data, node, input_name=''):
            values = input_data.split()
            for value in values:
                try:
                    float(value)
                except (TypeError, ValueError):
                    raise_parse_error(node, 'Requires sequence of doubles')
            return input_data
        def gds_format_boolean(self, input_data, input_name=''):
            return ('%s' % input_data).lower()
        def gds_validate_boolean(self, input_data, node, input_name=''):
            return input_data
        def gds_format_boolean_list(self, input_data, input_name=''):
            return '%s' % input_data
        def gds_validate_boolean_list(self, input_data, node, input_name=''):
            values = input_data.split()
            for value in values:
                if value not in ('true', '1', 'false', '0', ):
                    raise_parse_error(
                        node,
                        'Requires sequence of booleans '
                        '("true", "1", "false", "0")')
            return input_data
        def gds_validate_datetime(self, input_data, node, 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, 'GMT')
                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, '%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, 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, 'GMT')
                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, 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
        @classmethod
        def gds_parse_time(cls, input_data):
            tz = None
            if input_data[-1] == 'Z':
                tz = GeneratedsSuper._FixedOffsetTZ(0, 'GMT')
                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()))


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

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

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

#
# Globals
#

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

#
# Support/utility functions.
#


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


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


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


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


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


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


class GDSParseError(Exception):
    pass


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


class MixedContainer:
    # Constants for category:
    CategoryNone = 0
    CategoryText = 1
    CategorySimple = 2
    CategoryComplex = 3
    # Constants for content_type:
    TypeNone = 0
    TypeText = 1
    TypeString = 2
    TypeInteger = 3
    TypeFloat = 4
    TypeDecimal = 5
    TypeDouble = 6
    TypeBoolean = 7
    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)
    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 poc(GeneratedsSuper):
    subclass = None
    superclass = None
    def __init__(self, termsOfUse=None, registrationDate=None, ref=None, note=None, asns=None, city=None, companyName=None, iso3166_1=None, firstName=None, handle=None, lastName=None, emails=None, middleName=None, nets=None, orgs=None, phones=None, postalCode=None, comment=None, iso3166_2=None, streetAddress=None, updateDate=None, anytypeobjs_=None):
        self.termsOfUse = _cast(None, termsOfUse)
        if isinstance(registrationDate, basestring):
            initvalue_ = datetime_.datetime.strptime(registrationDate, '%Y-%m-%dT%H:%M:%S')
        else:
            initvalue_ = registrationDate
        self.registrationDate = initvalue_
        self.ref = ref
        self.note = note
        self.asns = asns
        self.city = city
        self.companyName = companyName
        self.iso3166_1 = iso3166_1
        self.firstName = firstName
        self.handle = handle
        self.lastName = lastName
        self.emails = emails
        self.middleName = middleName
        self.nets = nets
        self.orgs = orgs
        self.phones = phones
        self.postalCode = postalCode
        self.comment = comment
        self.iso3166_2 = iso3166_2
        self.streetAddress = streetAddress
        if isinstance(updateDate, basestring):
            initvalue_ = datetime_.datetime.strptime(updateDate, '%Y-%m-%dT%H:%M:%S')
        else:
            initvalue_ = updateDate
        self.updateDate = initvalue_
        self.anytypeobjs_ = anytypeobjs_
    def factory(*args_, **kwargs_):
        if poc.subclass:
            return poc.subclass(*args_, **kwargs_)
        else:
            return poc(*args_, **kwargs_)
    factory = staticmethod(factory)
    def get_registrationDate(self): return self.registrationDate
    def set_registrationDate(self, registrationDate): self.registrationDate = registrationDate
    def get_ref(self): return self.ref
    def set_ref(self, ref): self.ref = ref
    def get_note(self): return self.note
    def set_note(self, note): self.note = note
    def get_asns(self): return self.asns
    def set_asns(self, asns): self.asns = asns
    def get_city(self): return self.city
    def set_city(self, city): self.city = city
    def get_companyName(self): return self.companyName
    def set_companyName(self, companyName): self.companyName = companyName
    def get_iso3166_1(self): return self.iso3166_1
    def set_iso3166_1(self, iso3166_1): self.iso3166_1 = iso3166_1
    def get_firstName(self): return self.firstName
    def set_firstName(self, firstName): self.firstName = firstName
    def get_handle(self): return self.handle
    def set_handle(self, handle): self.handle = handle
    def get_lastName(self): return self.lastName
    def set_lastName(self, lastName): self.lastName = lastName
    def get_emails(self): return self.emails
    def set_emails(self, emails): self.emails = emails
    def get_middleName(self): return self.middleName
    def set_middleName(self, middleName): self.middleName = middleName
    def get_nets(self): return self.nets
    def set_nets(self, nets): self.nets = nets
    def get_orgs(self): return self.orgs
    def set_orgs(self, orgs): self.orgs = orgs
    def get_phones(self): return self.phones
    def set_phones(self, phones): self.phones = phones
    def get_postalCode(self): return self.postalCode
    def set_postalCode(self, postalCode): self.postalCode = postalCode
    def get_comment(self): return self.comment
    def set_comment(self, comment): self.comment = comment
    def get_iso3166_2(self): return self.iso3166_2
    def set_iso3166_2(self, iso3166_2): self.iso3166_2 = iso3166_2
    def get_streetAddress(self): return self.streetAddress
    def set_streetAddress(self, streetAddress): self.streetAddress = streetAddress
    def get_updateDate(self): return self.updateDate
    def set_updateDate(self, updateDate): self.updateDate = updateDate
    def get_anytypeobjs_(self): return self.anytypeobjs_
    def set_anytypeobjs_(self, anytypeobjs_): self.anytypeobjs_ = anytypeobjs_
    def get_termsOfUse(self): return self.termsOfUse
    def set_termsOfUse(self, termsOfUse): self.termsOfUse = termsOfUse
    def hasContent_(self):
        if (
            self.registrationDate is not None or
            self.ref is not None or
            self.note is not None or
            self.asns is not None or
            self.city is not None or
            self.companyName is not None or
            self.iso3166_1 is not None or
            self.firstName is not None or
            self.handle is not None or
            self.lastName is not None or
            self.emails is not None or
            self.middleName is not None or
            self.nets is not None or
            self.orgs is not None or
            self.phones is not None or
            self.postalCode is not None or
            self.comment is not None or
            self.iso3166_2 is not None or
            self.streetAddress is not None or
            self.updateDate is not None or
            self.anytypeobjs_ is not None
        ):
            return True
        else:
            return False
    def export(self, outfile, level, namespace_='v1:', name_='poc', namespacedef_='', pretty_print=True):
        if pretty_print:
            eol_ = '\n'
        else:
            eol_ = ''
        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_='poc')
        if self.hasContent_():
            outfile.write('>%s' % (eol_, ))
            self.exportChildren(outfile, level + 1, namespace_, name_, 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_='v1:', name_='poc'):
        if self.termsOfUse is not None and 'termsOfUse' not in already_processed:
            already_processed.add('termsOfUse')
            outfile.write(' termsOfUse=%s' % (self.gds_format_string(quote_attrib(self.termsOfUse).encode(ExternalEncoding), input_name='termsOfUse'), ))
    def exportChildren(self, outfile, level, namespace_='v1:', name_='poc', fromsubclass_=False, pretty_print=True):
        if pretty_print:
            eol_ = '\n'
        else:
            eol_ = ''
        if self.registrationDate is not None:
            showIndent(outfile, level, pretty_print)
            outfile.write('<%sregistrationDate>%s</%sregistrationDate>%s' % (namespace_, self.gds_format_datetime(self.registrationDate, input_name='registrationDate'), namespace_, eol_))
        if self.ref is not None:
            showIndent(outfile, level, pretty_print)
            outfile.write('<%sref>%s</%sref>%s' % (namespace_, self.gds_format_string(quote_xml(self.ref).encode(ExternalEncoding), input_name='ref'), namespace_, eol_))
        if self.note is not None:
            showIndent(outfile, level, pretty_print)
            outfile.write('<%snote>%s</%snote>%s' % (namespace_, self.gds_format_string(quote_xml(self.note).encode(ExternalEncoding), input_name='note'), namespace_, eol_))
        if self.asns is not None:
            self.asns.export(outfile, level, namespace_, name_='asns', pretty_print=pretty_print)
        if self.city is not None:
            showIndent(outfile, level, pretty_print)
            outfile.write('<%scity>%s</%scity>%s' % (namespace_, self.gds_format_string(quote_xml(self.city).encode(ExternalEncoding), input_name='city'), namespace_, eol_))
        if self.companyName is not None:
            showIndent(outfile, level, pretty_print)
            outfile.write('<%scompanyName>%s</%scompanyName>%s' % (namespace_, self.gds_format_string(quote_xml(self.companyName).encode(ExternalEncoding), input_name='companyName'), namespace_, eol_))
        if self.iso3166_1 is not None:
            self.iso3166_1.export(outfile, level, namespace_, name_='iso3166-1', pretty_print=pretty_print)
        if self.firstName is not None:
            showIndent(outfile, level, pretty_print)
            outfile.write('<%sfirstName>%s</%sfirstName>%s' % (namespace_, self.gds_format_string(quote_xml(self.firstName).encode(ExternalEncoding), input_name='firstName'), namespace_, eol_))
        if self.handle is not None:
            showIndent(outfile, level, pretty_print)
            outfile.write('<%shandle>%s</%shandle>%s' % (namespace_, self.gds_format_string(quote_xml(self.handle).encode(ExternalEncoding), input_name='handle'), namespace_, eol_))
        if self.lastName is not None:
            showIndent(outfile, level, pretty_print)
            outfile.write('<%slastName>%s</%slastName>%s' % (namespace_, self.gds_format_string(quote_xml(self.lastName).encode(ExternalEncoding), input_name='lastName'), namespace_, eol_))
        if self.emails is not None:
            self.emails.export(outfile, level, namespace_, name_='emails', pretty_print=pretty_print)
        if self.middleName is not None:
            showIndent(outfile, level, pretty_print)
            outfile.write('<%smiddleName>%s</%smiddleName>%s' % (namespace_, self.gds_format_string(quote_xml(self.middleName).encode(ExternalEncoding), input_name='middleName'), namespace_, eol_))
        if self.nets is not None:
            self.nets.export(outfile, level, namespace_, name_='nets', pretty_print=pretty_print)
        if self.orgs is not None:
            self.orgs.export(outfile, level, namespace_, name_='orgs', pretty_print=pretty_print)
        if self.phones is not None:
            self.phones.export(outfile, level, namespace_, name_='phones', pretty_print=pretty_print)
        if self.postalCode is not None:
            showIndent(outfile, level, pretty_print)
            outfile.write('<%spostalCode>%s</%spostalCode>%s' % (namespace_, self.gds_format_string(quote_xml(self.postalCode).encode(ExternalEncoding), input_name='postalCode'), namespace_, eol_))
        if self.comment is not None:
            self.comment.export(outfile, level, namespace_, name_='comment', pretty_print=pretty_print)
        if self.iso3166_2 is not None:
            showIndent(outfile, level, pretty_print)
            outfile.write('<%siso3166-2>%s</%siso3166-2>%s' % (namespace_, self.gds_format_string(quote_xml(self.iso3166_2).encode(ExternalEncoding), input_name='iso3166-2'), namespace_, eol_))
        if self.streetAddress is not None:
            self.streetAddress.export(outfile, level, namespace_, name_='streetAddress', pretty_print=pretty_print)
        if self.updateDate is not None:
            showIndent(outfile, level, pretty_print)
            outfile.write('<%supdateDate>%s</%supdateDate>%s' % (namespace_, self.gds_format_datetime(self.updateDate, input_name='updateDate'), namespace_, eol_))
        if self.anytypeobjs_ is not None:
            self.anytypeobjs_.export(outfile, level, namespace_, pretty_print=pretty_print)
    def exportLiteral(self, outfile, level, name_='poc'):
        level += 1
        already_processed = set()
        self.exportLiteralAttributes(outfile, level, already_processed, name_)
        if self.hasContent_():
            self.exportLiteralChildren(outfile, level, name_)
    def exportLiteralAttributes(self, outfile, level, already_processed, name_):
        if self.termsOfUse is not None and 'termsOfUse' not in already_processed:
            already_processed.add('termsOfUse')
            showIndent(outfile, level)
            outfile.write('termsOfUse="%s",\n' % (self.termsOfUse,))
    def exportLiteralChildren(self, outfile, level, name_):
        if self.registrationDate is not None:
            showIndent(outfile, level)
            outfile.write('registrationDate=model_.GeneratedsSuper.gds_parse_datetime("%s"),\n' % self.gds_format_datetime(self.registrationDate, input_name='registrationDate'))
        if self.ref is not None:
            showIndent(outfile, level)
            outfile.write('ref=%s,\n' % quote_python(self.ref).encode(ExternalEncoding))
        if self.note is not None:
            showIndent(outfile, level)
            outfile.write('note=%s,\n' % quote_python(self.note).encode(ExternalEncoding))
        if self.asns is not None:
            showIndent(outfile, level)
            outfile.write('asns=model_.asns(\n')
            self.asns.exportLiteral(outfile, level)
            showIndent(outfile, level)
            outfile.write('),\n')
        if self.city is not None:
            showIndent(outfile, level)
            outfile.write('city=%s,\n' % quote_python(self.city).encode(ExternalEncoding))
        if self.companyName is not None:
            showIndent(outfile, level)
            outfile.write('companyName=%s,\n' % quote_python(self.companyName).encode(ExternalEncoding))
        if self.iso3166_1 is not None:
            showIndent(outfile, level)
            outfile.write('iso3166_1=model_.iso3166_1(\n')
            self.iso3166_1.exportLiteral(outfile, level, name_='iso3166_1')
            showIndent(outfile, level)
            outfile.write('),\n')
        if self.firstName is not None:
            showIndent(outfile, level)
            outfile.write('firstName=%s,\n' % quote_python(self.firstName).encode(ExternalEncoding))
        if self.handle is not None:
            showIndent(outfile, level)
            outfile.write('handle=%s,\n' % quote_python(self.handle).encode(ExternalEncoding))
        if self.lastName is not None:
            showIndent(outfile, level)
            outfile.write('lastName=%s,\n' % quote_python(self.lastName).encode(ExternalEncoding))
        if self.emails is not None:
            showIndent(outfile, level)
            outfile.write('emails=model_.emails(\n')
            self.emails.exportLiteral(outfile, level)
            showIndent(outfile, level)
            outfile.write('),\n')
        if self.middleName is not None:
            showIndent(outfile, level)
            outfile.write('middleName=%s,\n' % quote_python(self.middleName).encode(ExternalEncoding))
        if self.nets is not None:
            showIndent(outfile, level)
            outfile.write('nets=model_.nets(\n')
            self.nets.exportLiteral(outfile, level)
            showIndent(outfile, level)
            outfile.write('),\n')
        if self.orgs is not None:
            showIndent(outfile, level)
            outfile.write('orgs=model_.orgs(\n')
            self.orgs.exportLiteral(outfile, level)
            showIndent(outfile, level)
            outfile.write('),\n')
        if self.phones is not None:
            showIndent(outfile, level)
            outfile.write('phones=model_.phones(\n')
            self.phones.exportLiteral(outfile, level)
            showIndent(outfile, level)
            outfile.write('),\n')
        if self.postalCode is not None:
            showIndent(outfile, level)
            outfile.write('postalCode=%s,\n' % quote_python(self.postalCode).encode(ExternalEncoding))
        if self.comment is not None:
            showIndent(outfile, level)
            outfile.write('comment=model_.comment(\n')
            self.comment.exportLiteral(outfile, level)
            showIndent(outfile, level)
            outfile.write('),\n')
        if self.iso3166_2 is not None:
            showIndent(outfile, level)
            outfile.write('iso3166_2=%s,\n' % quote_python(self.iso3166_2).encode(ExternalEncoding))
        if self.streetAddress is not None:
            showIndent(outfile, level)
            outfile.write('streetAddress=model_.streetAddress(\n')
            self.streetAddress.exportLiteral(outfile, level)
            showIndent(outfile, level)
            outfile.write('),\n')
        if self.updateDate is not None:
            showIndent(outfile, level)
            outfile.write('updateDate=model_.GeneratedsSuper.gds_parse_datetime("%s"),\n' % self.gds_format_datetime(self.updateDate, input_name='updateDate'))
        if self.anytypeobjs_ is not None:
            showIndent(outfile, level)
            outfile.write('anytypeobjs_=model_.anytypeobjs_(\n')
            self.anytypeobjs_.exportLiteral(outfile, level)
            showIndent(outfile, level)
            outfile.write('),\n')
    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_)
    def buildAttributes(self, node, attrs, already_processed):
        value = find_attr_value_('termsOfUse', node)
        if value is not None and 'termsOfUse' not in already_processed:
            already_processed.add('termsOfUse')
            self.termsOfUse = value
    def buildChildren(self, child_, node, nodeName_, fromsubclass_=False):
        if nodeName_ == 'registrationDate':
            sval_ = child_.text
            dval_ = self.gds_parse_datetime(sval_)
            self.registrationDate = dval_
        elif nodeName_ == 'ref':
            ref_ = child_.text
            ref_ = self.gds_validate_string(ref_, node, 'ref')
            self.ref = ref_
        elif nodeName_ == 'note':
            note_ = child_.text
            note_ = self.gds_validate_string(note_, node, 'note')
            self.note = note_
        elif nodeName_ == 'asns':
            obj_ = asns.factory()
            obj_.build(child_)
            self.set_asns(obj_)
        elif nodeName_ == 'city':
            city_ = child_.text
            city_ = self.gds_validate_string(city_, node, 'city')
            self.city = city_
        elif nodeName_ == 'companyName':
            companyName_ = child_.text
            companyName_ = self.gds_validate_string(companyName_, node, 'companyName')
            self.companyName = companyName_
        elif nodeName_ == 'iso3166-1':
            obj_ = iso3166_1.factory()
            obj_.build(child_)
            self.set_iso3166_1(obj_)
        elif nodeName_ == 'firstName':
            firstName_ = child_.text
            firstName_ = self.gds_validate_string(firstName_, node, 'firstName')
            self.firstName = firstName_
        elif nodeName_ == 'handle':
            handle_ = child_.text
            handle_ = self.gds_validate_string(handle_, node, 'handle')
            self.handle = handle_
        elif nodeName_ == 'lastName':
            lastName_ = child_.text
            lastName_ = self.gds_validate_string(lastName_, node, 'lastName')
            self.lastName = lastName_
        elif nodeName_ == 'emails':
            obj_ = emails.factory()
            obj_.build(child_)
            self.set_emails(obj_)
        elif nodeName_ == 'middleName':
            middleName_ = child_.text
            middleName_ = self.gds_validate_string(middleName_, node, 'middleName')
            self.middleName = middleName_
        elif nodeName_ == 'nets':
            obj_ = nets.factory()
            obj_.build(child_)
            self.set_nets(obj_)
        elif nodeName_ == 'orgs':
            obj_ = orgs.factory()
            obj_.build(child_)
            self.set_orgs(obj_)
        elif nodeName_ == 'phones':
            obj_ = phone.factory()
            obj_.build(child_)
            self.set_phones(obj_)
        elif nodeName_ == 'postalCode':
            postalCode_ = child_.text
            postalCode_ = self.gds_validate_string(postalCode_, node, 'postalCode')
            self.postalCode = postalCode_
        elif nodeName_ == 'comment':
            obj_ = comment.factory()
            obj_.build(child_)
            self.set_comment(obj_)
        elif nodeName_ == 'iso3166-2':
            iso3166_2_ = child_.text
            iso3166_2_ = self.gds_validate_string(iso3166_2_, node, 'iso3166_2')
            self.iso3166_2 = iso3166_2_
        elif nodeName_ == 'streetAddress':
            obj_ = streetAddress.factory()
            obj_.build(child_)
            self.set_streetAddress(obj_)
        elif nodeName_ == 'updateDate':
            sval_ = child_.text
            dval_ = self.gds_parse_datetime(sval_)
            self.updateDate = dval_
        else:
            obj_ = self.gds_build_any(child_, 'poc')
            if obj_ is not None:
                self.set_anytypeobjs_(obj_)
# end class poc


class asns(GeneratedsSuper):
    subclass = None
    superclass = None
    def __init__(self, termsOfUse=None, limitExceeded=None, asnRef=None, anytypeobjs_=None):
        self.termsOfUse = _cast(None, termsOfUse)
        self.limitExceeded = limitExceeded
        self.asnRef = asnRef
        self.anytypeobjs_ = anytypeobjs_
    def factory(*args_, **kwargs_):
        if asns.subclass:
            return asns.subclass(*args_, **kwargs_)
        else:
            return asns(*args_, **kwargs_)
    factory = staticmethod(factory)
    def get_limitExceeded(self): return self.limitExceeded
    def set_limitExceeded(self, limitExceeded): self.limitExceeded = limitExceeded
    def get_asnRef(self): return self.asnRef
    def set_asnRef(self, asnRef): self.asnRef = asnRef
    def get_anytypeobjs_(self): return self.anytypeobjs_
    def set_anytypeobjs_(self, anytypeobjs_): self.anytypeobjs_ = anytypeobjs_
    def get_termsOfUse(self): return self.termsOfUse
    def set_termsOfUse(self, termsOfUse): self.termsOfUse = termsOfUse
    def hasContent_(self):
        if (
            self.limitExceeded is not None or
            self.asnRef is not None or
            self.anytypeobjs_ is not None
        ):
            return True
        else:
            return False
    def export(self, outfile, level, namespace_='v1:', name_='asns', namespacedef_='', pretty_print=True):
        if pretty_print:
            eol_ = '\n'
        else:
            eol_ = ''
        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_='asns')
        if self.hasContent_():
            outfile.write('>%s' % (eol_, ))
            self.exportChildren(outfile, level + 1, namespace_, name_, 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_='v1:', name_='asns'):
        if self.termsOfUse is not None and 'termsOfUse' not in already_processed:
            already_processed.add('termsOfUse')
            outfile.write(' termsOfUse=%s' % (self.gds_format_string(quote_attrib(self.termsOfUse).encode(ExternalEncoding), input_name='termsOfUse'), ))
    def exportChildren(self, outfile, level, namespace_='v1:', name_='asns', fromsubclass_=False, pretty_print=True):
        if pretty_print:
            eol_ = '\n'
        else:
            eol_ = ''
        if self.limitExceeded is not None:
            self.limitExceeded.export(outfile, level, namespace_, name_='limitExceeded', pretty_print=pretty_print)
        if self.asnRef is not None:
            self.asnRef.export(outfile, level, namespace_, name_='asnRef', pretty_print=pretty_print)
        if self.anytypeobjs_ is not None:
            self.anytypeobjs_.export(outfile, level, namespace_, pretty_print=pretty_print)
    def exportLiteral(self, outfile, level, name_='asns'):
        level += 1
        already_processed = set()
        self.exportLiteralAttributes(outfile, level, already_processed, name_)
        if self.hasContent_():
            self.exportLiteralChildren(outfile, level, name_)
    def exportLiteralAttributes(self, outfile, level, already_processed, name_):
        if self.termsOfUse is not None and 'termsOfUse' not in already_processed:
            already_processed.add('termsOfUse')
            showIndent(outfile, level)
            outfile.write('termsOfUse="%s",\n' % (self.termsOfUse,))
    def exportLiteralChildren(self, outfile, level, name_):
        if self.limitExceeded is not None:
            showIndent(outfile, level)
            outfile.write('limitExceeded=model_.limitExceeded(\n')
            self.limitExceeded.exportLiteral(outfile, level)
            showIndent(outfile, level)
            outfile.write('),\n')
        if self.asnRef is not None:
            showIndent(outfile, level)
            outfile.write('asnRef=model_.asnRef(\n')
            self.asnRef.exportLiteral(outfile, level)
            showIndent(outfile, level)
            outfile.write('),\n')
        if self.anytypeobjs_ is not None:
            showIndent(outfile, level)
            outfile.write('anytypeobjs_=model_.anytypeobjs_(\n')
            self.anytypeobjs_.exportLiteral(outfile, level)
            showIndent(outfile, level)
            outfile.write('),\n')
    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_)
    def buildAttributes(self, node, attrs, already_processed):
        value = find_attr_value_('termsOfUse', node)
        if value is not None and 'termsOfUse' not in already_processed:
            already_processed.add('termsOfUse')
            self.termsOfUse = value
    def buildChildren(self, child_, node, nodeName_, fromsubclass_=False):
        if nodeName_ == 'limitExceeded':
            obj_ = limitExceeded.factory()
            obj_.build(child_)
            self.set_limitExceeded(obj_)
        elif nodeName_ == 'asnRef':
            obj_ = asnRef.factory()
            obj_.build(child_)
            self.set_asnRef(obj_)
        else:
            obj_ = self.gds_build_any(child_, 'asns')
            if obj_ is not None:
                self.set_anytypeobjs_(obj_)
# end class asns


class iso3166_1(GeneratedsSuper):
    subclass = None
    superclass = None
    def __init__(self, code2=None, code3=None, name=None, e164=None):
        self.code2 = code2
        self.code3 = code3
        self.name = name
        self.e164 = e164
    def factory(*args_, **kwargs_):
        if iso3166_1.subclass:
            return iso3166_1.subclass(*args_, **kwargs_)
        else:
            return iso3166_1(*args_, **kwargs_)
    factory = staticmethod(factory)
    def get_code2(self): return self.code2
    def set_code2(self, code2): self.code2 = code2
    def get_code3(self): return self.code3
    def set_code3(self, code3): self.code3 = code3
    def get_name(self): return self.name
    def set_name(self, name): self.name = name
    def get_e164(self): return self.e164
    def set_e164(self, e164): self.e164 = e164
    def hasContent_(self):
        if (
            self.code2 is not None or
            self.code3 is not None or
            self.name is not None or
            self.e164 is not None
        ):
            return True
        else:
            return False
    def export(self, outfile, level, namespace_='v1:', name_='iso3166-1', namespacedef_='', pretty_print=True):
        if pretty_print:
            eol_ = '\n'
        else:
            eol_ = ''
        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_='iso3166-1')
        if self.hasContent_():
            outfile.write('>%s' % (eol_, ))
            self.exportChildren(outfile, level + 1, namespace_, name_, 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_='v1:', name_='iso3166-1'):
        pass
    def exportChildren(self, outfile, level, namespace_='v1:', name_='iso3166-1', fromsubclass_=False, pretty_print=True):
        if pretty_print:
            eol_ = '\n'
        else:
            eol_ = ''
        if self.code2 is not None:
            showIndent(outfile, level, pretty_print)
            outfile.write('<%scode2>%s</%scode2>%s' % (namespace_, self.gds_format_string(quote_xml(self.code2).encode(ExternalEncoding), input_name='code2'), namespace_, eol_))
        if self.code3 is not None:
            showIndent(outfile, level, pretty_print)
            outfile.write('<%scode3>%s</%scode3>%s' % (namespace_, self.gds_format_string(quote_xml(self.code3).encode(ExternalEncoding), input_name='code3'), namespace_, eol_))
        if self.name is not None:
            showIndent(outfile, level, pretty_print)
            outfile.write('<%sname>%s</%sname>%s' % (namespace_, self.gds_format_string(quote_xml(self.name).encode(ExternalEncoding), input_name='name'), namespace_, eol_))
        if self.e164 is not None:
            showIndent(outfile, level, pretty_print)
            outfile.write('<%se164>%s</%se164>%s' % (namespace_, self.gds_format_string(quote_xml(self.e164).encode(ExternalEncoding), input_name='e164'), namespace_, eol_))
    def exportLiteral(self, outfile, level, name_='iso3166-1'):
        level += 1
        already_processed = set()
        self.exportLiteralAttributes(outfile, level, already_processed, name_)
        if self.hasContent_():
            self.exportLiteralChildren(outfile, level, name_)
    def exportLiteralAttributes(self, outfile, level, already_processed, name_):
        pass
    def exportLiteralChildren(self, outfile, level, name_):
        if self.code2 is not None:
            showIndent(outfile, level)
            outfile.write('code2=%s,\n' % quote_python(self.code2).encode(ExternalEncoding))
        if self.code3 is not None:
            showIndent(outfile, level)
            outfile.write('code3=%s,\n' % quote_python(self.code3).encode(ExternalEncoding))
        if self.name is not None:
            showIndent(outfile, level)
            outfile.write('name=%s,\n' % quote_python(self.name).encode(ExternalEncoding))
        if self.e164 is not None:
            showIndent(outfile, level)
            outfile.write('e164=%s,\n' % quote_python(self.e164).encode(ExternalEncoding))
    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_)
    def buildAttributes(self, node, attrs, already_processed):
        pass
    def buildChildren(self, child_, node, nodeName_, fromsubclass_=False):
        if nodeName_ == 'code2':
            code2_ = child_.text
            code2_ = self.gds_validate_string(code2_, node, 'code2')
            self.code2 = code2_
        elif nodeName_ == 'code3':
            code3_ = child_.text
            code3_ = self.gds_validate_string(code3_, node, 'code3')
            self.code3 = code3_
        elif nodeName_ == 'name':
            name_ = child_.text
            name_ = self.gds_validate_string(name_, node, 'name')
            self.name = name_
        elif nodeName_ == 'e164':
            e164_ = child_.text
            e164_ = self.gds_validate_string(e164_, node, 'e164')
            self.e164 = e164_
# end class iso3166_1


class emails(GeneratedsSuper):
    subclass = None
    superclass = None
    def __init__(self, email=None):
        if email is None:
            self.email = []
        else:
            self.email = email
    def factory(*args_, **kwargs_):
        if emails.subclass:
            return emails.subclass(*args_, **kwargs_)
        else:
            return emails(*args_, **kwargs_)
    factory = staticmethod(factory)
    def get_email(self): return self.email
    def set_email(self, email): self.email = email
    def add_email(self, value): self.email.append(value)
    def insert_email(self, index, value): self.email[index] = value
    def hasContent_(self):
        if (
            self.email
        ):
            return True
        else:
            return False
    def export(self, outfile, level, namespace_='v1:', name_='emails', namespacedef_='', pretty_print=True):
        if pretty_print:
            eol_ = '\n'
        else:
            eol_ = ''
        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_='emails')
        if self.hasContent_():
            outfile.write('>%s' % (eol_, ))
            self.exportChildren(outfile, level + 1, namespace_, name_, 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_='v1:', name_='emails'):
        pass
    def exportChildren(self, outfile, level, namespace_='v1:', name_='emails', fromsubclass_=False, pretty_print=True):
        if pretty_print:
            eol_ = '\n'
        else:
            eol_ = ''
        for email_ in self.email:
            showIndent(outfile, level, pretty_print)
            outfile.write('<%semail>%s</%semail>%s' % (namespace_, self.gds_format_string(quote_xml(email_).encode(ExternalEncoding), input_name='email'), namespace_, eol_))
    def exportLiteral(self, outfile, level, name_='emails'):
        level += 1
        already_processed = set()
        self.exportLiteralAttributes(outfile, level, already_processed, name_)
        if self.hasContent_():
            self.exportLiteralChildren(outfile, level, name_)
    def exportLiteralAttributes(self, outfile, level, already_processed, name_):
        pass
    def exportLiteralChildren(self, outfile, level, name_):
        showIndent(outfile, level)
        outfile.write('email=[\n')
        level += 1
        for email_ in self.email:
            showIndent(outfile, level)
            outfile.write('%s,\n' % quote_python(email_).encode(ExternalEncoding))
        level -= 1
        showIndent(outfile, level)
        outfile.write('],\n')
    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_)
    def buildAttributes(self, node, attrs, already_processed):
        pass
    def buildChildren(self, child_, node, nodeName_, fromsubclass_=False):
        if nodeName_ == 'email':
            email_ = child_.text
            email_ = self.gds_validate_string(email_, node, 'email')
            self.email.append(email_)
# end class emails


class nets(GeneratedsSuper):
    subclass = None
    superclass = None
    def __init__(self, termsOfUse=None, limitExceeded=None, netRef=None, anytypeobjs_=None):
        self.termsOfUse = _cast(None, termsOfUse)
        self.limitExceeded = limitExceeded
        self.netRef = netRef
        self.anytypeobjs_ = anytypeobjs_
    def factory(*args_, **kwargs_):
        if nets.subclass:
            return nets.subclass(*args_, **kwargs_)
        else:
            return nets(*args_, **kwargs_)
    factory = staticmethod(factory)
    def get_limitExceeded(self): return self.limitExceeded
    def set_limitExceeded(self, limitExceeded): self.limitExceeded = limitExceeded
    def get_netRef(self): return self.netRef
    def set_netRef(self, netRef): self.netRef = netRef
    def get_anytypeobjs_(self): return self.anytypeobjs_
    def set_anytypeobjs_(self, anytypeobjs_): self.anytypeobjs_ = anytypeobjs_
    def get_termsOfUse(self): return self.termsOfUse
    def set_termsOfUse(self, termsOfUse): self.termsOfUse = termsOfUse
    def hasContent_(self):
        if (
            self.limitExceeded is not None or
            self.netRef is not None or
            self.anytypeobjs_ is not None
        ):
            return True
        else:
            return False
    def export(self, outfile, level, namespace_='v1:', name_='nets', namespacedef_='', pretty_print=True):
        if pretty_print:
            eol_ = '\n'
        else:
            eol_ = ''
        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_='nets')
        if self.hasContent_():
            outfile.write('>%s' % (eol_, ))
            self.exportChildren(outfile, level + 1, namespace_, name_, 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_='v1:', name_='nets'):
        if self.termsOfUse is not None and 'termsOfUse' not in already_processed:
            already_processed.add('termsOfUse')
            outfile.write(' termsOfUse=%s' % (self.gds_format_string(quote_attrib(self.termsOfUse).encode(ExternalEncoding), input_name='termsOfUse'), ))
    def exportChildren(self, outfile, level, namespace_='v1:', name_='nets', fromsubclass_=False, pretty_print=True):
        if pretty_print:
            eol_ = '\n'
        else:
            eol_ = ''
        if self.limitExceeded is not None:
            self.limitExceeded.export(outfile, level, namespace_, name_='limitExceeded', pretty_print=pretty_print)
        if self.netRef is not None:
            self.netRef.export(outfile, level, namespace_, name_='netRef', pretty_print=pretty_print)
        if self.anytypeobjs_ is not None:
            self.anytypeobjs_.export(outfile, level, namespace_, pretty_print=pretty_print)
    def exportLiteral(self, outfile, level, name_='nets'):
        level += 1
        already_processed = set()
        self.exportLiteralAttributes(outfile, level, already_processed, name_)
        if self.hasContent_():
            self.exportLiteralChildren(outfile, level, name_)
    def exportLiteralAttributes(self, outfile, level, already_processed, name_):
        if self.termsOfUse is not None and 'termsOfUse' not in already_processed:
            already_processed.add('termsOfUse')
            showIndent(outfile, level)
            outfile.write('termsOfUse="%s",\n' % (self.termsOfUse,))
    def exportLiteralChildren(self, outfile, level, name_):
        if self.limitExceeded is not None:
            showIndent(outfile, level)
            outfile.write('limitExceeded=model_.limitExceeded(\n')
            self.limitExceeded.exportLiteral(outfile, level)
            showIndent(outfile, level)
            outfile.write('),\n')
        if self.netRef is not None:
            showIndent(outfile, level)
            outfile.write('netRef=model_.netRef(\n')
            self.netRef.exportLiteral(outfile, level)
            showIndent(outfile, level)
            outfile.write('),\n')
        if self.anytypeobjs_ is not None:
            showIndent(outfile, level)
            outfile.write('anytypeobjs_=model_.anytypeobjs_(\n')
            self.anytypeobjs_.exportLiteral(outfile, level)
            showIndent(outfile, level)
            outfile.write('),\n')
    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_)
    def buildAttributes(self, node, attrs, already_processed):
        value = find_attr_value_('termsOfUse', node)
        if value is not None and 'termsOfUse' not in already_processed:
            already_processed.add('termsOfUse')
            self.termsOfUse = value
    def buildChildren(self, child_, node, nodeName_, fromsubclass_=False):
        if nodeName_ == 'limitExceeded':
            obj_ = limitExceeded.factory()
            obj_.build(child_)
            self.set_limitExceeded(obj_)
        elif nodeName_ == 'netRef':
            obj_ = netRef.factory()
            obj_.build(child_)
            self.set_netRef(obj_)
        else:
            obj_ = self.gds_build_any(child_, 'nets')
            if obj_ is not None:
                self.set_anytypeobjs_(obj_)
# end class nets


class orgs(GeneratedsSuper):
    subclass = None
    superclass = None
    def __init__(self, termsOfUse=None, limitExceeded=None, orgPocLinkRef=None):
        self.termsOfUse = _cast(None, termsOfUse)
        self.limitExceeded = limitExceeded
        if orgPocLinkRef is None:
            self.orgPocLinkRef = []
        else:
            self.orgPocLinkRef = orgPocLinkRef
    def factory(*args_, **kwargs_):
        if orgs.subclass:
            return orgs.subclass(*args_, **kwargs_)
        else:
            return orgs(*args_, **kwargs_)
    factory = staticmethod(factory)
    def get_limitExceeded(self): return self.limitExceeded
    def set_limitExceeded(self, limitExceeded): self.limitExceeded = limitExceeded
    def get_orgPocLinkRef(self): return self.orgPocLinkRef
    def set_orgPocLinkRef(self, orgPocLinkRef): self.orgPocLinkRef = orgPocLinkRef
    def add_orgPocLinkRef(self, value): self.orgPocLinkRef.append(value)
    def insert_orgPocLinkRef(self, index, value): self.orgPocLinkRef[index] = value
    def get_termsOfUse(self): return self.termsOfUse
    def set_termsOfUse(self, termsOfUse): self.termsOfUse = termsOfUse
    def hasContent_(self):
        if (
            self.limitExceeded is not None or
            self.orgPocLinkRef
        ):
            return True
        else:
            return False
    def export(self, outfile, level, namespace_='v1:', name_='orgs', namespacedef_='', pretty_print=True):
        if pretty_print:
            eol_ = '\n'
        else:
            eol_ = ''
        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_='orgs')
        if self.hasContent_():
            outfile.write('>%s' % (eol_, ))
            self.exportChildren(outfile, level + 1, namespace_, name_, 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_='v1:', name_='orgs'):
        if self.termsOfUse is not None and 'termsOfUse' not in already_processed:
            already_processed.add('termsOfUse')
            outfile.write(' termsOfUse=%s' % (self.gds_format_string(quote_attrib(self.termsOfUse).encode(ExternalEncoding), input_name='termsOfUse'), ))
    def exportChildren(self, outfile, level, namespace_='v1:', name_='orgs', fromsubclass_=False, pretty_print=True):
        if pretty_print:
            eol_ = '\n'
        else:
            eol_ = ''
        if self.limitExceeded is not None:
            self.limitExceeded.export(outfile, level, namespace_, name_='limitExceeded', pretty_print=pretty_print)
        for orgPocLinkRef_ in self.orgPocLinkRef:
            orgPocLinkRef_.export(outfile, level, namespace_, name_='orgPocLinkRef', pretty_print=pretty_print)
    def exportLiteral(self, outfile, level, name_='orgs'):
        level += 1
        already_processed = set()
        self.exportLiteralAttributes(outfile, level, already_processed, name_)
        if self.hasContent_():
            self.exportLiteralChildren(outfile, level, name_)
    def exportLiteralAttributes(self, outfile, level, already_processed, name_):
        if self.termsOfUse is not None and 'termsOfUse' not in already_processed:
            already_processed.add('termsOfUse')
            showIndent(outfile, level)
            outfile.write('termsOfUse="%s",\n' % (self.termsOfUse,))
    def exportLiteralChildren(self, outfile, level, name_):
        if self.limitExceeded is not None:
            showIndent(outfile, level)
            outfile.write('limitExceeded=model_.limitExceeded(\n')
            self.limitExceeded.exportLiteral(outfile, level)
            showIndent(outfile, level)
            outfile.write('),\n')
        showIndent(outfile, level)
        outfile.write('orgPocLinkRef=[\n')
        level += 1
        for orgPocLinkRef_ in self.orgPocLinkRef:
            showIndent(outfile, level)
            outfile.write('model_.orgPocLinkRef(\n')
            orgPocLinkRef_.exportLiteral(outfile, level)
            showIndent(outfile, level)
            outfile.write('),\n')
        level -= 1
        showIndent(outfile, level)
        outfile.write('],\n')
    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_)
    def buildAttributes(self, node, attrs, already_processed):
        value = find_attr_value_('termsOfUse', node)
        if value is not None and 'termsOfUse' not in already_processed:
            already_processed.add('termsOfUse')
            self.termsOfUse = value
    def buildChildren(self, child_, node, nodeName_, fromsubclass_=False):
        if nodeName_ == 'limitExceeded':
            obj_ = limitExceeded.factory()
            obj_.build(child_)
            self.set_limitExceeded(obj_)
        elif nodeName_ == 'orgPocLinkRef':
            obj_ = orgPocLinkRef.factory()
            obj_.build(child_)
            self.orgPocLinkRef.append(obj_)
# end class orgs


class comment(GeneratedsSuper):
    subclass = None
    superclass = None
    def __init__(self, line=None):
        if line is None:
            self.line = []
        else:
            self.line = line
    def factory(*args_, **kwargs_):
        if comment.subclass:
            return comment.subclass(*args_, **kwargs_)
        else:
            return comment(*args_, **kwargs_)
    factory = staticmethod(factory)
    def get_line(self): return self.line
    def set_line(self, line): self.line = line
    def add_line(self, value): self.line.append(value)
    def insert_line(self, index, value): self.line[index] = value
    def hasContent_(self):
        if (
            self.line
        ):
            return True
        else:
            return False
    def export(self, outfile, level, namespace_='v1:', name_='comment', namespacedef_='', pretty_print=True):
        if pretty_print:
            eol_ = '\n'
        else:
            eol_ = ''
        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_='comment')
        if self.hasContent_():
            outfile.write('>%s' % (eol_, ))
            self.exportChildren(outfile, level + 1, namespace_, name_, 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_='v1:', name_='comment'):
        pass
    def exportChildren(self, outfile, level, namespace_='v1:', name_='comment', fromsubclass_=False, pretty_print=True):
        if pretty_print:
            eol_ = '\n'
        else:
            eol_ = ''
        for line_ in self.line:
            line_.export(outfile, level, namespace_, name_='line', pretty_print=pretty_print)
    def exportLiteral(self, outfile, level, name_='comment'):
        level += 1
        already_processed = set()
        self.exportLiteralAttributes(outfile, level, already_processed, name_)
        if self.hasContent_():
            self.exportLiteralChildren(outfile, level, name_)
    def exportLiteralAttributes(self, outfile, level, already_processed, name_):
        pass
    def exportLiteralChildren(self, outfile, level, name_):
        showIndent(outfile, level)
        outfile.write('line=[\n')
        level += 1
        for line_ in self.line:
            showIndent(outfile, level)
            outfile.write('model_.line(\n')
            line_.exportLiteral(outfile, level)
            showIndent(outfile, level)
            outfile.write('),\n')
        level -= 1
        showIndent(outfile, level)
        outfile.write('],\n')
    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_)
    def buildAttributes(self, node, attrs, already_processed):
        pass
    def buildChildren(self, child_, node, nodeName_, fromsubclass_=False):
        if nodeName_ == 'line':
            obj_ = line.factory()
            obj_.build(child_)
            self.line.append(obj_)
# end class comment


class streetAddress(GeneratedsSuper):
    subclass = None
    superclass = None
    def __init__(self, line=None):
        if line is None:
            self.line = []
        else:
            self.line = line
    def factory(*args_, **kwargs_):
        if streetAddress.subclass:
            return streetAddress.subclass(*args_, **kwargs_)
        else:
            return streetAddress(*args_, **kwargs_)
    factory = staticmethod(factory)
    def get_line(self): return self.line
    def set_line(self, line): self.line = line
    def add_line(self, value): self.line.append(value)
    def insert_line(self, index, value): self.line[index] = value
    def hasContent_(self):
        if (
            self.line
        ):
            return True
        else:
            return False
    def export(self, outfile, level, namespace_='v1:', name_='streetAddress', namespacedef_='', pretty_print=True):
        if pretty_print:
            eol_ = '\n'
        else:
            eol_ = ''
        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_='streetAddress')
        if self.hasContent_():
            outfile.write('>%s' % (eol_, ))
            self.exportChildren(outfile, level + 1, namespace_, name_, 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_='v1:', name_='streetAddress'):
        pass
    def exportChildren(self, outfile, level, namespace_='v1:', name_='streetAddress', fromsubclass_=False, pretty_print=True):
        if pretty_print:
            eol_ = '\n'
        else:
            eol_ = ''
        for line_ in self.line:
            line_.export(outfile, level, namespace_, name_='line', pretty_print=pretty_print)
    def exportLiteral(self, outfile, level, name_='streetAddress'):
        level += 1
        already_processed = set()
        self.exportLiteralAttributes(outfile, level, already_processed, name_)
        if self.hasContent_():
            self.exportLiteralChildren(outfile, level, name_)
    def exportLiteralAttributes(self, outfile, level, already_processed, name_):
        pass
    def exportLiteralChildren(self, outfile, level, name_):
        showIndent(outfile, level)
        outfile.write('line=[\n')
        level += 1
        for line_ in self.line:
            showIndent(outfile, level)
            outfile.write('model_.line(\n')
            line_.exportLiteral(outfile, level)
            showIndent(outfile, level)
            outfile.write('),\n')
        level -= 1
        showIndent(outfile, level)
        outfile.write('],\n')
    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_)
    def buildAttributes(self, node, attrs, already_processed):
        pass
    def buildChildren(self, child_, node, nodeName_, fromsubclass_=False):
        if nodeName_ == 'line':
            obj_ = line.factory()
            obj_.build(child_)
            self.line.append(obj_)
# end class streetAddress


class limitExceeded(GeneratedsSuper):
    subclass = None
    superclass = None
    def __init__(self, limit=None, valueOf_=None):
        self.limit = _cast(int, limit)
        self.valueOf_ = valueOf_
    def factory(*args_, **kwargs_):
        if limitExceeded.subclass:
            return limitExceeded.subclass(*args_, **kwargs_)
        else:
            return limitExceeded(*args_, **kwargs_)
    factory = staticmethod(factory)
    def get_limit(self): return self.limit
    def set_limit(self, limit): self.limit = limit
    def get_valueOf_(self): return self.valueOf_
    def set_valueOf_(self, valueOf_): self.valueOf_ = valueOf_
    def hasContent_(self):
        if (
            self.valueOf_
        ):
            return True
        else:
            return False
    def export(self, outfile, level, namespace_='v1:', name_='limitExceeded', namespacedef_='', pretty_print=True):
        if pretty_print:
            eol_ = '\n'
        else:
            eol_ = ''
        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_='limitExceeded')
        if self.hasContent_():
            outfile.write('>')
            outfile.write(str(self.valueOf_).encode(ExternalEncoding))
            self.exportChildren(outfile, level + 1, namespace_, name_, 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_='v1:', name_='limitExceeded'):
        if self.limit is not None and 'limit' not in already_processed:
            already_processed.add('limit')
            outfile.write(' limit="%s"' % self.gds_format_integer(self.limit, input_name='limit'))
    def exportChildren(self, outfile, level, namespace_='v1:', name_='limitExceeded', fromsubclass_=False, pretty_print=True):
        pass
    def exportLiteral(self, outfile, level, name_='limitExceeded'):
        level += 1
        already_processed = set()
        self.exportLiteralAttributes(outfile, level, already_processed, name_)
        if self.hasContent_():
            self.exportLiteralChildren(outfile, level, name_)
        showIndent(outfile, level)
        outfile.write('valueOf_ = """%s""",\n' % (self.valueOf_,))
    def exportLiteralAttributes(self, outfile, level, already_processed, name_):
        if self.limit is not None and 'limit' not in already_processed:
            already_processed.add('limit')
            showIndent(outfile, level)
            outfile.write('limit=%d,\n' % (self.limit,))
    def exportLiteralChildren(self, outfile, level, name_):
        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_)
    def buildAttributes(self, node, attrs, already_processed):
        value = find_attr_value_('limit', node)
        if value is not None and 'limit' not in already_processed:
            already_processed.add('limit')
            try:
                self.limit = int(value)
            except ValueError, exp:
                raise_parse_error(node, 'Bad integer attribute: %s' % exp)
    def buildChildren(self, child_, node, nodeName_, fromsubclass_=False):
        pass
# end class limitExceeded


class asnRef(GeneratedsSuper):
    subclass = None
    superclass = None
    def __init__(self, handle=None, name=None, valueOf_=None):
        self.handle = _cast(None, handle)
        self.name = _cast(None, name)
        self.valueOf_ = valueOf_
    def factory(*args_, **kwargs_):
        if asnRef.subclass:
            return asnRef.subclass(*args_, **kwargs_)
        else:
            return asnRef(*args_, **kwargs_)
    factory = staticmethod(factory)
    def get_handle(self): return self.handle
    def set_handle(self, handle): self.handle = handle
    def get_name(self): return self.name
    def set_name(self, name): self.name = name
    def get_valueOf_(self): return self.valueOf_
    def set_valueOf_(self, valueOf_): self.valueOf_ = valueOf_
    def hasContent_(self):
        if (
            self.valueOf_
        ):
            return True
        else:
            return False
    def export(self, outfile, level, namespace_='v1:', name_='asnRef', namespacedef_='', pretty_print=True):
        if pretty_print:
            eol_ = '\n'
        else:
            eol_ = ''
        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_='asnRef')
        if self.hasContent_():
            outfile.write('>')
            outfile.write(str(self.valueOf_).encode(ExternalEncoding))
            self.exportChildren(outfile, level + 1, namespace_, name_, 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_='v1:', name_='asnRef'):
        if self.handle is not None and 'handle' not in already_processed:
            already_processed.add('handle')
            outfile.write(' handle=%s' % (self.gds_format_string(quote_attrib(self.handle).encode(ExternalEncoding), input_name='handle'), ))
        if self.name is not None and 'name' not in already_processed:
            already_processed.add('name')
            outfile.write(' name=%s' % (self.gds_format_string(quote_attrib(self.name).encode(ExternalEncoding), input_name='name'), ))
    def exportChildren(self, outfile, level, namespace_='v1:', name_='asnRef', fromsubclass_=False, pretty_print=True):
        pass
    def exportLiteral(self, outfile, level, name_='asnRef'):
        level += 1
        already_processed = set()
        self.exportLiteralAttributes(outfile, level, already_processed, name_)
        if self.hasContent_():
            self.exportLiteralChildren(outfile, level, name_)
        showIndent(outfile, level)
        outfile.write('valueOf_ = """%s""",\n' % (self.valueOf_,))
    def exportLiteralAttributes(self, outfile, level, already_processed, name_):
        if self.handle is not None and 'handle' not in already_processed:
            already_processed.add('handle')
            showIndent(outfile, level)
            outfile.write('handle="%s",\n' % (self.handle,))
        if self.name is not None and 'name' not in already_processed:
            already_processed.add('name')
            showIndent(outfile, level)
            outfile.write('name="%s",\n' % (self.name,))
    def exportLiteralChildren(self, outfile, level, name_):
        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_)
    def buildAttributes(self, node, attrs, already_processed):
        value = find_attr_value_('handle', node)
        if value is not None and 'handle' not in already_processed:
            already_processed.add('handle')
            self.handle = value
        value = find_attr_value_('name', node)
        if value is not None and 'name' not in already_processed:
            already_processed.add('name')
            self.name = value
    def buildChildren(self, child_, node, nodeName_, fromsubclass_=False):
        pass
# end class asnRef


class netRef(GeneratedsSuper):
    subclass = None
    superclass = None
    def __init__(self, startAddress=None, endAddress=None, handle=None, name=None, valueOf_=None):
        self.startAddress = _cast(None, startAddress)
        self.endAddress = _cast(None, endAddress)
        self.handle = _cast(None, handle)
        self.name = _cast(None, name)
        self.valueOf_ = valueOf_
    def factory(*args_, **kwargs_):
        if netRef.subclass:
            return netRef.subclass(*args_, **kwargs_)
        else:
            return netRef(*args_, **kwargs_)
    factory = staticmethod(factory)
    def get_startAddress(self): return self.startAddress
    def set_startAddress(self, startAddress): self.startAddress = startAddress
    def get_endAddress(self): return self.endAddress
    def set_endAddress(self, endAddress): self.endAddress = endAddress
    def get_handle(self): return self.handle
    def set_handle(self, handle): self.handle = handle
    def get_name(self): return self.name
    def set_name(self, name): self.name = name
    def get_valueOf_(self): return self.valueOf_
    def set_valueOf_(self, valueOf_): self.valueOf_ = valueOf_
    def hasContent_(self):
        if (
            self.valueOf_
        ):
            return True
        else:
            return False
    def export(self, outfile, level, namespace_='v1:', name_='netRef', namespacedef_='', pretty_print=True):
        if pretty_print:
            eol_ = '\n'
        else:
            eol_ = ''
        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_='netRef')
        if self.hasContent_():
            outfile.write('>')
            outfile.write(str(self.valueOf_).encode(ExternalEncoding))
            self.exportChildren(outfile, level + 1, namespace_, name_, 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_='v1:', name_='netRef'):
        if self.startAddress is not None and 'startAddress' not in already_processed:
            already_processed.add('startAddress')
            outfile.write(' startAddress=%s' % (self.gds_format_string(quote_attrib(self.startAddress).encode(ExternalEncoding), input_name='startAddress'), ))
        if self.endAddress is not None and 'endAddress' not in already_processed:
            already_processed.add('endAddress')
            outfile.write(' endAddress=%s' % (self.gds_format_string(quote_attrib(self.endAddress).encode(ExternalEncoding), input_name='endAddress'), ))
        if self.handle is not None and 'handle' not in already_processed:
            already_processed.add('handle')
            outfile.write(' handle=%s' % (self.gds_format_string(quote_attrib(self.handle).encode(ExternalEncoding), input_name='handle'), ))
        if self.name is not None and 'name' not in already_processed:
            already_processed.add('name')
            outfile.write(' name=%s' % (self.gds_format_string(quote_attrib(self.name).encode(ExternalEncoding), input_name='name'), ))
    def exportChildren(self, outfile, level, namespace_='v1:', name_='netRef', fromsubclass_=False, pretty_print=True):
        pass
    def exportLiteral(self, outfile, level, name_='netRef'):
        level += 1
        already_processed = set()
        self.exportLiteralAttributes(outfile, level, already_processed, name_)
        if self.hasContent_():
            self.exportLiteralChildren(outfile, level, name_)
        showIndent(outfile, level)
        outfile.write('valueOf_ = """%s""",\n' % (self.valueOf_,))
    def exportLiteralAttributes(self, outfile, level, already_processed, name_):
        if self.startAddress is not None and 'startAddress' not in already_processed:
            already_processed.add('startAddress')
            showIndent(outfile, level)
            outfile.write('startAddress="%s",\n' % (self.startAddress,))
        if self.endAddress is not None and 'endAddress' not in already_processed:
            already_processed.add('endAddress')
            showIndent(outfile, level)
            outfile.write('endAddress="%s",\n' % (self.endAddress,))
        if self.handle is not None and 'handle' not in already_processed:
            already_processed.add('handle')
            showIndent(outfile, level)
            outfile.write('handle="%s",\n' % (self.handle,))
        if self.name is not None and 'name' not in already_processed:
            already_processed.add('name')
            showIndent(outfile, level)
            outfile.write('name="%s",\n' % (self.name,))
    def exportLiteralChildren(self, outfile, level, name_):
        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_)
    def buildAttributes(self, node, attrs, already_processed):
        value = find_attr_value_('startAddress', node)
        if value is not None and 'startAddress' not in already_processed:
            already_processed.add('startAddress')
            self.startAddress = value
        value = find_attr_value_('endAddress', node)
        if value is not None and 'endAddress' not in already_processed:
            already_processed.add('endAddress')
            self.endAddress = value
        value = find_attr_value_('handle', node)
        if value is not None and 'handle' not in already_processed:
            already_processed.add('handle')
            self.handle = value
        value = find_attr_value_('name', node)
        if value is not None and 'name' not in already_processed:
            already_processed.add('name')
            self.name = value
    def buildChildren(self, child_, node, nodeName_, fromsubclass_=False):
        pass
# end class netRef


class orgPocLinkRef(GeneratedsSuper):
    subclass = None
    superclass = None
    def __init__(self, relPocDescription=None, handle=None, name=None, relPocHandle=None, relPocName=None, relPocFunction=None, valueOf_=None):
        self.relPocDescription = _cast(None, relPocDescription)
        self.handle = _cast(None, handle)
        self.name = _cast(None, name)
        self.relPocHandle = _cast(None, relPocHandle)
        self.relPocName = _cast(None, relPocName)
        self.relPocFunction = _cast(None, relPocFunction)
        self.valueOf_ = valueOf_
    def factory(*args_, **kwargs_):
        if orgPocLinkRef.subclass:
            return orgPocLinkRef.subclass(*args_, **kwargs_)
        else:
            return orgPocLinkRef(*args_, **kwargs_)
    factory = staticmethod(factory)
    def get_relPocDescription(self): return self.relPocDescription
    def set_relPocDescription(self, relPocDescription): self.relPocDescription = relPocDescription
    def get_handle(self): return self.handle
    def set_handle(self, handle): self.handle = handle
    def get_name(self): return self.name
    def set_name(self, name): self.name = name
    def get_relPocHandle(self): return self.relPocHandle
    def set_relPocHandle(self, relPocHandle): self.relPocHandle = relPocHandle
    def get_relPocName(self): return self.relPocName
    def set_relPocName(self, relPocName): self.relPocName = relPocName
    def get_relPocFunction(self): return self.relPocFunction
    def set_relPocFunction(self, relPocFunction): self.relPocFunction = relPocFunction
    def get_valueOf_(self): return self.valueOf_
    def set_valueOf_(self, valueOf_): self.valueOf_ = valueOf_
    def hasContent_(self):
        if (
            self.valueOf_
        ):
            return True
        else:
            return False
    def export(self, outfile, level, namespace_='v1:', name_='orgPocLinkRef', namespacedef_='', pretty_print=True):
        if pretty_print:
            eol_ = '\n'
        else:
            eol_ = ''
        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_='orgPocLinkRef')
        if self.hasContent_():
            outfile.write('>')
            outfile.write(str(self.valueOf_).encode(ExternalEncoding))
            self.exportChildren(outfile, level + 1, namespace_, name_, 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_='v1:', name_='orgPocLinkRef'):
        if self.relPocDescription is not None and 'relPocDescription' not in already_processed:
            already_processed.add('relPocDescription')
            outfile.write(' relPocDescription=%s' % (self.gds_format_string(quote_attrib(self.relPocDescription).encode(ExternalEncoding), input_name='relPocDescription'), ))
        if self.handle is not None and 'handle' not in already_processed:
            already_processed.add('handle')
            outfile.write(' handle=%s' % (self.gds_format_string(quote_attrib(self.handle).encode(ExternalEncoding), input_name='handle'), ))
        if self.name is not None and 'name' not in already_processed:
            already_processed.add('name')
            outfile.write(' name=%s' % (self.gds_format_string(quote_attrib(self.name).encode(ExternalEncoding), input_name='name'), ))
        if self.relPocHandle is not None and 'relPocHandle' not in already_processed:
            already_processed.add('relPocHandle')
            outfile.write(' relPocHandle=%s' % (self.gds_format_string(quote_attrib(self.relPocHandle).encode(ExternalEncoding), input_name='relPocHandle'), ))
        if self.relPocName is not None and 'relPocName' not in already_processed:
            already_processed.add('relPocName')
            outfile.write(' relPocName=%s' % (self.gds_format_string(quote_attrib(self.relPocName).encode(ExternalEncoding), input_name='relPocName'), ))
        if self.relPocFunction is not None and 'relPocFunction' not in already_processed:
            already_processed.add('relPocFunction')
            outfile.write(' relPocFunction=%s' % (self.gds_format_string(quote_attrib(self.relPocFunction).encode(ExternalEncoding), input_name='relPocFunction'), ))
    def exportChildren(self, outfile, level, namespace_='v1:', name_='orgPocLinkRef', fromsubclass_=False, pretty_print=True):
        pass
    def exportLiteral(self, outfile, level, name_='orgPocLinkRef'):
        level += 1
        already_processed = set()
        self.exportLiteralAttributes(outfile, level, already_processed, name_)
        if self.hasContent_():
            self.exportLiteralChildren(outfile, level, name_)
        showIndent(outfile, level)
        outfile.write('valueOf_ = """%s""",\n' % (self.valueOf_,))
    def exportLiteralAttributes(self, outfile, level, already_processed, name_):
        if self.relPocDescription is not None and 'relPocDescription' not in already_processed:
            already_processed.add('relPocDescription')
            showIndent(outfile, level)
            outfile.write('relPocDescription="%s",\n' % (self.relPocDescription,))
        if self.handle is not None and 'handle' not in already_processed:
            already_processed.add('handle')
            showIndent(outfile, level)
            outfile.write('handle="%s",\n' % (self.handle,))
        if self.name is not None and 'name' not in already_processed:
            already_processed.add('name')
            showIndent(outfile, level)
            outfile.write('name="%s",\n' % (self.name,))
        if self.relPocHandle is not None and 'relPocHandle' not in already_processed:
            already_processed.add('relPocHandle')
            showIndent(outfile, level)
            outfile.write('relPocHandle="%s",\n' % (self.relPocHandle,))
        if self.relPocName is not None and 'relPocName' not in already_processed:
            already_processed.add('relPocName')
            showIndent(outfile, level)
            outfile.write('relPocName="%s",\n' % (self.relPocName,))
        if self.relPocFunction is not None and 'relPocFunction' not in already_processed:
            already_processed.add('relPocFunction')
            showIndent(outfile, level)
            outfile.write('relPocFunction="%s",\n' % (self.relPocFunction,))
    def exportLiteralChildren(self, outfile, level, name_):
        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_)
    def buildAttributes(self, node, attrs, already_processed):
        value = find_attr_value_('relPocDescription', node)
        if value is not None and 'relPocDescription' not in already_processed:
            already_processed.add('relPocDescription')
            self.relPocDescription = value
        value = find_attr_value_('handle', node)
        if value is not None and 'handle' not in already_processed:
            already_processed.add('handle')
            self.handle = value
        value = find_attr_value_('name', node)
        if value is not None and 'name' not in already_processed:
            already_processed.add('name')
            self.name = value
        value = find_attr_value_('relPocHandle', node)
        if value is not None and 'relPocHandle' not in already_processed:
            already_processed.add('relPocHandle')
            self.relPocHandle = value
        value = find_attr_value_('relPocName', node)
        if value is not None and 'relPocName' not in already_processed:
            already_processed.add('relPocName')
            self.relPocName = value
        value = find_attr_value_('relPocFunction', node)
        if value is not None and 'relPocFunction' not in already_processed:
            already_processed.add('relPocFunction')
            self.relPocFunction = value
    def buildChildren(self, child_, node, nodeName_, fromsubclass_=False):
        pass
# end class orgPocLinkRef


class phone(GeneratedsSuper):
    subclass = None
    superclass = None
    def __init__(self, phone=None):
        self.phone = phone
    def factory(*args_, **kwargs_):
        if phone.subclass:
            return phone.subclass(*args_, **kwargs_)
        else:
            return phone(*args_, **kwargs_)
    factory = staticmethod(factory)
    def get_phone(self): return self.phone
    def set_phone(self, phone): self.phone = phone
    def hasContent_(self):
        if (
            self.phone is not None
        ):
            return True
        else:
            return False
    def export(self, outfile, level, namespace_='v1:', name_='phone', namespacedef_='', pretty_print=True):
        if pretty_print:
            eol_ = '\n'
        else:
            eol_ = ''
        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_='phone')
        if self.hasContent_():
            outfile.write('>%s' % (eol_, ))
            self.exportChildren(outfile, level + 1, namespace_, name_, 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_='v1:', name_='phone'):
        pass
    def exportChildren(self, outfile, level, namespace_='v1:', name_='phone', fromsubclass_=False, pretty_print=True):
        if pretty_print:
            eol_ = '\n'
        else:
            eol_ = ''
        if self.phone is not None:
            self.phone.export(outfile, level, namespace_, name_='phone', pretty_print=pretty_print)
    def exportLiteral(self, outfile, level, name_='phone'):
        level += 1
        already_processed = set()
        self.exportLiteralAttributes(outfile, level, already_processed, name_)
        if self.hasContent_():
            self.exportLiteralChildren(outfile, level, name_)
    def exportLiteralAttributes(self, outfile, level, already_processed, name_):
        pass
    def exportLiteralChildren(self, outfile, level, name_):
        if self.phone is not None:
            showIndent(outfile, level)
            outfile.write('phone=model_.phone(\n')
            self.phone.exportLiteral(outfile, level)
            showIndent(outfile, level)
            outfile.write('),\n')
    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_)
    def buildAttributes(self, node, attrs, already_processed):
        pass
    def buildChildren(self, child_, node, nodeName_, fromsubclass_=False):
        if nodeName_ == 'phone':
            obj_ = phone.factory()
            obj_.build(child_)
            self.set_phone(obj_)
# end class phone


class line(GeneratedsSuper):
    subclass = None
    superclass = None
    def __init__(self, number=None, valueOf_=None, mixedclass_=None, content_=None):
        self.number = _cast(int, number)
        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 line.subclass:
            return line.subclass(*args_, **kwargs_)
        else:
            return line(*args_, **kwargs_)
    factory = staticmethod(factory)
    def get_number(self): return self.number
    def set_number(self, number): self.number = number
    def get_valueOf_(self): return self.valueOf_
    def set_valueOf_(self, valueOf_): self.valueOf_ = valueOf_
    def hasContent_(self):
        if (
            self.valueOf_
        ):
            return True
        else:
            return False
    def export(self, outfile, level, namespace_='v1:', name_='line', namespacedef_='', pretty_print=True):
        if pretty_print:
            eol_ = '\n'
        else:
            eol_ = ''
        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_='line')
        outfile.write('>')
        self.exportChildren(outfile, level + 1, namespace_, name_, pretty_print=pretty_print)
        outfile.write('</%s%s>%s' % (namespace_, name_, eol_))
    def exportAttributes(self, outfile, level, already_processed, namespace_='v1:', name_='line'):
        if self.number is not None and 'number' not in already_processed:
            already_processed.add('number')
            outfile.write(' number="%s"' % self.gds_format_integer(self.number, input_name='number'))
    def exportChildren(self, outfile, level, namespace_='v1:', name_='line', fromsubclass_=False, pretty_print=True):
        pass
    def exportLiteral(self, outfile, level, name_='line'):
        level += 1
        already_processed = set()
        self.exportLiteralAttributes(outfile, level, already_processed, name_)
        if self.hasContent_():
            self.exportLiteralChildren(outfile, level, name_)
        showIndent(outfile, level)
        outfile.write('valueOf_ = """%s""",\n' % (self.valueOf_,))
    def exportLiteralAttributes(self, outfile, level, already_processed, name_):
        if self.number is not None and 'number' not in already_processed:
            already_processed.add('number')
            showIndent(outfile, level)
            outfile.write('number=%d,\n' % (self.number,))
    def exportLiteralChildren(self, outfile, level, name_):
        pass
    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_)
    def buildAttributes(self, node, attrs, already_processed):
        value = find_attr_value_('number', node)
        if value is not None and 'number' not in already_processed:
            already_processed.add('number')
            try:
                self.number = int(value)
            except ValueError, exp:
                raise_parse_error(node, 'Bad integer attribute: %s' % exp)
    def buildChildren(self, child_, node, nodeName_, fromsubclass_=False):
        if not fromsubclass_ and child_.tail is not None:
            obj_ = self.mixedclass_(MixedContainer.CategoryText,
                MixedContainer.TypeNone, '', child_.tail)
            self.content_.append(obj_)
        pass
# end class line


class type_(GeneratedsSuper):
    subclass = None
    superclass = None
    def __init__(self, description=None, code=None):
        self.description = description
        self.code = code
    def factory(*args_, **kwargs_):
        if type_.subclass:
            return type_.subclass(*args_, **kwargs_)
        else:
            return type_(*args_, **kwargs_)
    factory = staticmethod(factory)
    def get_description(self): return self.description
    def set_description(self, description): self.description = description
    def get_code(self): return self.code
    def set_code(self, code): self.code = code
    def hasContent_(self):
        if (
            self.description is not None or
            self.code is not None
        ):
            return True
        else:
            return False
    def export(self, outfile, level, namespace_='v1:', name_='type', namespacedef_='', pretty_print=True):
        if pretty_print:
            eol_ = '\n'
        else:
            eol_ = ''
        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_='type')
        if self.hasContent_():
            outfile.write('>%s' % (eol_, ))
            self.exportChildren(outfile, level + 1, namespace_, name_, 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_='v1:', name_='type'):
        pass
    def exportChildren(self, outfile, level, namespace_='v1:', name_='type', fromsubclass_=False, pretty_print=True):
        if pretty_print:
            eol_ = '\n'
        else:
            eol_ = ''
        if self.description is not None:
            showIndent(outfile, level, pretty_print)
            outfile.write('<%sdescription>%s</%sdescription>%s' % (namespace_, self.gds_format_string(quote_xml(self.description).encode(ExternalEncoding), input_name='description'), namespace_, eol_))
        if self.code is not None:
            showIndent(outfile, level, pretty_print)
            outfile.write('<%scode>%s</%scode>%s' % (namespace_, self.gds_format_string(quote_xml(self.code).encode(ExternalEncoding), input_name='code'), namespace_, eol_))
    def exportLiteral(self, outfile, level, name_='type'):
        level += 1
        already_processed = set()
        self.exportLiteralAttributes(outfile, level, already_processed, name_)
        if self.hasContent_():
            self.exportLiteralChildren(outfile, level, name_)
    def exportLiteralAttributes(self, outfile, level, already_processed, name_):
        pass
    def exportLiteralChildren(self, outfile, level, name_):
        if self.description is not None:
            showIndent(outfile, level)
            outfile.write('description=%s,\n' % quote_python(self.description).encode(ExternalEncoding))
        if self.code is not None:
            showIndent(outfile, level)
            outfile.write('code=%s,\n' % quote_python(self.code).encode(ExternalEncoding))
    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_)
    def buildAttributes(self, node, attrs, already_processed):
        pass
    def buildChildren(self, child_, node, nodeName_, fromsubclass_=False):
        if nodeName_ == 'description':
            description_ = child_.text
            description_ = self.gds_validate_string(description_, node, 'description')
            self.description = description_
        elif nodeName_ == 'code':
            code_ = child_.text
            code_ = self.gds_validate_string(code_, node, 'code')
            self.code = code_
# end class type_


GDSClassesMapping = {
    'phones': phone,
}


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):
    doc = parsexml_(inFileName)
    rootNode = doc.getroot()
    rootTag, rootClass = get_root_tag(rootNode)
    if rootClass is None:
        rootTag = 'poc'
        rootClass = poc
    rootObj = rootClass.factory()
    rootObj.build(rootNode)
    # Enable Python to collect the space used by the DOM.
    doc = None
    sys.stdout.write('<?xml version="1.0" ?>\n')
    rootObj.export(
        sys.stdout, 0, name_=rootTag,
        namespacedef_='xmlns=http://www.arin.net/whoisrws/core/v1',
        pretty_print=True)
    return rootObj


def parseEtree(inFileName):
    doc = parsexml_(inFileName)
    rootNode = doc.getroot()
    rootTag, rootClass = get_root_tag(rootNode)
    if rootClass is None:
        rootTag = 'poc'
        rootClass = poc
    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)
    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):
    from StringIO import StringIO
    doc = parsexml_(StringIO(inString))
    rootNode = doc.getroot()
    roots = get_root_tag(rootNode)
    rootClass = roots[1]
    if rootClass is None:
        rootClass = poc
    rootObj = rootClass.factory()
    rootObj.build(rootNode)
    # Enable Python to collect the space used by the DOM.
    doc = None
    sys.stdout.write('<?xml version="1.0" ?>\n')
    rootObj.export(
        sys.stdout, 0, name_="poc",
        namespacedef_='xmlns=http://www.arin.net/whoisrws/core/v1')
    return rootObj


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


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


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


__all__ = [
    "asnRef",
    "asns",
    "comment",
    "emails",
    "iso3166_1",
    "limitExceeded",
    "line",
    "netRef",
    "nets",
    "orgPocLinkRef",
    "orgs",
    "phone",
    "poc",
    "streetAddress",
    "type_"
]
