from robottypes import unic
# See
_ILLEGAL_CHARS_IN_XML = [ u'\x00', u'\x01', u'\x02', u'\x03', u'\x04', u'\x05',
u'\x06', u'\x07', u'\x08', u'\x0b', u'\x0c', u'\x0e',
u'\x0f', u'\x10', u'\x11', u'\x12', u'\x13', u'\x14',
u'\x15', u'\x16', u'\x17', u'\x18', u'\x19', u'\x1a',
u'\x1b', u'\x1c', u'\x1d', u'\x1e', u'\x1f' ]
class AbstractXmlWriter:
def start(self, name, attributes={}, newline=True):
raise NotImplementedError
def content(self, content):
raise NotImplementedError
def end(self, name, newline=True):
raise NotImplementedError
def element(self, name, content=None, attributes={}, newline=True):
self.start(name, attributes, newline=False)
self.content(content)
self.end(name, newline)
def close(self):
raise NotImplementedError
def _encode(self, message):
message = unic(message)
for char in _ILLEGAL_CHARS_IN_XML:
message = message.replace(char, '')
return message
文件路径:C:\Python26\lib\site-packages\robot\abstractxmlwriter.py
功能:定义xml中的非法字符。定义了写XML的基类类:AbstractXmlWriter。很多内容留待子类的实现,调用会报AbstractXmlWriter异常。只有element和_encode有实际的实现。
阅读(20394) | 评论(0) | 转发(0) |