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

#
# Generated Wed Nov 14 12:52:26 2012 by generateDS.py version 2.7c.
#

import sys
import getopt
import re as re_

#import stix.bindings.data_marking_0_5 as data_marking_binding
import cybox.bindings.cybox_common_types_1_0 as cybox_common_binding
import stix.bindings.oasis.xpil as xpil_binding

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

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

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

try:
    from generatedssuper import GeneratedsSuper
except ImportError, exp:

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


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

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

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

#
# Globals
#

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

#
# Support/utility functions.
#

def showIndent(outfile, level, 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
    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))
    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 InformationSourceType(GeneratedsSuper):
    """The InformationSourceType details the source of a given data entry."""
    subclass = None
    superclass = None
    def __init__(self, Identity=None, Contributors=None, Time=None, Tools=None, References=None):
        self.Identity = Identity
        self.Contributors = Contributors
        self.Time = Time
        self.Tools = Tools
        self.References = References
    def factory(*args_, **kwargs_):
        if InformationSourceType.subclass:
            return InformationSourceType.subclass(*args_, **kwargs_)
        else:
            return InformationSourceType(*args_, **kwargs_)
    factory = staticmethod(factory)
    def get_Identity(self): return self.Identity
    def set_Identity(self, Identity): self.Identity = Identity
    def get_Contributors(self): return self.Contributors
    def set_Contributors(self, Contributors): self.Contributors = Contributors
    def get_Time(self): return self.Time
    def set_Time(self, Time): self.Time = Time
    def get_Tools(self): return self.Tools
    def set_Tools(self, Tools): self.Tools = Tools
    def get_References(self): return self.References
    def set_References(self, References): self.References = References
    def export(self, outfile, level, namespace_='stixCommon:', name_='InformationSourceType', 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 = []
        self.exportAttributes(outfile, level, already_processed, namespace_, name_='InformationSourceType')
        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_='stixCommon:', name_='InformationSourceType'):
        pass
    def exportChildren(self, outfile, level, namespace_='stixCommon:', name_='InformationSourceType', fromsubclass_=False, pretty_print=True):
        if pretty_print:
            eol_ = '\n'
        else:
            eol_ = ''
        if self.Identity is not None:
            self.Identity.export(outfile, level, 'stixCommon:', name_='Identity', pretty_print=pretty_print)
        if self.Contributors is not None:
            self.Contributors.export(outfile, level, 'stixCommon:', name_='Contributors', pretty_print=pretty_print)
        if self.Time is not None:
            self.Time.export(outfile, level, 'stixCommon:', name_='Time', pretty_print=pretty_print)
        if self.Tools is not None:
            self.Tools.export(outfile, level, 'stixCommon:', name_='Tools', pretty_print=pretty_print)
        if self.References is not None:
            self.References.export(outfile, level, 'stixCommon:', name_='References', pretty_print=pretty_print)
    def hasContent_(self):
        if (
            self.Identity is not None or
            self.Contributors is not None or
            self.Time is not None or
            self.Tools is not None or
            self.References is not None
            ):
            return True
        else:
            return False
    def exportLiteral(self, outfile, level, name_='InformationSourceType'):
        level += 1
        self.exportLiteralAttributes(outfile, level, [], name_)
        if self.hasContent_():
            self.exportLiteralChildren(outfile, level, name_)
    def exportLiteralAttributes(self, outfile, level, already_processed, name_):
        pass
    def exportLiteralChildren(self, outfile, level, name_):
        if self.Identity is not None:
            showIndent(outfile, level)
            outfile.write('Identity=model_.IdentityType(\n')
            self.Identity.exportLiteral(outfile, level, name_='Identity')
            showIndent(outfile, level)
            outfile.write('),\n')
        if self.Contributors is not None:
            showIndent(outfile, level)
            outfile.write('Contributors=model_.ContributorsType(\n')
            self.Contributors.exportLiteral(outfile, level, name_='Contributors')
            showIndent(outfile, level)
            outfile.write('),\n')
        if self.Time is not None:
            showIndent(outfile, level)
            outfile.write('Time=model_.cybox_common_binding.TimeType(\n')
            self.Time.exportLiteral(outfile, level, name_='Time')
            showIndent(outfile, level)
            outfile.write('),\n')
        if self.Tools is not None:
            showIndent(outfile, level)
            outfile.write('Tools=model_.cybox_common_binding.ToolsInformationType(\n')
            self.Tools.exportLiteral(outfile, level, name_='Tools')
            showIndent(outfile, level)
            outfile.write('),\n')
        if self.References is not None:
            showIndent(outfile, level)
            outfile.write('References=model_.ReferencesType(\n')
            self.References.exportLiteral(outfile, level, name_='References')
            showIndent(outfile, level)
            outfile.write('),\n')
    def build(self, node):
        self.buildAttributes(node, node.attrib, [])
        for child in node:
            nodeName_ = Tag_pattern_.match(child.tag).groups()[-1]
            self.buildChildren(child, node, nodeName_)
    def buildAttributes(self, node, attrs, already_processed):
        pass
    def buildChildren(self, child_, node, nodeName_, fromsubclass_=False):
        if nodeName_ == 'Identity':
            obj_ = IdentityType.factory()
            obj_.build(child_)
            self.set_Identity(obj_)
        elif nodeName_ == 'Contributors':
            obj_ = ContributorsType.factory()
            obj_.build(child_)
            self.set_Contributors(obj_)
        elif nodeName_ == 'Time':
            obj_ = cybox_common_binding.TimeType.factory()
            obj_.build(child_)
            self.set_Time(obj_)
        elif nodeName_ == 'Tools':
            obj_ = cybox_common_binding.ToolsInformationType.factory()
            obj_.build(child_)
            self.set_Tools(obj_)
        elif nodeName_ == 'References':
            obj_ = ReferencesType.factory()
            obj_.build(child_)
            self.set_References(obj_)
# end class InformationSourceType

class ConfidenceType(GeneratedsSuper):
    """The ConfidenceType specifies a level of Confidence held in some
    assertion.Specifies the level of Confidence held in this direct
    assertion.Specifies the source of this Confidence
    assertion.Specifies the time of this Confidence
    assertion.Specifies how to interpret the Value attribute for
    this Confidence assertion.Specifies an external reference to an
    authoritative source describing the interpretation model for
    this Confidence assertion."""
    subclass = None
    superclass = None
    def __init__(self, source=None, interpretation=None, interpretationRef=None, value=None, timestamp=None, Description=None, ConfidenceAssertionChain=None):
        self.source = _cast(None, source)
        self.interpretation = _cast(None, interpretation)
        self.interpretationRef = _cast(None, interpretationRef)
        self.value = _cast(None, value)
        self.timestamp = _cast(None, timestamp)
        self.Description = Description
        self.ConfidenceAssertionChain = ConfidenceAssertionChain
    def factory(*args_, **kwargs_):
        if ConfidenceType.subclass:
            return ConfidenceType.subclass(*args_, **kwargs_)
        else:
            return ConfidenceType(*args_, **kwargs_)
    factory = staticmethod(factory)
    def get_Description(self): return self.Description
    def set_Description(self, Description): self.Description = Description
    def get_ConfidenceAssertionChain(self): return self.ConfidenceAssertionChain
    def set_ConfidenceAssertionChain(self, ConfidenceAssertionChain): self.ConfidenceAssertionChain = ConfidenceAssertionChain
    def get_source(self): return self.source
    def set_source(self, source): self.source = source
    def get_interpretation(self): return self.interpretation
    def set_interpretation(self, interpretation): self.interpretation = interpretation
    def get_interpretationRef(self): return self.interpretationRef
    def set_interpretationRef(self, interpretationRef): self.interpretationRef = interpretationRef
    def get_value(self): return self.value
    def set_value(self, value): self.value = value
    def get_timestamp(self): return self.timestamp
    def set_timestamp(self, timestamp): self.timestamp = timestamp
    def export(self, outfile, level, namespace_='stixCommon:', name_='ConfidenceType', 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 = []
        self.exportAttributes(outfile, level, already_processed, namespace_, name_='ConfidenceType')
        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_='stixCommon:', name_='ConfidenceType'):
        if self.source is not None and 'source' not in already_processed:
            already_processed.append('source')
            outfile.write(' source=%s' % (self.gds_format_string(quote_attrib(self.source).encode(ExternalEncoding), input_name='source'), ))
        if self.interpretation is not None and 'interpretation' not in already_processed:
            already_processed.append('interpretation')
            outfile.write(' interpretation=%s' % (self.gds_format_string(quote_attrib(self.interpretation).encode(ExternalEncoding), input_name='interpretation'), ))
        if self.interpretationRef is not None and 'interpretationRef' not in already_processed:
            already_processed.append('interpretationRef')
            outfile.write(' interpretationRef=%s' % (self.gds_format_string(quote_attrib(self.interpretationRef).encode(ExternalEncoding), input_name='interpretationRef'), ))
        if self.value is not None and 'value' not in already_processed:
            already_processed.append('value')
            outfile.write(' value=%s' % (self.gds_format_string(quote_attrib(self.value).encode(ExternalEncoding), input_name='value'), ))
        if self.timestamp is not None and 'timestamp' not in already_processed:
            already_processed.append('timestamp')
            outfile.write(' timestamp=%s' % (self.gds_format_string(quote_attrib(self.timestamp).encode(ExternalEncoding), input_name='timestamp'), ))
    def exportChildren(self, outfile, level, namespace_='stixCommon:', name_='ConfidenceType', fromsubclass_=False, pretty_print=True):
        if pretty_print:
            eol_ = '\n'
        else:
            eol_ = ''
        if self.Description is not None:
            self.Description.export(outfile, level, 'stixCommon:', name_='Description', pretty_print=pretty_print)
        if self.ConfidenceAssertionChain is not None:
            self.ConfidenceAssertionChain.export(outfile, level, 'stixCommon:', name_='ConfidenceAssertionChain', pretty_print=pretty_print)
    def hasContent_(self):
        if (
            self.Description is not None or
            self.ConfidenceAssertionChain is not None
            ):
            return True
        else:
            return False
    def exportLiteral(self, outfile, level, name_='ConfidenceType'):
        level += 1
        self.exportLiteralAttributes(outfile, level, [], name_)
        if self.hasContent_():
            self.exportLiteralChildren(outfile, level, name_)
    def exportLiteralAttributes(self, outfile, level, already_processed, name_):
        if self.source is not None and 'source' not in already_processed:
            already_processed.append('source')
            showIndent(outfile, level)
            outfile.write('source = "%s",\n' % (self.source,))
        if self.interpretation is not None and 'interpretation' not in already_processed:
            already_processed.append('interpretation')
            showIndent(outfile, level)
            outfile.write('interpretation = "%s",\n' % (self.interpretation,))
        if self.interpretationRef is not None and 'interpretationRef' not in already_processed:
            already_processed.append('interpretationRef')
            showIndent(outfile, level)
            outfile.write('interpretationRef = "%s",\n' % (self.interpretationRef,))
        if self.value is not None and 'value' not in already_processed:
            already_processed.append('value')
            showIndent(outfile, level)
            outfile.write('value = "%s",\n' % (self.value,))
        if self.timestamp is not None and 'timestamp' not in already_processed:
            already_processed.append('timestamp')
            showIndent(outfile, level)
            outfile.write('timestamp = "%s",\n' % (self.timestamp,))
    def exportLiteralChildren(self, outfile, level, name_):
        if self.Description is not None:
            showIndent(outfile, level)
            outfile.write('Description=model_.cybox_common_binding.StructuredTextType(\n')
            self.Description.exportLiteral(outfile, level, name_='Description')
            showIndent(outfile, level)
            outfile.write('),\n')
        if self.ConfidenceAssertionChain is not None:
            showIndent(outfile, level)
            outfile.write('ConfidenceAssertionChain=model_.ConfidenceAssertionChainType(\n')
            self.ConfidenceAssertionChain.exportLiteral(outfile, level, name_='ConfidenceAssertionChain')
            showIndent(outfile, level)
            outfile.write('),\n')
    def build(self, node):
        self.buildAttributes(node, node.attrib, [])
        for child in node:
            nodeName_ = Tag_pattern_.match(child.tag).groups()[-1]
            self.buildChildren(child, node, nodeName_)
    def buildAttributes(self, node, attrs, already_processed):
        value = find_attr_value_('source', node)
        if value is not None and 'source' not in already_processed:
            already_processed.append('source')
            self.source = value
        value = find_attr_value_('interpretation', node)
        if value is not None and 'interpretation' not in already_processed:
            already_processed.append('interpretation')
            self.interpretation = value
        value = find_attr_value_('interpretationRef', node)
        if value is not None and 'interpretationRef' not in already_processed:
            already_processed.append('interpretationRef')
            self.interpretationRef = value
        value = find_attr_value_('value', node)
        if value is not None and 'value' not in already_processed:
            already_processed.append('value')
            self.value = value
        value = find_attr_value_('timestamp', node)
        if value is not None and 'timestamp' not in already_processed:
            already_processed.append('timestamp')
            self.timestamp = value
    def buildChildren(self, child_, node, nodeName_, fromsubclass_=False):
        if nodeName_ == 'Description':
            obj_ = cybox_common_binding.StructuredTextType.factory()
            obj_.build(child_)
            self.set_Description(obj_)
        elif nodeName_ == 'ConfidenceAssertionChain':
            obj_ = ConfidenceAssertionChainType.factory()
            obj_.build(child_)
            self.set_ConfidenceAssertionChain(obj_)
# end class ConfidenceType

class IntentType(GeneratedsSuper):
    """IntentType characterizes the suspected intent for a given behavior
    or action."""
    subclass = None
    superclass = None
    def __init__(self, SuspectedIntent=None, IntentConfidence=None):
        self.SuspectedIntent = SuspectedIntent
        self.IntentConfidence = IntentConfidence
    def factory(*args_, **kwargs_):
        if IntentType.subclass:
            return IntentType.subclass(*args_, **kwargs_)
        else:
            return IntentType(*args_, **kwargs_)
    factory = staticmethod(factory)
    def get_SuspectedIntent(self): return self.SuspectedIntent
    def set_SuspectedIntent(self, SuspectedIntent): self.SuspectedIntent = SuspectedIntent
    def get_IntentConfidence(self): return self.IntentConfidence
    def set_IntentConfidence(self, IntentConfidence): self.IntentConfidence = IntentConfidence
    def export(self, outfile, level, namespace_='stixCommon:', name_='IntentType', 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 = []
        self.exportAttributes(outfile, level, already_processed, namespace_, name_='IntentType')
        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_='stixCommon:', name_='IntentType'):
        pass
    def exportChildren(self, outfile, level, namespace_='stixCommon:', name_='IntentType', fromsubclass_=False, pretty_print=True):
        if pretty_print:
            eol_ = '\n'
        else:
            eol_ = ''
        if self.SuspectedIntent is not None:
            showIndent(outfile, level, pretty_print)
            outfile.write('<%sSuspectedIntent>%s</%sSuspectedIntent>%s' % ('stixCommon:', self.gds_format_string(quote_xml(self.SuspectedIntent).encode(ExternalEncoding), input_name='SuspectedIntent'), 'stixCommon:', eol_))
        if self.IntentConfidence is not None:
            self.IntentConfidence.export(outfile, level, 'stixCommon:', name_='IntentConfidence', pretty_print=pretty_print)
    def hasContent_(self):
        if (
            self.SuspectedIntent is not None or
            self.IntentConfidence is not None
            ):
            return True
        else:
            return False
    def exportLiteral(self, outfile, level, name_='IntentType'):
        level += 1
        self.exportLiteralAttributes(outfile, level, [], name_)
        if self.hasContent_():
            self.exportLiteralChildren(outfile, level, name_)
    def exportLiteralAttributes(self, outfile, level, already_processed, name_):
        pass
    def exportLiteralChildren(self, outfile, level, name_):
        if self.SuspectedIntent is not None:
            showIndent(outfile, level)
            outfile.write('SuspectedIntent=%s,\n' % quote_python(self.SuspectedIntent).encode(ExternalEncoding))
        if self.IntentConfidence is not None:
            showIndent(outfile, level)
            outfile.write('IntentConfidence=model_.ConfidenceType(\n')
            self.IntentConfidence.exportLiteral(outfile, level, name_='IntentConfidence')
            showIndent(outfile, level)
            outfile.write('),\n')
    def build(self, node):
        self.buildAttributes(node, node.attrib, [])
        for child in node:
            nodeName_ = Tag_pattern_.match(child.tag).groups()[-1]
            self.buildChildren(child, node, nodeName_)
    def buildAttributes(self, node, attrs, already_processed):
        pass
    def buildChildren(self, child_, node, nodeName_, fromsubclass_=False):
        if nodeName_ == 'SuspectedIntent':
            SuspectedIntent_ = child_.text
            SuspectedIntent_ = self.gds_validate_string(SuspectedIntent_, node, 'SuspectedIntent')
            self.SuspectedIntent = SuspectedIntent_
        elif nodeName_ == 'IntentConfidence':
            obj_ = ConfidenceType.factory()
            obj_.build(child_)
            self.set_IntentConfidence(obj_)
# end class IntentType

class ActivityType(GeneratedsSuper):
    subclass = None
    superclass = None
    def __init__(self, DateTime=None, Description=None):
        self.DateTime = DateTime
        self.Description = Description
    def factory(*args_, **kwargs_):
        if ActivityType.subclass:
            return ActivityType.subclass(*args_, **kwargs_)
        else:
            return ActivityType(*args_, **kwargs_)
    factory = staticmethod(factory)
    def get_DateTime(self): return self.DateTime
    def set_DateTime(self, DateTime): self.DateTime = DateTime
    def get_Description(self): return self.Description
    def set_Description(self, Description): self.Description = Description
    def export(self, outfile, level, namespace_='stixCommon:', name_='ActivityType', 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 = []
        self.exportAttributes(outfile, level, already_processed, namespace_, name_='ActivityType')
        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_='stixCommon:', name_='ActivityType'):
        pass
    def exportChildren(self, outfile, level, namespace_='stixCommon:', name_='ActivityType', fromsubclass_=False, pretty_print=True):
        if pretty_print:
            eol_ = '\n'
        else:
            eol_ = ''
        if self.DateTime is not None:
            showIndent(outfile, level, pretty_print)
            outfile.write('<%sDateTime>%s</%sDateTime>%s' % ('stixCommon:', self.gds_format_string(quote_xml(self.DateTime).encode(ExternalEncoding), input_name='DateTime'), 'stixCommon:', eol_))
        if self.Description is not None:
            self.Description.export(outfile, level, 'stixCommon:', name_='Description', pretty_print=pretty_print)
    def hasContent_(self):
        if (
            self.DateTime is not None or
            self.Description is not None
            ):
            return True
        else:
            return False
    def exportLiteral(self, outfile, level, name_='ActivityType'):
        level += 1
        self.exportLiteralAttributes(outfile, level, [], name_)
        if self.hasContent_():
            self.exportLiteralChildren(outfile, level, name_)
    def exportLiteralAttributes(self, outfile, level, already_processed, name_):
        pass
    def exportLiteralChildren(self, outfile, level, name_):
        if self.DateTime is not None:
            showIndent(outfile, level)
            outfile.write('DateTime=%s,\n' % quote_python(self.DateTime).encode(ExternalEncoding))
        if self.Description is not None:
            showIndent(outfile, level)
            outfile.write('Description=model_.cybox_common_binding.StructuredTextType(\n')
            self.Description.exportLiteral(outfile, level, name_='Description')
            showIndent(outfile, level)
            outfile.write('),\n')
    def build(self, node):
        self.buildAttributes(node, node.attrib, [])
        for child in node:
            nodeName_ = Tag_pattern_.match(child.tag).groups()[-1]
            self.buildChildren(child, node, nodeName_)
    def buildAttributes(self, node, attrs, already_processed):
        pass
    def buildChildren(self, child_, node, nodeName_, fromsubclass_=False):
        if nodeName_ == 'DateTime':
            DateTime_ = child_.text
            DateTime_ = self.gds_validate_string(DateTime_, node, 'DateTime')
            self.DateTime = DateTime_
        elif nodeName_ == 'Description':
            obj_ = cybox_common_binding.StructuredTextType.factory()
            obj_.build(child_)
            self.set_Description(obj_)
# end class ActivityType

class KillChainType(GeneratedsSuper):
    """The KillChainType characterizes a specific Kill Chain definition for
    reference within specific TTP entries, Indicators and
    elsewhere.A globally unique identifier for this kill chain
    definition.A descriptive name for this kill chain definition.The
    organization or individual responsible for this kill chain
    definition.A resource reference for this kill chain
    definition.The number of phases in this kill chain definition."""
    subclass = None
    superclass = None
    def __init__(self, reference=None, numberOfPhases=None, id=None, definer=None, name=None, KillChainPhase=None):
        self.reference = _cast(None, reference)
        self.numberOfPhases = _cast(None, numberOfPhases)
        self.id = _cast(None, id)
        self.definer = _cast(None, definer)
        self.name = _cast(None, name)
        if KillChainPhase is None:
            self.KillChainPhase = []
        else:
            self.KillChainPhase = KillChainPhase
    def factory(*args_, **kwargs_):
        if KillChainType.subclass:
            return KillChainType.subclass(*args_, **kwargs_)
        else:
            return KillChainType(*args_, **kwargs_)
    factory = staticmethod(factory)
    def get_KillChainPhase(self): return self.KillChainPhase
    def set_KillChainPhase(self, KillChainPhase): self.KillChainPhase = KillChainPhase
    def add_KillChainPhase(self, value): self.KillChainPhase.append(value)
    def insert_KillChainPhase(self, index, value): self.KillChainPhase[index] = value
    def get_reference(self): return self.reference
    def set_reference(self, reference): self.reference = reference
    def get_numberOfPhases(self): return self.numberOfPhases
    def set_numberOfPhases(self, numberOfPhases): self.numberOfPhases = numberOfPhases
    def get_id(self): return self.id
    def set_id(self, id): self.id = id
    def get_definer(self): return self.definer
    def set_definer(self, definer): self.definer = definer
    def get_name(self): return self.name
    def set_name(self, name): self.name = name
    def export(self, outfile, level, namespace_='stixCommon:', name_='KillChainType', 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 = []
        self.exportAttributes(outfile, level, already_processed, namespace_, name_='KillChainType')
        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_='stixCommon:', name_='KillChainType'):
        if self.reference is not None and 'reference' not in already_processed:
            already_processed.append('reference')
            outfile.write(' reference=%s' % (self.gds_format_string(quote_attrib(self.reference).encode(ExternalEncoding), input_name='reference'), ))
        if self.numberOfPhases is not None and 'numberOfPhases' not in already_processed:
            already_processed.append('numberOfPhases')
            outfile.write(' numberOfPhases=%s' % (self.gds_format_string(quote_attrib(self.numberOfPhases).encode(ExternalEncoding), input_name='numberOfPhases'), ))
        if self.id is not None and 'id' not in already_processed:
            already_processed.append('id')
            outfile.write(' id=%s' % (quote_attrib(self.id), ))
        if self.definer is not None and 'definer' not in already_processed:
            already_processed.append('definer')
            outfile.write(' definer=%s' % (self.gds_format_string(quote_attrib(self.definer).encode(ExternalEncoding), input_name='definer'), ))
        if self.name is not None and 'name' not in already_processed:
            already_processed.append('name')
            outfile.write(' name=%s' % (self.gds_format_string(quote_attrib(self.name).encode(ExternalEncoding), input_name='name'), ))
    def exportChildren(self, outfile, level, namespace_='stixCommon:', name_='KillChainType', fromsubclass_=False, pretty_print=True):
        if pretty_print:
            eol_ = '\n'
        else:
            eol_ = ''
        for KillChainPhase_ in self.KillChainPhase:
            KillChainPhase_.export(outfile, level, 'stixCommon:', name_='KillChainPhase', pretty_print=pretty_print)
    def hasContent_(self):
        if (
            self.KillChainPhase
            ):
            return True
        else:
            return False
    def exportLiteral(self, outfile, level, name_='KillChainType'):
        level += 1
        self.exportLiteralAttributes(outfile, level, [], name_)
        if self.hasContent_():
            self.exportLiteralChildren(outfile, level, name_)
    def exportLiteralAttributes(self, outfile, level, already_processed, name_):
        if self.reference is not None and 'reference' not in already_processed:
            already_processed.append('reference')
            showIndent(outfile, level)
            outfile.write('reference = "%s",\n' % (self.reference,))
        if self.numberOfPhases is not None and 'numberOfPhases' not in already_processed:
            already_processed.append('numberOfPhases')
            showIndent(outfile, level)
            outfile.write('numberOfPhases = "%s",\n' % (self.numberOfPhases,))
        if self.id is not None and 'id' not in already_processed:
            already_processed.append('id')
            showIndent(outfile, level)
            outfile.write('id = %s,\n' % (self.id,))
        if self.definer is not None and 'definer' not in already_processed:
            already_processed.append('definer')
            showIndent(outfile, level)
            outfile.write('definer = "%s",\n' % (self.definer,))
        if self.name is not None and 'name' not in already_processed:
            already_processed.append('name')
            showIndent(outfile, level)
            outfile.write('name = "%s",\n' % (self.name,))
    def exportLiteralChildren(self, outfile, level, name_):
        showIndent(outfile, level)
        outfile.write('KillChainPhase=[\n')
        level += 1
        for KillChainPhase_ in self.KillChainPhase:
            showIndent(outfile, level)
            outfile.write('model_.KillChainPhaseType(\n')
            KillChainPhase_.exportLiteral(outfile, level, name_='KillChainPhaseType')
            showIndent(outfile, level)
            outfile.write('),\n')
        level -= 1
        showIndent(outfile, level)
        outfile.write('],\n')
    def build(self, node):
        self.buildAttributes(node, node.attrib, [])
        for child in node:
            nodeName_ = Tag_pattern_.match(child.tag).groups()[-1]
            self.buildChildren(child, node, nodeName_)
    def buildAttributes(self, node, attrs, already_processed):
        value = find_attr_value_('reference', node)
        if value is not None and 'reference' not in already_processed:
            already_processed.append('reference')
            self.reference = value
        value = find_attr_value_('numberOfPhases', node)
        if value is not None and 'numberOfPhases' not in already_processed:
            already_processed.append('numberOfPhases')
            self.numberOfPhases = value
        value = find_attr_value_('id', node)
        if value is not None and 'id' not in already_processed:
            already_processed.append('id')
            self.id = value
        value = find_attr_value_('definer', node)
        if value is not None and 'definer' not in already_processed:
            already_processed.append('definer')
            self.definer = value
        value = find_attr_value_('name', node)
        if value is not None and 'name' not in already_processed:
            already_processed.append('name')
            self.name = value
    def buildChildren(self, child_, node, nodeName_, fromsubclass_=False):
        if nodeName_ == 'KillChainPhase':
            obj_ = KillChainPhaseType.factory()
            obj_.build(child_)
            self.KillChainPhase.append(obj_)
# end class KillChainType

class KillChainPhaseType(GeneratedsSuper):
    """The KillChainPhaseType characterizes an individual phase within a
    kill chain definition.This field specifies the ID for the
    relevant kill chain phase.This field specifies the descriptive
    name of the relevant kill chain phase.This field specifies the
    ordinality (e.g. 1, 2 or 3) of this phase within this kill chain
    definition."""
    subclass = None
    superclass = None
    def __init__(self, phaseID=None, ordinality=None, name=None):
        self.phaseID = _cast(None, phaseID)
        self.ordinality = _cast(int, ordinality)
        self.name = _cast(None, name)
        pass
    def factory(*args_, **kwargs_):
        if KillChainPhaseType.subclass:
            return KillChainPhaseType.subclass(*args_, **kwargs_)
        else:
            return KillChainPhaseType(*args_, **kwargs_)
    factory = staticmethod(factory)
    def get_phaseID(self): return self.phaseID
    def set_phaseID(self, phaseID): self.phaseID = phaseID
    def get_ordinality(self): return self.ordinality
    def set_ordinality(self, ordinality): self.ordinality = ordinality
    def get_name(self): return self.name
    def set_name(self, name): self.name = name
    def export(self, outfile, level, namespace_='stixCommon:', name_='KillChainPhaseType', 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 = []
        self.exportAttributes(outfile, level, already_processed, namespace_, name_='KillChainPhaseType')
        if self.hasContent_():
            outfile.write('>%s' % (eol_, ))
            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_='stixCommon:', name_='KillChainPhaseType'):
        if self.phaseID is not None and 'phaseID' not in already_processed:
            already_processed.append('phaseID')
            outfile.write(' phaseID=%s' % (quote_attrib(self.phaseID), ))
        if self.ordinality is not None and 'ordinality' not in already_processed:
            already_processed.append('ordinality')
            outfile.write(' ordinality="%s"' % self.gds_format_integer(self.ordinality, input_name='ordinality'))
        if self.name is not None and 'name' not in already_processed:
            already_processed.append('name')
            outfile.write(' name=%s' % (self.gds_format_string(quote_attrib(self.name).encode(ExternalEncoding), input_name='name'), ))
    def exportChildren(self, outfile, level, namespace_='stixCommon:', name_='KillChainPhaseType', fromsubclass_=False, pretty_print=True):
        pass
    def hasContent_(self):
        if (

            ):
            return True
        else:
            return False
    def exportLiteral(self, outfile, level, name_='KillChainPhaseType'):
        level += 1
        self.exportLiteralAttributes(outfile, level, [], name_)
        if self.hasContent_():
            self.exportLiteralChildren(outfile, level, name_)
    def exportLiteralAttributes(self, outfile, level, already_processed, name_):
        if self.phaseID is not None and 'phaseID' not in already_processed:
            already_processed.append('phaseID')
            showIndent(outfile, level)
            outfile.write('phaseID = %s,\n' % (self.phaseID,))
        if self.ordinality is not None and 'ordinality' not in already_processed:
            already_processed.append('ordinality')
            showIndent(outfile, level)
            outfile.write('ordinality = %d,\n' % (self.ordinality,))
        if self.name is not None and 'name' not in already_processed:
            already_processed.append('name')
            showIndent(outfile, level)
            outfile.write('name = "%s",\n' % (self.name,))
    def exportLiteralChildren(self, outfile, level, name_):
        pass
    def build(self, node):
        self.buildAttributes(node, node.attrib, [])
        for child in node:
            nodeName_ = Tag_pattern_.match(child.tag).groups()[-1]
            self.buildChildren(child, node, nodeName_)
    def buildAttributes(self, node, attrs, already_processed):
        value = find_attr_value_('phaseID', node)
        if value is not None and 'phaseID' not in already_processed:
            already_processed.append('phaseID')
            self.phaseID = value
        value = find_attr_value_('ordinality', node)
        if value is not None and 'ordinality' not in already_processed:
            already_processed.append('ordinality')
            try:
                self.ordinality = int(value)
            except ValueError, exp:
                raise_parse_error(node, 'Bad integer attribute: %s' % exp)
        value = find_attr_value_('name', node)
        if value is not None and 'name' not in already_processed:
            already_processed.append('name')
            self.name = value
    def buildChildren(self, child_, node, nodeName_, fromsubclass_=False):
        pass
# end class KillChainPhaseType

class STIX_CIQ_IdentityType(GeneratedsSuper):
    """Type of Party. e.g. Person or an organisation. An organisation could
    be university, college, club, association, company, etc"""
    subclass = None
    superclass = None
    def __init__(self, PartyType=None, FreeTextLines=None, PartyName=None, Addresses=None, Accounts=None, ContactNumbers=None, Documents=None, ElectronicAddressIdentifiers=None, Events=None, Identifiers=None, Memberships=None, Relationships=None, Revenues=None, Stocks=None, Vehicles=None, OrganisationInfo=None, PersonInfo=None, BirthInfo=None, CountriesOfResidence=None, Favourites=None, Habits=None, Hobbies=None, Languages=None, Nationalities=None, Occupations=None, PhysicalInfo=None, Preferences=None, Qualifications=None, Visas=None):
        self.PartyType = _cast(None, xpil_binding.PartyType) if PartyType else None
        self.FreeTextLines = FreeTextLines
        self.PartyName = PartyName
        self.Addresses = Addresses
        self.Accounts = Accounts
        self.ContactNumbers = ContactNumbers
        self.Documents = Documents
        self.ElectronicAddressIdentifiers = ElectronicAddressIdentifiers
        self.Events = Events
        self.Identifiers = Identifiers
        self.Memberships = Memberships
        self.Relationships = Relationships
        self.Revenues = Revenues
        self.Stocks = Stocks
        self.Vehicles = Vehicles
        self.OrganisationInfo = OrganisationInfo
        self.PersonInfo = PersonInfo
        self.BirthInfo = BirthInfo
        self.CountriesOfResidence = CountriesOfResidence
        self.Favourites = Favourites
        self.Habits = Habits
        self.Hobbies = Hobbies
        self.Languages = Languages
        self.Nationalities = Nationalities
        self.Occupations = Occupations
        self.PhysicalInfo = PhysicalInfo
        self.Preferences = Preferences
        self.Qualifications = Qualifications
        self.Visas = Visas
    def factory(*args_, **kwargs_):
        if STIX_CIQ_IdentityType.subclass:
            return STIX_CIQ_IdentityType.subclass(*args_, **kwargs_)
        else:
            return STIX_CIQ_IdentityType(*args_, **kwargs_)
    factory = staticmethod(factory)
    def get_FreeTextLines(self): return self.FreeTextLines
    def set_FreeTextLines(self, FreeTextLines): self.FreeTextLines = FreeTextLines
    def get_PartyName(self): return self.PartyName
    def set_PartyName(self, PartyName): self.PartyName = PartyName
    def get_Addresses(self): return self.Addresses
    def set_Addresses(self, Addresses): self.Addresses = Addresses
    def get_Accounts(self): return self.Accounts
    def set_Accounts(self, Accounts): self.Accounts = Accounts
    def get_ContactNumbers(self): return self.ContactNumbers
    def set_ContactNumbers(self, ContactNumbers): self.ContactNumbers = ContactNumbers
    def get_Documents(self): return self.Documents
    def set_Documents(self, Documents): self.Documents = Documents
    def get_ElectronicAddressIdentifiers(self): return self.ElectronicAddressIdentifiers
    def set_ElectronicAddressIdentifiers(self, ElectronicAddressIdentifiers): self.ElectronicAddressIdentifiers = ElectronicAddressIdentifiers
    def get_Events(self): return self.Events
    def set_Events(self, Events): self.Events = Events
    def get_Identifiers(self): return self.Identifiers
    def set_Identifiers(self, Identifiers): self.Identifiers = Identifiers
    def get_Memberships(self): return self.Memberships
    def set_Memberships(self, Memberships): self.Memberships = Memberships
    def get_Relationships(self): return self.Relationships
    def set_Relationships(self, Relationships): self.Relationships = Relationships
    def get_Revenues(self): return self.Revenues
    def set_Revenues(self, Revenues): self.Revenues = Revenues
    def get_Stocks(self): return self.Stocks
    def set_Stocks(self, Stocks): self.Stocks = Stocks
    def get_Vehicles(self): return self.Vehicles
    def set_Vehicles(self, Vehicles): self.Vehicles = Vehicles
    def get_OrganisationInfo(self): return self.OrganisationInfo
    def set_OrganisationInfo(self, OrganisationInfo): self.OrganisationInfo = OrganisationInfo
    def get_PersonInfo(self): return self.PersonInfo
    def set_PersonInfo(self, PersonInfo): self.PersonInfo = PersonInfo
    def get_BirthInfo(self): return self.BirthInfo
    def set_BirthInfo(self, BirthInfo): self.BirthInfo = BirthInfo
    def get_CountriesOfResidence(self): return self.CountriesOfResidence
    def set_CountriesOfResidence(self, CountriesOfResidence): self.CountriesOfResidence = CountriesOfResidence
    def get_Favourites(self): return self.Favourites
    def set_Favourites(self, Favourites): self.Favourites = Favourites
    def get_Habits(self): return self.Habits
    def set_Habits(self, Habits): self.Habits = Habits
    def get_Hobbies(self): return self.Hobbies
    def set_Hobbies(self, Hobbies): self.Hobbies = Hobbies
    def get_Languages(self): return self.Languages
    def set_Languages(self, Languages): self.Languages = Languages
    def get_Nationalities(self): return self.Nationalities
    def set_Nationalities(self, Nationalities): self.Nationalities = Nationalities
    def get_Occupations(self): return self.Occupations
    def set_Occupations(self, Occupations): self.Occupations = Occupations
    def get_PhysicalInfo(self): return self.PhysicalInfo
    def set_PhysicalInfo(self, PhysicalInfo): self.PhysicalInfo = PhysicalInfo
    def get_Preferences(self): return self.Preferences
    def set_Preferences(self, Preferences): self.Preferences = Preferences
    def get_Qualifications(self): return self.Qualifications
    def set_Qualifications(self, Qualifications): self.Qualifications = Qualifications
    def get_Visas(self): return self.Visas
    def set_Visas(self, Visas): self.Visas = Visas
    def get_PartyType(self): return self.PartyType
    def set_PartyType(self, PartyType): self.PartyType = PartyType
    def export(self, outfile, level, namespace_='stixCommon:', name_='STIX-CIQ-IdentityType', 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 = []
        self.exportAttributes(outfile, level, already_processed, namespace_, name_='STIX-CIQ-IdentityType')
        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_='stixCommon:', name_='STIX-CIQ-IdentityType'):
        if self.PartyType is not None and 'PartyType' not in already_processed:
            already_processed.append('PartyType')
            outfile.write(' ciq:PartyType=%s' % (quote_attrib(self.PartyType), ))
    def exportChildren(self, outfile, level, namespace_='stixCommon:', name_='STIX-CIQ-IdentityType', fromsubclass_=False, pretty_print=True):
        if pretty_print:
            eol_ = '\n'
        else:
            eol_ = ''
        if self.FreeTextLines is not None:
            self.FreeTextLines.export(outfile, level, 'ciq:', name_='FreeTextLines', pretty_print=pretty_print)
        if self.PartyName is not None:
            self.PartyName.export(outfile, level, 'ciq:', name_='PartyName', pretty_print=pretty_print)
        if self.Addresses is not None:
            self.Addresses.export(outfile, level, 'ciq:', name_='Addresses', pretty_print=pretty_print)
        if self.Accounts is not None:
            self.Accounts.export(outfile, level, 'ciq:', name_='Accounts', pretty_print=pretty_print)
        if self.ContactNumbers is not None:
            self.ContactNumbers.export(outfile, level, 'ciq:', name_='ContactNumbers', pretty_print=pretty_print)
        if self.Documents is not None:
            self.Documents.export(outfile, level, 'ciq:', name_='Documents', pretty_print=pretty_print)
        if self.ElectronicAddressIdentifiers is not None:
            self.ElectronicAddressIdentifiers.export(outfile, level, 'ciq:', name_='ElectronicAddressIdentifiers', pretty_print=pretty_print)
        if self.Events is not None:
            self.Events.export(outfile, level, 'ciq:', name_='Events', pretty_print=pretty_print)
        if self.Identifiers is not None:
            self.Identifiers.export(outfile, level, 'ciq:', name_='Identifiers', pretty_print=pretty_print)
        if self.Memberships is not None:
            self.Memberships.export(outfile, level, 'ciq:', name_='Memberships', pretty_print=pretty_print)
        if self.Relationships is not None:
            self.Relationships.export(outfile, level, 'ciq:', name_='Relationships', pretty_print=pretty_print)
        if self.Revenues is not None:
            self.Revenues.export(outfile, level, 'ciq:', name_='Revenues', pretty_print=pretty_print)
        if self.Stocks is not None:
            self.Stocks.export(outfile, level, 'ciq:', name_='Stocks', pretty_print=pretty_print)
        if self.Vehicles is not None:
            self.Vehicles.export(outfile, level, 'ciq:', name_='Vehicles', pretty_print=pretty_print)
        if self.OrganisationInfo is not None:
            self.OrganisationInfo.export(outfile, level, 'ciq:', name_='OrganisationInfo', pretty_print=pretty_print)
        if self.PersonInfo is not None:
            self.PersonInfo.export(outfile, level, 'ciq:', name_='PersonInfo', pretty_print=pretty_print)
        if self.BirthInfo is not None:
            self.BirthInfo.export(outfile, level, 'ciq:', name_='BirthInfo', pretty_print=pretty_print)
        if self.CountriesOfResidence is not None:
            self.CountriesOfResidence.export(outfile, level, 'ciq:', name_='CountriesOfResidence', pretty_print=pretty_print)
        if self.Favourites is not None:
            self.Favourites.export(outfile, level, 'ciq:', name_='Favourites', pretty_print=pretty_print)
        if self.Habits is not None:
            self.Habits.export(outfile, level, 'ciq:', name_='Habits', pretty_print=pretty_print)
        if self.Hobbies is not None:
            self.Hobbies.export(outfile, level, 'ciq:', name_='Hobbies', pretty_print=pretty_print)
        if self.Languages is not None:
            self.Languages.export(outfile, level, 'ciq:', name_='Languages', pretty_print=pretty_print)
        if self.Nationalities is not None:
            self.Nationalities.export(outfile, level, 'ciq:', name_='Nationalities', pretty_print=pretty_print)
        if self.Occupations is not None:
            self.Occupations.export(outfile, level, 'ciq:', name_='Occupations', pretty_print=pretty_print)
        if self.PhysicalInfo is not None:
            self.PhysicalInfo.export(outfile, level, 'ciq:', name_='PhysicalInfo', pretty_print=pretty_print)
        if self.Preferences is not None:
            self.Preferences.export(outfile, level, 'ciq:', name_='Preferences', pretty_print=pretty_print)
        if self.Qualifications is not None:
            self.Qualifications.export(outfile, level, 'ciq:', name_='Qualifications', pretty_print=pretty_print)
        if self.Visas is not None:
            self.Visas.export(outfile, level, 'ciq:', name_='Visas', pretty_print=pretty_print)
    def hasContent_(self):
        if (
            self.FreeTextLines is not None or
            self.PartyName is not None or
            self.Addresses is not None or
            self.Accounts is not None or
            self.ContactNumbers is not None or
            self.Documents is not None or
            self.ElectronicAddressIdentifiers is not None or
            self.Events is not None or
            self.Identifiers is not None or
            self.Memberships is not None or
            self.Relationships is not None or
            self.Revenues is not None or
            self.Stocks is not None or
            self.Vehicles is not None or
            self.OrganisationInfo is not None or
            self.PersonInfo is not None or
            self.BirthInfo is not None or
            self.CountriesOfResidence is not None or
            self.Favourites is not None or
            self.Habits is not None or
            self.Hobbies is not None or
            self.Languages is not None or
            self.Nationalities is not None or
            self.Occupations is not None or
            self.PhysicalInfo is not None or
            self.Preferences is not None or
            self.Qualifications is not None or
            self.Visas is not None
            ):
            return True
        else:
            return False
    def exportLiteral(self, outfile, level, name_='STIX-CIQ-IdentityType'):
        level += 1
        self.exportLiteralAttributes(outfile, level, [], name_)
        if self.hasContent_():
            self.exportLiteralChildren(outfile, level, name_)
    def exportLiteralAttributes(self, outfile, level, already_processed, name_):
        if self.PartyType is not None and 'PartyType' not in already_processed:
            already_processed.append('PartyType')
            showIndent(outfile, level)
            outfile.write('PartyType = %s,\n' % (self.PartyType,))
    def exportLiteralChildren(self, outfile, level, name_):
        if self.FreeTextLines is not None:
            showIndent(outfile, level)
            outfile.write('FreeTextLines=model_.FreeTextLines(\n')
            self.FreeTextLines.exportLiteral(outfile, level)
            showIndent(outfile, level)
            outfile.write('),\n')
        if self.PartyName is not None:
            showIndent(outfile, level)
            outfile.write('PartyName=model_.PartyName(\n')
            self.PartyName.exportLiteral(outfile, level)
            showIndent(outfile, level)
            outfile.write('),\n')
        if self.Addresses is not None:
            showIndent(outfile, level)
            outfile.write('Addresses=model_.Addresses(\n')
            self.Addresses.exportLiteral(outfile, level)
            showIndent(outfile, level)
            outfile.write('),\n')
        if self.Accounts is not None:
            showIndent(outfile, level)
            outfile.write('Accounts=model_.Accounts(\n')
            self.Accounts.exportLiteral(outfile, level)
            showIndent(outfile, level)
            outfile.write('),\n')
        if self.ContactNumbers is not None:
            showIndent(outfile, level)
            outfile.write('ContactNumbers=model_.ContactNumbers(\n')
            self.ContactNumbers.exportLiteral(outfile, level)
            showIndent(outfile, level)
            outfile.write('),\n')
        if self.Documents is not None:
            showIndent(outfile, level)
            outfile.write('Documents=model_.Documents(\n')
            self.Documents.exportLiteral(outfile, level)
            showIndent(outfile, level)
            outfile.write('),\n')
        if self.ElectronicAddressIdentifiers is not None:
            showIndent(outfile, level)
            outfile.write('ElectronicAddressIdentifiers=model_.ElectronicAddressIdentifiers(\n')
            self.ElectronicAddressIdentifiers.exportLiteral(outfile, level)
            showIndent(outfile, level)
            outfile.write('),\n')
        if self.Events is not None:
            showIndent(outfile, level)
            outfile.write('Events=model_.Events(\n')
            self.Events.exportLiteral(outfile, level)
            showIndent(outfile, level)
            outfile.write('),\n')
        if self.Identifiers is not None:
            showIndent(outfile, level)
            outfile.write('Identifiers=model_.Identifiers(\n')
            self.Identifiers.exportLiteral(outfile, level)
            showIndent(outfile, level)
            outfile.write('),\n')
        if self.Memberships is not None:
            showIndent(outfile, level)
            outfile.write('Memberships=model_.Memberships(\n')
            self.Memberships.exportLiteral(outfile, level)
            showIndent(outfile, level)
            outfile.write('),\n')
        if self.Relationships is not None:
            showIndent(outfile, level)
            outfile.write('Relationships=model_.Relationships(\n')
            self.Relationships.exportLiteral(outfile, level)
            showIndent(outfile, level)
            outfile.write('),\n')
        if self.Revenues is not None:
            showIndent(outfile, level)
            outfile.write('Revenues=model_.Revenues(\n')
            self.Revenues.exportLiteral(outfile, level)
            showIndent(outfile, level)
            outfile.write('),\n')
        if self.Stocks is not None:
            showIndent(outfile, level)
            outfile.write('Stocks=model_.Stocks(\n')
            self.Stocks.exportLiteral(outfile, level)
            showIndent(outfile, level)
            outfile.write('),\n')
        if self.Vehicles is not None:
            showIndent(outfile, level)
            outfile.write('Vehicles=model_.Vehicles(\n')
            self.Vehicles.exportLiteral(outfile, level)
            showIndent(outfile, level)
            outfile.write('),\n')
        if self.OrganisationInfo is not None:
            showIndent(outfile, level)
            outfile.write('OrganisationInfo=model_.OrganisationInfo(\n')
            self.OrganisationInfo.exportLiteral(outfile, level)
            showIndent(outfile, level)
            outfile.write('),\n')
        if self.PersonInfo is not None:
            showIndent(outfile, level)
            outfile.write('PersonInfo=model_.PersonInfo(\n')
            self.PersonInfo.exportLiteral(outfile, level)
            showIndent(outfile, level)
            outfile.write('),\n')
        if self.BirthInfo is not None:
            showIndent(outfile, level)
            outfile.write('BirthInfo=model_.BirthInfo(\n')
            self.BirthInfo.exportLiteral(outfile, level)
            showIndent(outfile, level)
            outfile.write('),\n')
        if self.CountriesOfResidence is not None:
            showIndent(outfile, level)
            outfile.write('CountriesOfResidence=model_.CountriesOfResidence(\n')
            self.CountriesOfResidence.exportLiteral(outfile, level)
            showIndent(outfile, level)
            outfile.write('),\n')
        if self.Favourites is not None:
            showIndent(outfile, level)
            outfile.write('Favourites=model_.Favourites(\n')
            self.Favourites.exportLiteral(outfile, level)
            showIndent(outfile, level)
            outfile.write('),\n')
        if self.Habits is not None:
            showIndent(outfile, level)
            outfile.write('Habits=model_.Habits(\n')
            self.Habits.exportLiteral(outfile, level)
            showIndent(outfile, level)
            outfile.write('),\n')
        if self.Hobbies is not None:
            showIndent(outfile, level)
            outfile.write('Hobbies=model_.Hobbies(\n')
            self.Hobbies.exportLiteral(outfile, level)
            showIndent(outfile, level)
            outfile.write('),\n')
        if self.Languages is not None:
            showIndent(outfile, level)
            outfile.write('Languages=model_.Languages(\n')
            self.Languages.exportLiteral(outfile, level)
            showIndent(outfile, level)
            outfile.write('),\n')
        if self.Nationalities is not None:
            showIndent(outfile, level)
            outfile.write('Nationalities=model_.Nationalities(\n')
            self.Nationalities.exportLiteral(outfile, level)
            showIndent(outfile, level)
            outfile.write('),\n')
        if self.Occupations is not None:
            showIndent(outfile, level)
            outfile.write('Occupations=model_.Occupations(\n')
            self.Occupations.exportLiteral(outfile, level)
            showIndent(outfile, level)
            outfile.write('),\n')
        if self.PhysicalInfo is not None:
            showIndent(outfile, level)
            outfile.write('PhysicalInfo=model_.PhysicalInfo(\n')
            self.PhysicalInfo.exportLiteral(outfile, level)
            showIndent(outfile, level)
            outfile.write('),\n')
        if self.Preferences is not None:
            showIndent(outfile, level)
            outfile.write('Preferences=model_.Preferences(\n')
            self.Preferences.exportLiteral(outfile, level)
            showIndent(outfile, level)
            outfile.write('),\n')
        if self.Qualifications is not None:
            showIndent(outfile, level)
            outfile.write('Qualifications=model_.Qualifications(\n')
            self.Qualifications.exportLiteral(outfile, level)
            showIndent(outfile, level)
            outfile.write('),\n')
        if self.Visas is not None:
            showIndent(outfile, level)
            outfile.write('Visas=model_.Visas(\n')
            self.Visas.exportLiteral(outfile, level)
            showIndent(outfile, level)
            outfile.write('),\n')
    def build(self, node):
        self.buildAttributes(node, node.attrib, [])
        for child in node:
            nodeName_ = Tag_pattern_.match(child.tag).groups()[-1]
            self.buildChildren(child, node, nodeName_)
    def buildAttributes(self, node, attrs, already_processed):
        value = find_attr_value_('PartyType', node)
        if value is not None and 'PartyType' not in already_processed:
            already_processed.append('PartyType')
            self.PartyType = value
    def buildChildren(self, child_, node, nodeName_, fromsubclass_=False):
        if nodeName_ == 'FreeTextLines':
            obj_ = xpil_binding.FreeTextLines.factory()
            obj_.build(child_)
            self.set_FreeTextLines(obj_)
        elif nodeName_ == 'PartyName':
            obj_ = xpil_binding.PartyNameType.factory()
            obj_.build(child_)
            self.set_PartyName(obj_)
        elif nodeName_ == 'Addresses':
            obj_ = xpil_binding.Addresses.factory()
            obj_.build(child_)
            self.set_Addresses(obj_)
        elif nodeName_ == 'Accounts':
            obj_ = xpil_binding.Accounts.factory()
            obj_.build(child_)
            self.set_Accounts(obj_)
        elif nodeName_ == 'ContactNumbers':
            obj_ = xpil_binding.ContactNumbers.factory()
            obj_.build(child_)
            self.set_ContactNumbers(obj_)
        elif nodeName_ == 'Documents':
            obj_ = xpil_binding.Documents.factory()
            obj_.build(child_)
            self.set_Documents(obj_)
        elif nodeName_ == 'ElectronicAddressIdentifiers':
            obj_ = xpil_binding.ElectronicAddressIdentifiers.factory()
            obj_.build(child_)
            self.set_ElectronicAddressIdentifiers(obj_)
        elif nodeName_ == 'Events':
            obj_ = xpil_binding.Events.factory()
            obj_.build(child_)
            self.set_Events(obj_)
        elif nodeName_ == 'Identifiers':
            obj_ = xpil_binding.Identifiers.factory()
            obj_.build(child_)
            self.set_Identifiers(obj_)
        elif nodeName_ == 'Memberships':
            obj_ = xpil_binding.Memberships.factory()
            obj_.build(child_)
            self.set_Memberships(obj_)
        elif nodeName_ == 'Relationships':
            obj_ = xpil_binding.Relationships.factory()
            obj_.build(child_)
            self.set_Relationships(obj_)
        elif nodeName_ == 'Revenues':
            obj_ = xpil_binding.Revenues.factory()
            obj_.build(child_)
            self.set_Revenues(obj_)
        elif nodeName_ == 'Stocks':
            obj_ = xpil_binding.Stocks.factory()
            obj_.build(child_)
            self.set_Stocks(obj_)
        elif nodeName_ == 'Vehicles':
            obj_ = xpil_binding.Vehicles.factory()
            obj_.build(child_)
            self.set_Vehicles(obj_)
        elif nodeName_ == 'OrganisationInfo':
            obj_ = xpil_binding.OrganisationInfo.factory()
            obj_.build(child_)
            self.set_OrganisationInfo(obj_)
        elif nodeName_ == 'PersonInfo':
            obj_ = xpil_binding.PersonInfo.factory()
            obj_.build(child_)
            self.set_PersonInfo(obj_)
        elif nodeName_ == 'BirthInfo':
            obj_ = xpil_binding.BirthInfo.factory()
            obj_.build(child_)
            self.set_BirthInfo(obj_)
        elif nodeName_ == 'CountriesOfResidence':
            obj_ = xpil_binding.CountriesOfResidence.factory()
            obj_.build(child_)
            self.set_CountriesOfResidence(obj_)
        elif nodeName_ == 'Favourites':
            obj_ = xpil_binding.Favourites.factory()
            obj_.build(child_)
            self.set_Favourites(obj_)
        elif nodeName_ == 'Habits':
            obj_ = xpil_binding.Habits.factory()
            obj_.build(child_)
            self.set_Habits(obj_)
        elif nodeName_ == 'Hobbies':
            obj_ = xpil_binding.Hobbies.factory()
            obj_.build(child_)
            self.set_Hobbies(obj_)
        elif nodeName_ == 'Languages':
            obj_ = xpil_binding.Languages.factory()
            obj_.build(child_)
            self.set_Languages(obj_)
        elif nodeName_ == 'Nationalities':
            obj_ = xpil_binding.Nationalities.factory()
            obj_.build(child_)
            self.set_Nationalities(obj_)
        elif nodeName_ == 'Occupations':
            obj_ = xpil_binding.Occupations.factory()
            obj_.build(child_)
            self.set_Occupations(obj_)
        elif nodeName_ == 'PhysicalInfo':
            obj_ = xpil_binding.PhysicalInfo.factory()
            obj_.build(child_)
            self.set_PhysicalInfo(obj_)
        elif nodeName_ == 'Preferences':
            obj_ = xpil_binding.Preferences.factory()
            obj_.build(child_)
            self.set_Preferences(obj_)
        elif nodeName_ == 'Qualifications':
            obj_ = xpil_binding.Qualifications.factory()
            obj_.build(child_)
            self.set_Qualifications(obj_)
        elif nodeName_ == 'Visas':
            obj_ = xpil_binding.Visas.factory()
            obj_.build(child_)
            self.set_Visas(obj_)
# end class STIX_CIQ_Identity_Type

class IdentityType(STIX_CIQ_IdentityType):
    """Specifies a unique ID for this Identity.Specifies a reference to a
    unique ID defined elsewhere."""
    subclass = None
    superclass = STIX_CIQ_IdentityType
    def __init__(self, PartyType=None, FreeTextLines=None, PartyName=None, Addresses=None, Accounts=None, ContactNumbers=None, Documents=None, ElectronicAddressIdentifiers=None, Events=None, Identifiers=None, Memberships=None, Relationships=None, Revenues=None, Stocks=None, Vehicles=None, OrganisationInfo=None, PersonInfo=None, BirthInfo=None, CountriesOfResidence=None, Favourites=None, Habits=None, Hobbies=None, Languages=None, Nationalities=None, Occupations=None, PhysicalInfo=None, Preferences=None, Qualifications=None, Visas=None, idref=None, id=None, Role=None, RelatedIdentities=None):
        super(IdentityType, self).__init__(PartyType, FreeTextLines, PartyName, Addresses, Accounts, ContactNumbers, Documents, ElectronicAddressIdentifiers, Events, Identifiers, Memberships, Relationships, Revenues, Stocks, Vehicles, OrganisationInfo, PersonInfo, BirthInfo, CountriesOfResidence, Favourites, Habits, Hobbies, Languages, Nationalities, Occupations, PhysicalInfo, Preferences, Qualifications, Visas, )
        self.idref = _cast(None, idref)
        self.id = _cast(None, id)
        if Role is None:
            self.Role = []
        else:
            self.Role = Role
        self.RelatedIdentities = RelatedIdentities
    def factory(*args_, **kwargs_):
        if IdentityType.subclass:
            return IdentityType.subclass(*args_, **kwargs_)
        else:
            return IdentityType(*args_, **kwargs_)
    factory = staticmethod(factory)
    def get_Role(self): return self.Role
    def set_Role(self, Role): self.Role = Role
    def add_Role(self, value): self.Role.append(value)
    def insert_Role(self, index, value): self.Role[index] = value
    def get_RelatedIdentities(self): return self.RelatedIdentities
    def set_RelatedIdentities(self, RelatedIdentities): self.RelatedIdentities = RelatedIdentities
    def get_idref(self): return self.idref
    def set_idref(self, idref): self.idref = idref
    def get_id(self): return self.id
    def set_id(self, id): self.id = id
    def export(self, outfile, level, namespace_='stixCommon:', name_='IdentityType', 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 = []
        self.exportAttributes(outfile, level, already_processed, namespace_, name_='IdentityType')
        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_='stixCommon:', name_='IdentityType'):
        super(IdentityType, self).exportAttributes(outfile, level, already_processed, namespace_, name_='IdentityType')
        if self.idref is not None and 'idref' not in already_processed:
            already_processed.append('idref')
            outfile.write(' idref=%s' % (quote_attrib(self.idref), ))
        if self.id is not None and 'id' not in already_processed:
            already_processed.append('id')
            outfile.write(' id=%s' % (quote_attrib(self.id), ))
    def exportChildren(self, outfile, level, namespace_='stixCommon:', name_='IdentityType', fromsubclass_=False, pretty_print=True):
        super(IdentityType, self).exportChildren(outfile, level, 'stixCommon:', name_, True, pretty_print=pretty_print)
        if pretty_print:
            eol_ = '\n'
        else:
            eol_ = ''
        for Role_ in self.Role:
            showIndent(outfile, level, pretty_print)
            outfile.write('<%sRole>%s</%sRole>%s' % ('stixCommon:', self.gds_format_string(quote_xml(Role_).encode(ExternalEncoding), input_name='Role'), 'stixCommon:', eol_))
        if self.RelatedIdentities is not None:
            self.RelatedIdentities.export(outfile, level, 'stixCommon:', name_='RelatedIdentities', pretty_print=pretty_print)
    def hasContent_(self):
        if (
            self.Role or
            self.RelatedIdentities is not None or
            super(IdentityType, self).hasContent_()
            ):
            return True
        else:
            return False
    def exportLiteral(self, outfile, level, name_='IdentityType'):
        level += 1
        self.exportLiteralAttributes(outfile, level, [], name_)
        if self.hasContent_():
            self.exportLiteralChildren(outfile, level, name_)
    def exportLiteralAttributes(self, outfile, level, already_processed, name_):
        if self.idref is not None and 'idref' not in already_processed:
            already_processed.append('idref')
            showIndent(outfile, level)
            outfile.write('idref = %s,\n' % (self.idref,))
        if self.id is not None and 'id' not in already_processed:
            already_processed.append('id')
            showIndent(outfile, level)
            outfile.write('id = %s,\n' % (self.id,))
        super(IdentityType, self).exportLiteralAttributes(outfile, level, already_processed, name_)
    def exportLiteralChildren(self, outfile, level, name_):
        super(IdentityType, self).exportLiteralChildren(outfile, level, name_)
        showIndent(outfile, level)
        outfile.write('Role=[\n')
        level += 1
        for Role_ in self.Role:
            showIndent(outfile, level)
            outfile.write('%s,\n' % quote_python(Role_).encode(ExternalEncoding))
        level -= 1
        showIndent(outfile, level)
        outfile.write('],\n')
        if self.RelatedIdentities is not None:
            showIndent(outfile, level)
            outfile.write('RelatedIdentities=model_.RelatedIdentitiesType(\n')
            self.RelatedIdentities.exportLiteral(outfile, level, name_='RelatedIdentities')
            showIndent(outfile, level)
            outfile.write('),\n')
    def build(self, node):
        self.buildAttributes(node, node.attrib, [])
        for child in node:
            nodeName_ = Tag_pattern_.match(child.tag).groups()[-1]
            self.buildChildren(child, node, nodeName_)
    def buildAttributes(self, node, attrs, already_processed):
        value = find_attr_value_('idref', node)
        if value is not None and 'idref' not in already_processed:
            already_processed.append('idref')
            self.idref = value
        value = find_attr_value_('id', node)
        if value is not None and 'id' not in already_processed:
            already_processed.append('id')
            self.id = value
        super(IdentityType, self).buildAttributes(node, attrs, already_processed)
    def buildChildren(self, child_, node, nodeName_, fromsubclass_=False):
        if nodeName_ == 'Role':
            Role_ = child_.text
            Role_ = self.gds_validate_string(Role_, node, 'Role')
            self.Role.append(Role_)
        elif nodeName_ == 'RelatedIdentities':
            obj_ = RelatedIdentitiesType.factory()
            obj_.build(child_)
            self.set_RelatedIdentities(obj_)
        super(IdentityType, self).buildChildren(child_, node, nodeName_, True)
# end class IdentityType



class MarkingStructureType(GeneratedsSuper):
    """The MarkingStructureType contains the marking information to be
    applied to a portion of XML content. This type is defined as an
    abstract type that enables the flexibility to utilize any
    variety of marking structures.This field specifies the name of
    the marking model to be applied within this
    Marking_Structure.This field contains a reference to an
    authoritative source on the marking model to be applied within
    this Marking_Structure."""
    subclass = None
    superclass = None
    def __init__(self, markingModelRef=None, markingModelName=None, extensiontype_=None):
        self.markingModelRef = _cast(None, markingModelRef)
        self.markingModelName = _cast(None, markingModelName)
        self.extensiontype_ = None
        pass
    def factory(*args_, **kwargs_):
        if MarkingStructureType.subclass:
            return MarkingStructureType.subclass(*args_, **kwargs_)
        else:
            return MarkingStructureType(*args_, **kwargs_)
    factory = staticmethod(factory)
    def get_extensiontype_(self): return self.extensiontype_
    def set_extensiontype_(self): return self.extensiontype_
    def get_markingModelRef(self): return self.markingModelRef
    def set_markingModelRef(self, markingModelRef): self.markingModelRef = markingModelRef
    def get_markingModelName(self): return self.markingModelName
    def set_markingModelName(self, markingModelName): self.markingModelName = markingModelName
    def export(self, outfile, level, namespace_='marking:', name_='MarkingStructureType', 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 = []
        self.exportAttributes(outfile, level, already_processed, namespace_, name_='MarkingStructureType')
        if self.hasContent_():
            outfile.write('>%s' % (eol_, ))
            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_='marking:', name_='MarkingStructureType'):
        if self.markingModelRef is not None and 'markingModelRef' not in already_processed:
            already_processed.append('markingModelRef')
            outfile.write(' markingModelRef=%s' % (self.gds_format_string(quote_attrib(self.markingModelRef).encode(ExternalEncoding), input_name='markingModelRef'), ))
        if self.markingModelName is not None and 'markingModelName' not in already_processed:
            already_processed.append('markingModelName')
            outfile.write(' markingModelName=%s' % (quote_attrib(self.markingModelName), ))
        if self.extensiontype_ is not None and 'xsi:type' not in already_processed:
            already_processed.append('xsi:type')
            outfile.write(' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"')
            outfile.write(' xsi:type="%s"' % self.extensiontype_)

    def exportChildren(self, outfile, level, namespace_='marking:', name_='MarkingStructureType', fromsubclass_=False, pretty_print=True):
        pass
    def hasContent_(self):
        if (

            ):
            return True
        else:
            return False
    def exportLiteral(self, outfile, level, name_='MarkingStructureType'):
        level += 1
        self.exportLiteralAttributes(outfile, level, [], name_)
        if self.hasContent_():
            self.exportLiteralChildren(outfile, level, name_)
    def exportLiteralAttributes(self, outfile, level, already_processed, name_):
        if self.markingModelRef is not None and 'markingModelRef' not in already_processed:
            already_processed.append('markingModelRef')
            showIndent(outfile, level)
            outfile.write('markingModelRef = "%s",\n' % (self.markingModelRef,))
        if self.markingModelName is not None and 'markingModelName' not in already_processed:
            already_processed.append('markingModelName')
            showIndent(outfile, level)
            outfile.write('markingModelName = %s,\n' % (self.markingModelName,))
    def exportLiteralChildren(self, outfile, level, name_):
        pass
    def build(self, node):
        self.buildAttributes(node, node.attrib, [])
        for child in node:
            nodeName_ = Tag_pattern_.match(child.tag).groups()[-1]
            self.buildChildren(child, node, nodeName_)
    def buildAttributes(self, node, attrs, already_processed):
        value = find_attr_value_('markingModelRef', node)
        if value is not None and 'markingModelRef' not in already_processed:
            already_processed.append('markingModelRef')
            self.markingModelRef = value
        value = find_attr_value_('markingModelName', node)
        if value is not None and 'markingModelName' not in already_processed:
            already_processed.append('markingModelName')
            self.markingModelName = value
            
        value = find_attr_value_('xsi:type', node)
        if value is not None and 'xsi:type' not in already_processed:
            already_processed.append('xsi:type')
            self.extensiontype_ = value  
    def buildChildren(self, child_, node, nodeName_, fromsubclass_=False):
        pass
# end class MarkingStructureType




class TLPHandlingGuidanceType(MarkingStructureType):
    """The TLPHandlingGuidanceType is an extension of the abstract
    data_marking_binding.MarkingStructureType that enables the specification of Traffic
    Light Protocol guidance markings."""
    subclass = None
    superclass = MarkingStructureType
    def __init__(self, markingModelRef=None, markingModelName=None, sensitivity=None):
        super(TLPHandlingGuidanceType, self).__init__(markingModelRef, markingModelName, )
        self.sensitivity = _cast(None, sensitivity)
        pass
    def factory(*args_, **kwargs_):
        if TLPHandlingGuidanceType.subclass:
            return TLPHandlingGuidanceType.subclass(*args_, **kwargs_)
        else:
            return TLPHandlingGuidanceType(*args_, **kwargs_)
    factory = staticmethod(factory)
    def get_sensitivity(self): return self.sensitivity
    def set_sensitivity(self, sensitivity): self.sensitivity = sensitivity
    def export(self, outfile, level, namespace_='stixCommon:', name_='TLPHandlingGuidanceType', 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 = []
        self.exportAttributes(outfile, level, already_processed, namespace_, name_='TLPHandlingGuidanceType')
        if self.hasContent_():
            outfile.write('>%s' % (eol_, ))
            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_='stixCommon:', name_='TLPHandlingGuidanceType'):
        super(TLPHandlingGuidanceType, self).exportAttributes(outfile, level, already_processed, namespace_, name_='TLPHandlingGuidanceType')
        if self.sensitivity is not None and 'sensitivity' not in already_processed:
            already_processed.append('sensitivity')
            outfile.write(' sensitivity=%s' % (quote_attrib(self.sensitivity), ))
    def exportChildren(self, outfile, level, namespace_='stixCommon:', name_='TLPHandlingGuidanceType', fromsubclass_=False, pretty_print=True):
        super(TLPHandlingGuidanceType, self).exportChildren(outfile, level, 'stixCommon:', name_, True, pretty_print=pretty_print)
        pass
    def hasContent_(self):
        if (
            super(TLPHandlingGuidanceType, self).hasContent_()
            ):
            return True
        else:
            return False
    def exportLiteral(self, outfile, level, name_='TLPHandlingGuidanceType'):
        level += 1
        self.exportLiteralAttributes(outfile, level, [], name_)
        if self.hasContent_():
            self.exportLiteralChildren(outfile, level, name_)
    def exportLiteralAttributes(self, outfile, level, already_processed, name_):
        if self.sensitivity is not None and 'sensitivity' not in already_processed:
            already_processed.append('sensitivity')
            showIndent(outfile, level)
            outfile.write('sensitivity = %s,\n' % (self.sensitivity,))
        super(TLPHandlingGuidanceType, self).exportLiteralAttributes(outfile, level, already_processed, name_)
    def exportLiteralChildren(self, outfile, level, name_):
        super(TLPHandlingGuidanceType, self).exportLiteralChildren(outfile, level, name_)
        pass
    def build(self, node):
        self.buildAttributes(node, node.attrib, [])
        for child in node:
            nodeName_ = Tag_pattern_.match(child.tag).groups()[-1]
            self.buildChildren(child, node, nodeName_)
    def buildAttributes(self, node, attrs, already_processed):
        value = find_attr_value_('sensitivity', node)
        if value is not None and 'sensitivity' not in already_processed:
            already_processed.append('sensitivity')
            self.sensitivity = value
        super(TLPHandlingGuidanceType, self).buildAttributes(node, attrs, already_processed)
    def buildChildren(self, child_, node, nodeName_, fromsubclass_=False):
        super(TLPHandlingGuidanceType, self).buildChildren(child_, node, nodeName_, True)
        pass
# end class TLPHandlingGuidanceType


class ContributorsType(GeneratedsSuper):
    subclass = None
    superclass = None
    def __init__(self, Contributor=None):
        if Contributor is None:
            self.Contributor = []
        else:
            self.Contributor = Contributor
    def factory(*args_, **kwargs_):
        if ContributorsType.subclass:
            return ContributorsType.subclass(*args_, **kwargs_)
        else:
            return ContributorsType(*args_, **kwargs_)
    factory = staticmethod(factory)
    def get_Contributor(self): return self.Contributor
    def set_Contributor(self, Contributor): self.Contributor = Contributor
    def add_Contributor(self, value): self.Contributor.append(value)
    def insert_Contributor(self, index, value): self.Contributor[index] = value
    def export(self, outfile, level, namespace_='stixCommon:', name_='ContributorsType', 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 = []
        self.exportAttributes(outfile, level, already_processed, namespace_, name_='ContributorsType')
        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_='stixCommon:', name_='ContributorsType'):
        pass
    def exportChildren(self, outfile, level, namespace_='stixCommon:', name_='ContributorsType', fromsubclass_=False, pretty_print=True):
        if pretty_print:
            eol_ = '\n'
        else:
            eol_ = ''
        for Contributor_ in self.Contributor:
            Contributor_.export(outfile, level, namespace_, name_='Contributor', pretty_print=pretty_print)
    def hasContent_(self):
        if (
            self.Contributor
            ):
            return True
        else:
            return False
    def exportLiteral(self, outfile, level, name_='ContributorsType'):
        level += 1
        self.exportLiteralAttributes(outfile, level, [], name_)
        if self.hasContent_():
            self.exportLiteralChildren(outfile, level, name_)
    def exportLiteralAttributes(self, outfile, level, already_processed, name_):
        pass
    def exportLiteralChildren(self, outfile, level, name_):
        showIndent(outfile, level)
        outfile.write('Contributor=[\n')
        level += 1
        for Contributor_ in self.Contributor:
            showIndent(outfile, level)
            outfile.write('model_.IdentityType(\n')
            Contributor_.exportLiteral(outfile, level, name_='IdentityType')
            showIndent(outfile, level)
            outfile.write('),\n')
        level -= 1
        showIndent(outfile, level)
        outfile.write('],\n')
    def build(self, node):
        self.buildAttributes(node, node.attrib, [])
        for child in node:
            nodeName_ = Tag_pattern_.match(child.tag).groups()[-1]
            self.buildChildren(child, node, nodeName_)
    def buildAttributes(self, node, attrs, already_processed):
        pass
    def buildChildren(self, child_, node, nodeName_, fromsubclass_=False):
        if nodeName_ == 'Contributor':
            class_obj_ = self.get_class_obj_(child_, IdentityType)
            obj_ = class_obj_.factory()
            obj_.build(child_)
            self.Contributor.append(obj_)
# end class ContributorsType


class ReferencesType(GeneratedsSuper):
    subclass = None
    superclass = None
    def __init__(self, Reference=None):
        if Reference is None:
            self.Reference = []
        else:
            self.Reference = Reference
    def factory(*args_, **kwargs_):
        if ReferencesType.subclass:
            return ReferencesType.subclass(*args_, **kwargs_)
        else:
            return ReferencesType(*args_, **kwargs_)
    factory = staticmethod(factory)
    def get_Reference(self): return self.Reference
    def set_Reference(self, Reference): self.Reference = Reference
    def add_Reference(self, value): self.Reference.append(value)
    def insert_Reference(self, index, value): self.Reference[index] = value
    def export(self, outfile, level, namespace_='stixCommon:', name_='ReferencesType', 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 = []
        self.exportAttributes(outfile, level, already_processed, namespace_, name_='ReferencesType')
        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_='stixCommon:', name_='ReferencesType'):
        pass
    def exportChildren(self, outfile, level, namespace_='stixCommon:', name_='ReferencesType', fromsubclass_=False, pretty_print=True):
        if pretty_print:
            eol_ = '\n'
        else:
            eol_ = ''
        for Reference_ in self.Reference:
            showIndent(outfile, level, pretty_print)
            outfile.write('<%sReference>%s</%sReference>%s' % (namespace_, self.gds_format_string(quote_xml(Reference_).encode(ExternalEncoding), input_name='Reference'), namespace_, eol_))
    def hasContent_(self):
        if (
            self.Reference
            ):
            return True
        else:
            return False
    def exportLiteral(self, outfile, level, name_='ReferencesType'):
        level += 1
        self.exportLiteralAttributes(outfile, level, [], name_)
        if self.hasContent_():
            self.exportLiteralChildren(outfile, level, name_)
    def exportLiteralAttributes(self, outfile, level, already_processed, name_):
        pass
    def exportLiteralChildren(self, outfile, level, name_):
        showIndent(outfile, level)
        outfile.write('Reference=[\n')
        level += 1
        for Reference_ in self.Reference:
            showIndent(outfile, level)
            outfile.write('%s,\n' % quote_python(Reference_).encode(ExternalEncoding))
        level -= 1
        showIndent(outfile, level)
        outfile.write('],\n')
    def build(self, node):
        self.buildAttributes(node, node.attrib, [])
        for child in node:
            nodeName_ = Tag_pattern_.match(child.tag).groups()[-1]
            self.buildChildren(child, node, nodeName_)
    def buildAttributes(self, node, attrs, already_processed):
        pass
    def buildChildren(self, child_, node, nodeName_, fromsubclass_=False):
        if nodeName_ == 'Reference':
            Reference_ = child_.text
            Reference_ = self.gds_validate_string(Reference_, node, 'Reference')
            self.Reference.append(Reference_)
# end class ReferencesType


class ConfidenceAssertionChainType(GeneratedsSuper):
    subclass = None
    superclass = None
    def __init__(self, ConfidenceAssertion=None):
        if ConfidenceAssertion is None:
            self.ConfidenceAssertion = []
        else:
            self.ConfidenceAssertion = ConfidenceAssertion
    def factory(*args_, **kwargs_):
        if ConfidenceAssertionChainType.subclass:
            return ConfidenceAssertionChainType.subclass(*args_, **kwargs_)
        else:
            return ConfidenceAssertionChainType(*args_, **kwargs_)
    factory = staticmethod(factory)
    def get_ConfidenceAssertion(self): return self.ConfidenceAssertion
    def set_ConfidenceAssertion(self, ConfidenceAssertion): self.ConfidenceAssertion = ConfidenceAssertion
    def add_ConfidenceAssertion(self, value): self.ConfidenceAssertion.append(value)
    def insert_ConfidenceAssertion(self, index, value): self.ConfidenceAssertion[index] = value
    def export(self, outfile, level, namespace_='stixCommon:', name_='ConfidenceAssertionChainType', 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 = []
        self.exportAttributes(outfile, level, already_processed, namespace_, name_='ConfidenceAssertionChainType')
        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_='stixCommon:', name_='ConfidenceAssertionChainType'):
        pass
    def exportChildren(self, outfile, level, namespace_='stixCommon:', name_='ConfidenceAssertionChainType', fromsubclass_=False, pretty_print=True):
        if pretty_print:
            eol_ = '\n'
        else:
            eol_ = ''
        for ConfidenceAssertion_ in self.ConfidenceAssertion:
            ConfidenceAssertion_.export(outfile, level, namespace_, name_='ConfidenceAssertion', pretty_print=pretty_print)
    def hasContent_(self):
        if (
            self.ConfidenceAssertion
            ):
            return True
        else:
            return False
    def exportLiteral(self, outfile, level, name_='ConfidenceAssertionChainType'):
        level += 1
        self.exportLiteralAttributes(outfile, level, [], name_)
        if self.hasContent_():
            self.exportLiteralChildren(outfile, level, name_)
    def exportLiteralAttributes(self, outfile, level, already_processed, name_):
        pass
    def exportLiteralChildren(self, outfile, level, name_):
        showIndent(outfile, level)
        outfile.write('ConfidenceAssertion=[\n')
        level += 1
        for ConfidenceAssertion_ in self.ConfidenceAssertion:
            showIndent(outfile, level)
            outfile.write('model_.ConfidenceType(\n')
            ConfidenceAssertion_.exportLiteral(outfile, level, name_='ConfidenceType')
            showIndent(outfile, level)
            outfile.write('),\n')
        level -= 1
        showIndent(outfile, level)
        outfile.write('],\n')
    def build(self, node):
        self.buildAttributes(node, node.attrib, [])
        for child in node:
            nodeName_ = Tag_pattern_.match(child.tag).groups()[-1]
            self.buildChildren(child, node, nodeName_)
    def buildAttributes(self, node, attrs, already_processed):
        pass
    def buildChildren(self, child_, node, nodeName_, fromsubclass_=False):
        if nodeName_ == 'ConfidenceAssertion':
            obj_ = ConfidenceType.factory()
            obj_.build(child_)
            self.ConfidenceAssertion.append(obj_)
# end class ConfidenceAssertionChainType


class RelatedIdentitiesType(GeneratedsSuper):
    subclass = None
    superclass = None
    def __init__(self, RelatedIdentity=None):
        if RelatedIdentity is None:
            self.RelatedIdentity = []
        else:
            self.RelatedIdentity = RelatedIdentity
    def factory(*args_, **kwargs_):
        if RelatedIdentitiesType.subclass:
            return RelatedIdentitiesType.subclass(*args_, **kwargs_)
        else:
            return RelatedIdentitiesType(*args_, **kwargs_)
    factory = staticmethod(factory)
    def get_RelatedIdentity(self): return self.RelatedIdentity
    def set_RelatedIdentity(self, RelatedIdentity): self.RelatedIdentity = RelatedIdentity
    def add_RelatedIdentity(self, value): self.RelatedIdentity.append(value)
    def insert_RelatedIdentity(self, index, value): self.RelatedIdentity[index] = value
    def export(self, outfile, level, namespace_='stixCommon:', name_='RelatedIdentitiesType', 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 = []
        self.exportAttributes(outfile, level, already_processed, namespace_, name_='RelatedIdentitiesType')
        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_='stixCommon:', name_='RelatedIdentitiesType'):
        pass
    def exportChildren(self, outfile, level, namespace_='stixCommon:', name_='RelatedIdentitiesType', fromsubclass_=False, pretty_print=True):
        if pretty_print:
            eol_ = '\n'
        else:
            eol_ = ''
        for RelatedIdentity_ in self.RelatedIdentity:
            RelatedIdentity_.export(outfile, level, namespace_, name_='RelatedIdentity', pretty_print=pretty_print)
    def hasContent_(self):
        if (
            self.RelatedIdentity
            ):
            return True
        else:
            return False
    def exportLiteral(self, outfile, level, name_='RelatedIdentitiesType'):
        level += 1
        self.exportLiteralAttributes(outfile, level, [], name_)
        if self.hasContent_():
            self.exportLiteralChildren(outfile, level, name_)
    def exportLiteralAttributes(self, outfile, level, already_processed, name_):
        pass
    def exportLiteralChildren(self, outfile, level, name_):
        showIndent(outfile, level)
        outfile.write('RelatedIdentity=[\n')
        level += 1
        for RelatedIdentity_ in self.RelatedIdentity:
            showIndent(outfile, level)
            outfile.write('model_.RelatedIdentityType(\n')
            RelatedIdentity_.exportLiteral(outfile, level, name_='RelatedIdentityType')
            showIndent(outfile, level)
            outfile.write('),\n')
        level -= 1
        showIndent(outfile, level)
        outfile.write('],\n')
    def build(self, node):
        self.buildAttributes(node, node.attrib, [])
        for child in node:
            nodeName_ = Tag_pattern_.match(child.tag).groups()[-1]
            self.buildChildren(child, node, nodeName_)
    def buildAttributes(self, node, attrs, already_processed):
        pass
    def buildChildren(self, child_, node, nodeName_, fromsubclass_=False):
        if nodeName_ == 'RelatedIdentity':
            obj_ = RelatedIdentityType.factory()
            obj_.build(child_)
            self.RelatedIdentity.append(obj_)
# end class RelatedIdentitiesType


class RelatedIdentityType(IdentityType):
    """Specifies the nature of the relationship between the enclosing
    entity and the other."""
    subclass = None
    superclass = IdentityType
    def __init__(self, PartyType=None, FreeTextLines=None, PartyName=None, Addresses=None, Accounts=None, ContactNumbers=None, Documents=None, ElectronicAddressIdentifiers=None, Events=None, Identifiers=None, Memberships=None, Relationships=None, Revenues=None, Stocks=None, Vehicles=None, OrganisationInfo=None, PersonInfo=None, BirthInfo=None, CountriesOfResidence=None, Favourites=None, Habits=None, Hobbies=None, Languages=None, Nationalities=None, Occupations=None, PhysicalInfo=None, Preferences=None, Qualifications=None, Visas=None, idref=None, id=None, Role=None, RelatedIdentities=None, relationshipType=None):
        super(RelatedIdentityType, self).__init__(PartyType, FreeTextLines, PartyName, Addresses, Accounts, ContactNumbers, Documents, ElectronicAddressIdentifiers, Events, Identifiers, Memberships, Relationships, Revenues, Stocks, Vehicles, OrganisationInfo, PersonInfo, BirthInfo, CountriesOfResidence, Favourites, Habits, Hobbies, Languages, Nationalities, Occupations, PhysicalInfo, Preferences, Qualifications, Visas, idref, id, Role, RelatedIdentities, )
        self.relationshipType = _cast(None, relationshipType)
        pass
    def factory(*args_, **kwargs_):
        if RelatedIdentityType.subclass:
            return RelatedIdentityType.subclass(*args_, **kwargs_)
        else:
            return RelatedIdentityType(*args_, **kwargs_)
    factory = staticmethod(factory)
    def get_relationshipType(self): return self.relationshipType
    def set_relationshipType(self, relationshipType): self.relationshipType = relationshipType
    def export(self, outfile, level, namespace_='stixCommon:', name_='RelatedIdentityType', 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 = []
        self.exportAttributes(outfile, level, already_processed, namespace_, name_='RelatedIdentityType')
        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_='stixCommon:', name_='RelatedIdentityType'):
        super(RelatedIdentityType, self).exportAttributes(outfile, level, already_processed, namespace_, name_='RelatedIdentityType')
        if self.relationshipType is not None and 'relationshipType' not in already_processed:
            already_processed.append('relationshipType')
            outfile.write(' relationshipType=%s' % (self.gds_format_string(quote_attrib(self.relationshipType).encode(ExternalEncoding), input_name='relationshipType'), ))
    def exportChildren(self, outfile, level, namespace_='stixCommon:', name_='RelatedIdentityType', fromsubclass_=False, pretty_print=True):
        super(RelatedIdentityType, self).exportChildren(outfile, level, namespace_, name_, True, pretty_print=pretty_print)
    def hasContent_(self):
        if (
            super(RelatedIdentityType, self).hasContent_()
            ):
            return True
        else:
            return False
    def exportLiteral(self, outfile, level, name_='RelatedIdentityType'):
        level += 1
        self.exportLiteralAttributes(outfile, level, [], name_)
        if self.hasContent_():
            self.exportLiteralChildren(outfile, level, name_)
    def exportLiteralAttributes(self, outfile, level, already_processed, name_):
        if self.relationshipType is not None and 'relationshipType' not in already_processed:
            already_processed.append('relationshipType')
            showIndent(outfile, level)
            outfile.write('relationshipType = "%s",\n' % (self.relationshipType,))
        super(RelatedIdentityType, self).exportLiteralAttributes(outfile, level, already_processed, name_)
    def exportLiteralChildren(self, outfile, level, name_):
        super(RelatedIdentityType, self).exportLiteralChildren(outfile, level, name_)
    def build(self, node):
        self.buildAttributes(node, node.attrib, [])
        for child in node:
            nodeName_ = Tag_pattern_.match(child.tag).groups()[-1]
            self.buildChildren(child, node, nodeName_)
    def buildAttributes(self, node, attrs, already_processed):
        value = find_attr_value_('relationshipType', node)
        if value is not None and 'relationshipType' not in already_processed:
            already_processed.append('relationshipType')
            self.relationshipType = value
        super(RelatedIdentityType, self).buildAttributes(node, attrs, already_processed)
    def buildChildren(self, child_, node, nodeName_, fromsubclass_=False):
        super(RelatedIdentityType, self).buildChildren(child_, node, nodeName_, True)
        pass
# end class RelatedIdentityType




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

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

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

def parse(inFileName):
    doc = parsexml_(inFileName)
    rootNode = doc.getroot()
    rootTag, rootClass = get_root_tag(rootNode)
    if rootClass is None:
        rootTag = 'InformationSourceType'
        rootClass = InformationSourceType
    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_='',
        pretty_print=True)
    return rootObj

def parseString(inString):
    from StringIO import StringIO
    doc = parsexml_(StringIO(inString))
    rootNode = doc.getroot()
    rootTag, rootClass = get_root_tag(rootNode)
    if rootClass is None:
        rootTag = 'InformationSourceType'
        rootClass = InformationSourceType
    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_="InformationSourceType",
        namespacedef_='')
    return rootObj

def parseLiteral(inFileName):
    doc = parsexml_(inFileName)
    rootNode = doc.getroot()
    rootTag, rootClass = get_root_tag(rootNode)
    if rootClass is None:
        rootTag = 'InformationSourceType'
        rootClass = InformationSourceType
    rootObj = rootClass.factory()
    rootObj.build(rootNode)
    # Enable Python to collect the space used by the DOM.
    doc = None
    sys.stdout.write('#from stix_common_0_2 import *\n\n')
    sys.stdout.write('import stix.bindings.stix_common_0_2 as stix_common_binding 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__ = [
    "InformationSourceType",
    "ConfidenceType",
    "ConfidenceAssertionChainType"
    "IntentType",
    "ActivityType",
    "KillChainType",
    "KillChainPhaseType",
    "TLPHandlingGuidanceType",
    "STIX_CIQ_Identity_Type",
    "IdentityType"
    ]
