Skip to content

Commit

Permalink
Merge pull request #322 from emmanvg/stix1.1.1
Browse files Browse the repository at this point in the history
Resolve CIQIdentity resolution
  • Loading branch information
gtback authored May 23, 2017
2 parents 15f669e + 5f26d40 commit 31dfdea
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 16 deletions.
2 changes: 1 addition & 1 deletion stix/bindings/extensions/address/ciq_address_3_0.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class CIQAddress3_0InstanceType(stix_common_binding.AddressAbstractType):
superclass = stix_common_binding.AddressAbstractType

xmlns = XML_NS
xmlns_prefix = "ciqAddress"
xmlns_prefix = "stix-ciqaddress"
xml_type = "CIQAddress3.0InstanceType"
xsi_type = "%s:%s" % (xmlns_prefix, xml_type)

Expand Down
19 changes: 4 additions & 15 deletions stix/bindings/stix_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -606,22 +606,12 @@ def buildChildren(self, child_, node, nodeName_, fromsubclass_=False):
obj_.build(child_)
self.set_Description(obj_)
elif nodeName_ == 'Identity':
type_name_ = child_.attrib.get('{http://www.w3.org/2001/XMLSchema-instance}type')
if type_name_ is None:
type_name_ = child_.attrib.get('type')
if type_name_ is not None:
type_names_ = type_name_.split(':')
if len(type_names_) == 1:
type_name_ = type_names_[0]
else:
type_name_ = type_names_[1]

if type_name_ == "CIQIdentity3.0InstanceType":
import stix.bindings.extensions.identity.ciq_identity_3_0 as ciq_identity_binding
obj_ = ciq_identity_binding.CIQIdentity3_0InstanceType.factory()
else:
obj_ = IdentityType.factory() # IdentityType is not abstract
from stix.bindings.extensions.identity import ciq_identity_3_0

# Look for xsi:type. If not there, build an instance of
# IdentityType
obj_ = lookup_extension(child_, IdentityType).factory()
obj_.build(child_)
self.set_Identity(obj_)
elif nodeName_ == 'Role':
Expand Down Expand Up @@ -1277,7 +1267,6 @@ def __init__(self, idref=None, id=None, Name=None, Related_Identities=None):
self.id = _cast(None, id)
self.Name = Name
self.Related_Identities = Related_Identities
self.xsi_type = None
def factory(*args_, **kwargs_):
if IdentityType.subclass:
return IdentityType.subclass(*args_, **kwargs_)
Expand Down

0 comments on commit 31dfdea

Please sign in to comment.