MCPcopy Create free account
hub / github.com/STIXProject/python-stix / from_xml

Method from_xml

stix/core/stix_package.py:233–249  ·  view source on GitHub ↗

Parses the `xml_file` file-like object and returns a :class:`STIXPackage` instance. Args: xml_file: A file, file-like object, etree._Element, or etree._ElementTree instance. encoding: The character encoding of the `xml_file` input. If

(cls, xml_file, encoding=None)

Source from the content-addressed store, hash-verified

231
232 @classmethod
233 def from_xml(cls, xml_file, encoding=None):
234 """Parses the `xml_file` file-like object and returns a
235 :class:`STIXPackage` instance.
236
237 Args:
238 xml_file: A file, file-like object, etree._Element, or
239 etree._ElementTree instance.
240 encoding: The character encoding of the `xml_file` input. If
241 ``None``, an attempt will be made to determine the input
242 character encoding. Default is ``None``.
243
244 Returns:
245 An instance of :class:`STIXPackage`.
246
247 """
248 entity_parser = parser.EntityParser()
249 return entity_parser.parse_xml(xml_file, encoding=encoding)

Callers 11

test_utf16_roundtripMethod · 0.80
test_deepcopyMethod · 0.80
test_parse_malwareMethod · 0.80
mainFunction · 0.80

Calls

no outgoing calls

Tested by 9

test_utf16_roundtripMethod · 0.64
test_deepcopyMethod · 0.64
test_parse_malwareMethod · 0.64