Skip to content

Commit 31dfdea

Browse files
authored
Merge pull request #322 from emmanvg/stix1.1.1
Resolve CIQIdentity resolution
2 parents 15f669e + 5f26d40 commit 31dfdea

File tree

2 files changed

+5
-16
lines changed

2 files changed

+5
-16
lines changed

stix/bindings/extensions/address/ciq_address_3_0.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class CIQAddress3_0InstanceType(stix_common_binding.AddressAbstractType):
3131
superclass = stix_common_binding.AddressAbstractType
3232

3333
xmlns = XML_NS
34-
xmlns_prefix = "ciqAddress"
34+
xmlns_prefix = "stix-ciqaddress"
3535
xml_type = "CIQAddress3.0InstanceType"
3636
xsi_type = "%s:%s" % (xmlns_prefix, xml_type)
3737

stix/bindings/stix_common.py

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -606,22 +606,12 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False):
606606
obj_.build(child_)
607607
self.set_Description(obj_)
608608
elif nodeName_ == 'Identity':
609-
type_name_ = child_.attrib.get('{http://www.w3.org/2001/XMLSchema-instance}type')
610-
if type_name_ is None:
611-
type_name_ = child_.attrib.get('type')
612-
if type_name_ is not None:
613-
type_names_ = type_name_.split(':')
614-
if len(type_names_) == 1:
615-
type_name_ = type_names_[0]
616-
else:
617-
type_name_ = type_names_[1]
618609

619-
if type_name_ == "CIQIdentity3.0InstanceType":
620-
import stix.bindings.extensions.identity.ciq_identity_3_0 as ciq_identity_binding
621-
obj_ = ciq_identity_binding.CIQIdentity3_0InstanceType.factory()
622-
else:
623-
obj_ = IdentityType.factory() # IdentityType is not abstract
610+
from stix.bindings.extensions.identity import ciq_identity_3_0
624611

612+
# Look for xsi:type. If not there, build an instance of
613+
# IdentityType
614+
obj_ = lookup_extension(child_, IdentityType).factory()
625615
obj_.build(child_)
626616
self.set_Identity(obj_)
627617
elif nodeName_ == 'Role':
@@ -1277,7 +1267,6 @@ def __init__(self, idref=None, id=None, Name=None, Related_Identities=None):
12771267
self.id = _cast(None, id)
12781268
self.Name = Name
12791269
self.Related_Identities = Related_Identities
1280-
self.xsi_type = None
12811270
def factory(*args_, **kwargs_):
12821271
if IdentityType.subclass:
12831272
return IdentityType.subclass(*args_, **kwargs_)

0 commit comments

Comments
 (0)