Skip to content

vocabs.py "Value must be one of ..." error when the XML open and close tag is not in the same line #288

@mdhoang

Description

@mdhoang

I got a stix xml with lines like this:

<cyboxCommon:Type condition="Equals" xsi:type="cyboxVocabs:HashNameVocab-1.0">MD5
                                </cyboxCommon:Type>

When trying to do stix.core.STIXPackage.from_xml(file_name), there was an error raised.

ValueError: Value must be one of ('SHA384', 'SSDEEP', 'SHA224', 'SHA1', 'MD6', 'SHA256', 'MD5', 'SHA512'). Received 'MD5
                                '

I tried add on line 84

if v is not None:
    v = v.strip()

and it works. But I don't know if this is a proper fix, and would like this error to be fixed properly for everyone.

Thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions