You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#!/usr/bin/env python# Copyright (c) 2014, The MITRE Corporation. All rights reserved.# See LICENSE.txt for complete terms.'''File: ex_01.pyDescription: Round-trip example. This script takes a STIX instance document from XML toa binding object, then to a api object and then to a dictionary. That dictionary is thenconverted back into an api object, which is then used to generate an XML document.'''importiofrompprintimportpprintfromstix.coreimportSTIXPackagedefmain():
fn='input.xml'stix_package=STIXPackage.from_xml(fn)
stix_dict=stix_package.to_dict() # parse to dictionarypprint(stix_dict)
stix_package_two=STIXPackage.from_dict(stix_dict) # create python-stix object from dictionaryxml=stix_package_two.to_xml() # generate xml from python-stix objectprint(xml)
if__name__=='__main__':
main()
The value of the
'xsi:type'
property in theto_dict()
result is missing the'[namespace]:'
( see AddressObj:AddressObjectType example)input.xml
script.py
output.json
The text was updated successfully, but these errors were encountered: