(self, xmlobj)
Changes CISCP Domain Objects into CybOX URI Objects

        Keyword arguments
        xmlobj -- an etree Element object
Changes CISCP Domain Objects into CybOX URI Objects
Changes CISCP Domain Objects into CybOX URI Objects
def _fix_domain_obj(self, xmlobj):
        """Changes CISCP Domain Objects into CybOX URI Objects

        Keyword arguments
        xmlobj -- an etree Element object
        """
        tag_xsi_type = "{%s}type" % (self.XML_NS_XSI)
        tag_uri_value = "{%s}Value" % (self.XML_NS_OBJ_URI)

        xpath_domain_obj = ".//%s:Properties[@%s:type='%s:DomainObjectType' and @type='FQDN']" % (self.XML_NS_PREFIX_CYBOX, self.XML_NS_PREFIX_XSI, self.XML_NS_PREFIX_OBJ_DOMAIN)
        domain_objs = xmlobj.xpath(xpath_domain_obj, namespaces=self.XML_NS_DICT)

        if domain_objs is not None and len(domain_objs) > 0:
            uri_obj_prefix = self._get_prefix_for_namespace(self.XML_NS_OBJ_URI, xmlobj.nsmap) # this should always return a value

            for domain_obj in domain_objs:
                domain_obj.attrib[tag_xsi_type] = "%s:URIObjectType" % (uri_obj_prefix)
                domain_obj.attrib['type'] = 'Domain Name'
                value = domain_obj.find('{%s}Value' % (self.XML_NS_OBJ_DOMAIN))
                if value is not None: value.tag = tag_uri_value
def _fix_domain_obj ( self , xmlobj ) : tag_xsi_type = "{%s}type" % ( self . XML_NS_XSI ) tag_uri_value = "{%s}Value" % ( self . XML_NS_OBJ_URI ) xpath_domain_obj = ".//%s:Properties[@%s:type='%s:DomainObjectType' and @type='FQDN']" % ( self . XML_NS_PREFIX_CYBOX , self . XML_NS_PREFIX_XSI , self . XML_NS_PREFIX_OBJ_DOMAIN ) domain_objs = xmlobj . xpath ( xpath_domain_obj , namespaces = self . XML_NS_DICT ) if domain_objs is not None and len ( domain_objs ) > 0 : uri_obj_prefix = self . _get_prefix_for_namespace ( self . XML_NS_OBJ_URI , xmlobj . nsmap ) # this should always return a value for domain_obj in domain_objs : domain_obj . attrib [ tag_xsi_type ] = "%s:URIObjectType" % ( uri_obj_prefix ) domain_obj . attrib [ 'type' ] = 'Domain Name' value = domain_obj . find ( '{%s}Value' % ( self . XML_NS_OBJ_DOMAIN ) ) if value is not None : value . tag = tag_uri_value