Version: 1.1.119
libtaxii.common
Module¶
Common utility classes and functions used throughout libtaxii.
Functions¶
- libtaxii.common.get_xml_parser()[source]¶
Return the XML parser currently in use.
If one has not already been set (via
set_xml_parser()
), a newetree.XMLParser
is constructed withno_network=True
andhuge_tree=False
.
Classes¶
- class libtaxii.common.TAXIIBase[source]¶
Base class for all TAXII Messages and Message component types.
libtaxii users should not need to use this class directly.
- classmethod from_dict(d)[source]¶
Create an instance of this class from a dictionary.
Subclasses must implement this method.
- classmethod from_etree(src_etree)[source]¶
Create an instance of this class from an etree.
Subclasses must implement this method.
- classmethod from_xml(xml)[source]¶
Create an instance of this class from XML.
Subclasses should not need to implement this method.
- property sort_key¶
This property allows list of TAXII objects to be compared efficiently. The __eq__ method uses this property to sort the lists before comparisons are made.
Subclasses must implement this property.
- to_dict()[source]¶
Create a dictionary representation of this class.
Subclasses must implement this method.
- to_etree()[source]¶
Create an etree representation of this class.
Subclasses must implement this method.
- to_json()[source]¶
Create a JSON object of this class.
Assumes any binary content will be UTF-8 encoded.
- to_text(line_prepend='')[source]¶
Create a nice looking (this is a subjective term!) textual representation of this class. Subclasses should implement this method.
Note that this is just a convenience method for making TAXII Messages nice to read for humans and may change drastically in future versions of libtaxii.