Module: etree
- twomemo.etree.serialize_device_list(device_list)[source]
- Parameters:
device_list (
Dict[int,SignedLabel|None]) – The device list to serialize. The first entry of each tuple is the device id, and the second entry is the optional signed label.- Return type:
- Returns:
The serialized device list as an XML element.
- twomemo.etree.parse_device_list(element)[source]
- Parameters:
element (
Element) – The XML element to parse the device list from.- Return type:
Dict[int,SignedLabel|None]- Returns:
The extracted device list. The first entry of each tuple is the device id, and the second entry is the optional signed label.
- Raises:
xmlschema.XMLSchemaValidationError – in case the element does not conform to the XML schema given in the specification.
- twomemo.etree.serialize_bundle(bundle)[source]
- Parameters:
bundle (
BundleImpl) – The bundle to serialize.- Return type:
- Returns:
The serialized bundle as an XML element.
- twomemo.etree.parse_bundle(element, bare_jid, device_id)[source]
- Parameters:
- Return type:
- Returns:
The extracted bundle.
- Raises:
xmlschema.XMLSchemaValidationError – in case the element does not conform to the XML schema given in the specification.
- twomemo.etree.parse_message(element, bare_jid)[source]
- Parameters:
- Return type:
- Returns:
The extracted message.
- Raises:
ValueError – in case there is malformed data not caught be the XML schema validation.
xmlschema.XMLSchemaValidationError – in case the element does not conform to the XML schema given in the specification.