本文整理汇总了Python中utils.xml2str函数的典型用法代码示例。如果您正苦于以下问题:Python xml2str函数的具体用法?Python xml2str怎么用?Python xml2str使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了xml2str函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _textual
def _textual(self, node):
rc1 = utils._process_text(self, node.text or '')
for n in utils._child_get(node,self):
txt_n = copy.deepcopy(n)
for key in txt_n.attrib.keys():
if key in ('rml_except', 'rml_loop', 'rml_tag'):
del txt_n.attrib[key]
if not n.tag == 'bullet':
txt_n.text = utils.xml2str(self._textual(n))
txt_n.tail = n.tail and utils.xml2str(utils._process_text(self, n.tail.replace('\n',''))) or ''
rc1 += etree.tostring(txt_n)
return rc1
示例2: _textual
def _textual(self, node):
rc1 = utils._process_text(self, node.text or "")
for n in utils._child_get(node, self):
txt_n = copy.deepcopy(n)
for key in txt_n.attrib.keys():
if key in ("rml_except", "rml_loop", "rml_tag"):
del txt_n.attrib[key]
if not n.tag == "bullet":
if n.tag == "pageNumber":
txt_n.text = self.canvas and str(self.canvas.getPageNumber()) or ""
else:
txt_n.text = utils.xml2str(self._textual(n))
txt_n.tail = n.tail and utils.xml2str(utils._process_text(self, n.tail.replace("\n", ""))) or ""
rc1 += etree.tostring(txt_n)
return rc1
示例3: _drawString
def _drawString(self, node):
v = utils.attr_get(node, ['x','y'])
text=self._textual(node, **v)
text = utils.xml2str(text)
try:
self.canvas.drawString(text=text, **v)
except TypeError as e:
_logger.error("Bad RML: <drawString> tag requires attributes 'x' and 'y'!")
raise e
示例4: _drawRightString
def _drawRightString(self, node):
v = utils.attr_get(node, ['x','y'])
text=self._textual(node, **v)
text = utils.xml2str(text)
self.canvas.drawRightString(text=text, **v)
示例5: _drawCenteredString
def _drawCenteredString(self, node):
v = utils.attr_get(node, ["x", "y"])
text = self._textual(node, **v)
text = utils.xml2str(text)
self.canvas.drawCentredString(text=text, **v)