Yields the sentence as an XML-formatted string (plain bytestring, UTF-8 encoded). All the sentences in the XML are wrapped in a element.
(self)
| 1092 | |
| 1093 | @property |
| 1094 | def xml(self): |
| 1095 | """ Yields the sentence as an XML-formatted string (plain bytestring, UTF-8 encoded). |
| 1096 | All the sentences in the XML are wrapped in a <text> element. |
| 1097 | """ |
| 1098 | xml = [] |
| 1099 | xml.append('<?xml version="1.0" encoding="%s"?>' % XML_ENCODING.get(self.encoding, self.encoding)) |
| 1100 | xml.append("<%s>" % XML_TEXT) |
| 1101 | xml.extend([sentence.xml for sentence in self]) |
| 1102 | xml.append("</%s>" % XML_TEXT) |
| 1103 | return "\n".join(xml) |
| 1104 | |
| 1105 | @classmethod |
| 1106 | def from_xml(cls, xml): |