def to_xml(self, pretty_print=False): """Serialize to XML string. :param pretty_print (optional): `bool` human-readable XML. :returns: `str` XML. """ message = Node("MaltegoMessage") message.append(self.to_node()) return etree.tostring(message, pretty_print=pretty_print)
def to_xml(self, pretty_print=False): """Serialize to XML string. :param pretty_print (optional): `bool` human-readable XML. :returns: `str` XML. """ message = Node('MaltegoMessage') message.append(self.to_node()) return etree.tostring(message, pretty_print=pretty_print)
def to_node(self): """Serialize to `etree.Element` instance. :returns: `etree.Element` instance. """ node = super(TransformResponse, self).to_node() entities_node = Node("Entities", parent=node) for entity in self.entities: entities_node.append(entity.to_node()) return node
def to_node(self): """Serialize to `etree.Element` instance. :returns: `etree.Element` instance. """ node = super(TransformResponse, self).to_node() entities_node = Node('Entities', parent=node) for entity in self.entities: entities_node.append(entity.to_node()) return node
def to_node(self): """Serialize to `etree.Element` instance. :returns: `etree.Element` instance. """ node = Node("Maltego{}Message".format(self.__class__.__name__)) if self.ui_messages: ui_messages = Node("UIMessages", parent=node) for message in self.ui_messages: ui_messages.append(message.to_node()) return node
def to_node(self): """Serialize to `etree.Element` instance. :returns: `etree.Element` instance. """ node = Node( 'Maltego{}Message'.format(self.__class__.__name__) ) if self.ui_messages: ui_messages = Node('UIMessages', parent=node) for message in self.ui_messages: ui_messages.append(message.to_node()) return node