Skip to content

lxml error on elevation #295

Description

@BartPigula

While trying to elevate a chosen xml file i got an error:

stix2_elevator '/home/b.pigula/cti-ai/data/cisa-xml-files/analysis-reports/aa23-074a.stix__0.xml'
[stixmarx.utils] [WARNING] [2025-09-17 10:41:26,455] No module named 'stix.report'
Results produced by the stix2-elevator are not for production purposes.
Traceback (most recent call last):
  File "/home/b.pigula/cti-ai/cti-env/bin/stix2_elevator", line 8, in <module>
    sys.exit(main())
  File "/home/b.pigula/cti-ai/cti-env/lib/python3.10/site-packages/stix2elevator/cli.py", line 221, in main
    result = elevate(elevator_args.file_)
  File "/home/b.pigula/cti-ai/cti-env/lib/python3.10/site-packages/stix2elevator/__init__.py", line 103, in elevate
    container = stixmarx.parse(stix_package)
  File "/home/b.pigula/cti-ai/cti-env/lib/python3.10/site-packages/stixmarx/__init__.py", line 26, in parse
    stix_package = parser.parse_xml(xml_input, encoding)
  File "/home/b.pigula/cti-ai/cti-env/lib/python3.10/site-packages/stixmarx/parser.py", line 294, in parse_xml
    parser = MarkingParser(root=xml_input, encoding=encoding)
  File "/home/b.pigula/cti-ai/cti-env/lib/python3.10/site-packages/stixmarx/parser.py", line 79, in __init__
    self._markingmap = markingmap.build(self._root, encoding)
  File "/home/b.pigula/cti-ai/cti-env/lib/python3.10/site-packages/stixmarx/markingmap.py", line 237, in build
    marked.addall(nodeset, spec)
  File "/home/b.pigula/cti-ai/cti-env/lib/python3.10/site-packages/stixmarx/markingmap.py", line 157, in addall
    self.add(key, value)
  File "/home/b.pigula/cti-ai/cti-env/lib/python3.10/site-packages/stixmarx/markingmap.py", line 139, in add
    key = self._make_key(key)  # Reduce the amount of casting
  File "/home/b.pigula/cti-ai/cti-env/lib/python3.10/site-packages/stixmarx/markingmap.py", line 120, in _make_key
    elif xml.is_content(node):
  File "/home/b.pigula/cti-ai/cti-env/lib/python3.10/site-packages/stixmarx/xml.py", line 59, in is_content
    return ((isinstance(node, etree._ElementStringResult) or
AttributeError: module 'lxml.etree' has no attribute '_ElementStringResult'. Did you mean: '_ElementUnicodeResult'?

I am using stix2-elevator version 4.1.7 and lxml version 6.0.1. Steps to reproduce the issue are to install those libraries and try to convert any xml file :)
What i've found is that after downgrading lxml to 4.9.3 the conversion runs fine - so i guess the version of lxml should be forced on installation of stix2-elevator

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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