def get_xml_str(self, data: Dict) -> List: """ Creates a string in XML Format using the provided data structure. @param: Dictionary of xml tags and their elements. @return: String of data in xml format. """ return get_elements_from_dict(data)
def handle_xml(self, xml: Element) -> bytes: help_format = xml.get('format') if help_format is None or help_format == "text": # Default help format is text. return simple_response_str('help', 200, 'OK', self._daemon.get_help_text()) elif help_format == "xml": text = get_elements_from_dict( {k: v.as_dict() for k, v in self._daemon.commands.items()}) return simple_response_str('help', 200, 'OK', text) raise OspdCommandError('Bogus help format', 'help')