E5XML/XMLStreamWriterBase.py

changeset 605
9c7527ecbf6e
parent 573
3fd49348ea83
child 610
3a625b0793d8
equal deleted inserted replaced
604:a2671d497b49 605:9c7527ecbf6e
38 dict : self._write_dictionary, 38 dict : self._write_dictionary,
39 set : self._write_set, 39 set : self._write_set,
40 frozenset : self._write_frozenset, 40 frozenset : self._write_frozenset,
41 } 41 }
42 42
43 self.NEWPARA = chr(0x2029)
44 self.NEWLINE = chr(0x2028)
45
46 self.setAutoFormatting(True) 43 self.setAutoFormatting(True)
47 self.setAutoFormattingIndent(2) 44 self.setAutoFormattingIndent(2)
48 45
49 def writeXML(self): 46 def writeXML(self):
50 """ 47 """
51 Public method to write the XML to the file. 48 Public method to write the XML to the file.
52 """ 49 """
53 # write the XML header 50 # write the XML header
54 self.writeStartDocument() 51 self.writeStartDocument()
55
56 def encodedNewLines(self, text):
57 """
58 Public method to encode newlines and paragraph breaks.
59
60 @param text text to encode (string)
61 """
62 return text.replace("\n\n", self.NEWPARA).replace("\n", self.NEWLINE)
63 52
64 def _writeBasics(self, pyobject): 53 def _writeBasics(self, pyobject):
65 """ 54 """
66 Protected method to dump an object of a basic Python type. 55 Protected method to dump an object of a basic Python type.
67 56

eric ide

mercurial