E5XML/XMLStreamReaderBase.py

changeset 578
a0ecb2c68208
parent 577
ef42a81128ca
child 589
a9a4620f6767
equal deleted inserted replaced
577:ef42a81128ca 578:a0ecb2c68208
48 self.lineNumber(), self.columnNumber(), self.errorString()) 48 self.lineNumber(), self.columnNumber(), self.errorString())
49 E5MessageBox.warning(None, 49 E5MessageBox.warning(None,
50 self.trUtf8("XML parse error"), 50 self.trUtf8("XML parse error"),
51 self.trUtf8(msg)) 51 self.trUtf8(msg))
52 52
53
54 def readXML(self):
55 """
56 Public method to read and parse the XML document.
57 """
58 pass
59
60 def attribute(self, name, default = ""):
61 """
62 Public method to read the given attribute of the current tag.
63
64 @param name name of the attribute (string)
65 @param default default value (string)
66 """
67 att = self.attributes().value(name)
68 if att == "":
69 att = default
70 return att
53 71
54 def _skipUnknownElement(self): 72 def _skipUnknownElement(self):
55 """ 73 """
56 Protected method to skip over all unknown elements. 74 Protected method to skip over all unknown elements.
57 """ 75 """
115 return val 133 return val
116 elif self.name() == "frozenset": 134 elif self.name() == "frozenset":
117 val = self.__readFrozenset() 135 val = self.__readFrozenset()
118 return val 136 return val
119 elif self.name() == "pickle": 137 elif self.name() == "pickle":
120 encoding = self.attributes().value("encoding") 138 encoding = self.attribute("encoding")
121 if encoding != "base64": 139 if encoding != "base64":
122 self.raiseError(QCoreApplication.translate( 140 self.raiseError(QCoreApplication.translate(
123 "XMLStreamReaderBase", 141 "XMLStreamReaderBase",
124 "Pickle data encoding '{0}' is not supported.")\ 142 "Pickle data encoding '{0}' is not supported.")\
125 .format(encoding)) 143 .format(encoding))

eric ide

mercurial