(self, e_package, source=None)
Adds an Information_Source to the STIX Header if not present.
        If Information_Source is not present, it is added with an Identity
        child element.

        Key argument:
        e_package -- STIX_Package etree Element object
Adds an Information_Source to the STIX Header if not present.
        If Information_Source is not present, it is added with an Identity
        child element.
Adds an Information_Source to the STIX Header if not present . If Information_Source is not present it is added with an Identity child element .
def _fix_information_source(self, e_package, source=None):
        """Adds an Information_Source to the STIX Header if not present.
        If Information_Source is not present, it is added with an Identity
        child element.

        Key argument:
        e_package -- STIX_Package etree Element object
        """
        tag_stix_header = "{%s}STIX_Header" % (self.XML_NS_STIX)
        tag_information_source = "{%s}Information_Source" % (self.XML_NS_STIX)
        tag_identity = "{%s}Identity" % (self.XML_NS_STIX_COMMON)
        tag_name = "{%s}Name" % (self.XML_NS_STIX_COMMON)

        stix_header = e_package.find(tag_stix_header)
        if stix_header is None:
            stix_header = etree.Element(tag_stix_header)
            e_package.insert(0, stix_header)

        information_source = stix_header.find(tag_information_source)
        if information_source is None:
            information_source = etree.Element(tag_information_source)
            stix_header.append(information_source)

        identity = information_source.find(tag_identity)
        if identity is None:
            identity = etree.Element(tag_identity)
            information_source.insert(0, identity)

        name = identity.find(tag_name)
        if name is None:
            name = etree.Element(tag_name)
            identity.insert(0, name)

            if source:
                name.text = source
def _fix_information_source ( self , e_package , source = None ) : tag_stix_header = "{%s}STIX_Header" % ( self . XML_NS_STIX ) tag_information_source = "{%s}Information_Source" % ( self . XML_NS_STIX ) tag_identity = "{%s}Identity" % ( self . XML_NS_STIX_COMMON ) tag_name = "{%s}Name" % ( self . XML_NS_STIX_COMMON ) stix_header = e_package . find ( tag_stix_header ) if stix_header is None : stix_header = etree . Element ( tag_stix_header ) e_package . insert ( 0 , stix_header ) information_source = stix_header . find ( tag_information_source ) if information_source is None : information_source = etree . Element ( tag_information_source ) stix_header . append ( information_source ) identity = information_source . find ( tag_identity ) if identity is None : identity = etree . Element ( tag_identity ) information_source . insert ( 0 , identity ) name = identity . find ( tag_name ) if name is None : name = etree . Element ( tag_name ) identity . insert ( 0 , name ) if source : name . text = source