当前位置: 首页>>代码示例>>Python>>正文


Python OdfParser.endElement方法代码示例

本文整理汇总了Python中appy.pod.odf_parser.OdfParser.endElement方法的典型用法代码示例。如果您正苦于以下问题:Python OdfParser.endElement方法的具体用法?Python OdfParser.endElement怎么用?Python OdfParser.endElement使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在appy.pod.odf_parser.OdfParser的用法示例。


在下文中一共展示了OdfParser.endElement方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: endElement

# 需要导入模块: from appy.pod.odf_parser import OdfParser [as 别名]
# 或者: from appy.pod.odf_parser.OdfParser import endElement [as 别名]
 def endElement(self, elem):
     e = OdfParser.endElement(self, elem)
     if elem == "%s:annotation" % e.ns(e.NS_OFFICE):
         self.inAnnotation = False
         self.ignore = False
     if not self.ignore:
         self.res += "</%s>" % elem
开发者ID:PeterEymann,项目名称:appypod,代码行数:9,代码来源:Tester.py

示例2: endElement

# 需要导入模块: from appy.pod.odf_parser import OdfParser [as 别名]
# 或者: from appy.pod.odf_parser.OdfParser import endElement [as 别名]
 def endElement(self, elem):
     e = OdfParser.endElement(self, elem)
     if elem == e.tags['style']:
         e.state = READING
         e.currentStyle = None
     elif elem == e.tags['page-layout']:
         e.state = READING
         e.currentPageLayout = None
     elif elem == e.tags['master-styles']:
         e.state = READING
开发者ID:tonibagur,项目名称:appy,代码行数:12,代码来源:styles_manager.py

示例3: endElement

# 需要导入模块: from appy.pod.odf_parser import OdfParser [as 别名]
# 或者: from appy.pod.odf_parser.OdfParser import endElement [as 别名]
 def endElement(self, elem):
     e = OdfParser.endElement(self, elem)
     if elem == self.styleTag:
         e.state = READING
         e.currentStyle = None
开发者ID:PeterEymann,项目名称:appypod,代码行数:7,代码来源:styles_manager.py

示例4: endElement

# 需要导入模块: from appy.pod.odf_parser import OdfParser [as 别名]
# 或者: from appy.pod.odf_parser.OdfParser import endElement [as 别名]
 def endElement(self, elem):
     e = OdfParser.endElement(self, elem)
     ns = e.onEndElement()
     officeNs = ns[e.NS_OFFICE]
     textNs = ns[e.NS_TEXT]
     if elem in e.ignorableElements:
         e.state = e.READING_CONTENT
     elif elem == e.tags['annotation']:
         # Manage statement
         oldCb = e.currentBuffer
         actionElemIndex = oldCb.createAction(e.currentStatement)
         e.currentStatement = []
         if actionElemIndex != -1:
             e.currentBuffer = oldCb.\
                 transferActionIndependentContent(actionElemIndex)
             if e.currentBuffer == oldCb:
                 e.mode = e.ADD_IN_SUBBUFFER
             else:
                 e.mode = e.ADD_IN_BUFFER
         e.state = e.READING_CONTENT
     else:
         if e.state == e.IGNORING:
             pass
         elif e.state == e.READING_CONTENT:
             # Dump the ODS POD expression if any
             if e.currentOdsExpression:
                 e.currentBuffer.addExpression(e.currentOdsExpression,
                                               tiedHook=e.currentOdsHook)
                 e.currentOdsExpression = None
                 e.currentOdsHook = None
             # Dump the ending tag
             e.currentBuffer.dumpEndElement(elem)
             if elem in e.impactableElements:
                 if isinstance(e.currentBuffer, MemoryBuffer):
                     isMainElement = e.currentBuffer.isMainElement(elem)
                     # Unreference the element among the 'elements' attribute
                     e.currentBuffer.unreferenceElement(elem)
                     if isMainElement:
                         parent = e.currentBuffer.parent
                         if not e.currentBuffer.action:
                             # Delete this buffer and transfer content to
                             # parent.
                             e.currentBuffer.transferAllContent()
                             parent.removeLastSubBuffer()
                             e.currentBuffer = parent
                         else:
                             if isinstance(parent, FileBuffer):
                                 # Execute buffer action and delete the
                                 # buffer.
                                 e.currentBuffer.action.execute()
                                 parent.removeLastSubBuffer()
                             e.currentBuffer = parent
                         e.mode = e.ADD_IN_SUBBUFFER
         elif e.state == e.READING_STATEMENT:
             if e.currentElem.elem == Text.OD.elem:
                 statementLine = e.currentContent.strip()
                 if statementLine:
                     e.currentStatement.append(statementLine)
                 e.currentContent = ''
         elif e.state == e.READING_EXPRESSION:
             if (elem == e.tags['change-end']) or \
                (elem == e.tags['conditional-text']):
                 expression = e.currentContent.strip()
                 e.currentContent = ''
                 # Manage expression
                 e.currentBuffer.addExpression(expression)
                 if e.exprHasStyle:
                     e.currentBuffer.dumpEndElement(e.tags['span'])
                 e.state = e.READING_CONTENT
开发者ID:akarambir,项目名称:django-sis,代码行数:71,代码来源:pod_parser.py


注:本文中的appy.pod.odf_parser.OdfParser.endElement方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。