I can read this structure into a Python model, but when I call to_xml to render it back, I get a error:
File "/usr/local/lib/python3.6/site-packages/cybox/bindings/cybox_common.py", line 3375, in exportAttributes
if self.apply_condition is not None and (self.delimiter is not None and self.delimiter in self.valueOf_):
To avoid this, the binding logic for apply_condition can check if valueOf_ is not None before attempting the delimiter in valueOf_ check:
if self.apply_condition is not None and (self.delimiter is not None and self.valueOf_ is not None and self.delimiter in self.valueOf_):
There may be other places where this error could manifest as well, wherever the generated bindings require a string instead of None in valueOf_.
This could also be fixed outside the bindings (perhaps) by enforcing an empty-string value instead of None for valueOf_ in a self-closing tag.
I have a file that includes the following structure:
I can read this structure into a Python model, but when I call
to_xml
to render it back, I get a error:To avoid this, the binding logic for
apply_condition
can check ifvalueOf_ is not None
before attempting thedelimiter in valueOf_
check:There may be other places where this error could manifest as well, wherever the generated bindings require a string instead of
None
invalueOf_
.This could also be fixed outside the bindings (perhaps) by enforcing an empty-string value instead of
None
forvalueOf_
in a self-closing tag.