dcc_quantities.serializers.dcc_element_key

Serialization of DCC elements that can be extracted from the XML file.

DccElementKey

Enumeration where all elements have the corresponding DCC-XML key as value.

Each element value corresponds to a key 'dcc:{element_name}', which is a standardized DCC key for an XML file. All members of the DccElementKey instances are strings and allow any string method.

Attributes:
  • CONTENT (str) –

    Member corresponding to the key 'dcc:content'.

  • LIST (str) –

    Member corresponding to the key 'dcc:list'.

  • TABLE (str) –

    Alias to DccElementKey.LIST.

  • NAME (str) –

    Member corresponding to the key 'dcc:name'.

  • QUANTITY (str) –

    Member corresponding to the key 'dcc:quantity'.

Notes

The string 'dcc:{element_name}' can also be used instead of calling directly a member of this class. For example DccElementKey.CONTENT is equivalent to parsing the string 'dcc:content'.

Examples:

>>> content_key = DccElementKey.CONTENT
>>> repr(content_key)
"<DccElementKey.CONTENT: 'dcc:content'>"
>>> print(content_key)
dcc:content
>>> table_key = DccElementKey.TABLE
>>> repr(table_key)
"<DccElementKey.LIST: 'dcc:list'>"
>>> print(table_key)
dcc:list
>>> table_key == "dcc:list"
True