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


Python XmlValidate.xhtmlValidate方法代码示例

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


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

示例1: inlineXbrlDiscover

# 需要导入模块: from arelle import XmlValidate [as 别名]
# 或者: from arelle.XmlValidate import xhtmlValidate [as 别名]
    def inlineXbrlDiscover(self, htmlElement):
        if htmlElement.namespaceURI == XbrlConst.xhtml:  # must validate xhtml
            #load(self.modelXbrl, "http://www.w3.org/2002/08/xhtml/xhtml1-strict.xsd")
            XmlValidate.xhtmlValidate(self.modelXbrl, htmlElement)  # fails on prefixed content
        for inlineElement in htmlElement.iterdescendants(tag="{http://www.xbrl.org/2008/inlineXBRL}references"):
            self.schemaLinkbaseRefsDiscover(inlineElement)
            XmlValidate.validate(self.modelXbrl, inlineElement) # validate instance elements
        for inlineElement in htmlElement.iterdescendants(tag="{http://www.xbrl.org/2008/inlineXBRL}resources"):
            self.instanceContentsDiscover(inlineElement)
            XmlValidate.validate(self.modelXbrl, inlineElement) # validate instance elements
            
        tupleElements = []
        tuplesByTupleID = {}
        for modelInlineTuple in htmlElement.iterdescendants(tag="{http://www.xbrl.org/2008/inlineXBRL}tuple"):
            if isinstance(modelInlineTuple,ModelObject):
                modelInlineTuple.unorderedTupleFacts = []
                if modelInlineTuple.tupleID:
                    tuplesByTupleID[modelInlineTuple.tupleID] = modelInlineTuple
                tupleElements.append(modelInlineTuple)
        # hook up tuples to their container
        for tupleFact in tupleElements:
            self.inlineXbrlLocateFactInTuple(tupleFact, tuplesByTupleID)

        for tag in ("{http://www.xbrl.org/2008/inlineXBRL}nonNumeric", "{http://www.xbrl.org/2008/inlineXBRL}nonFraction", "{http://www.xbrl.org/2008/inlineXBRL}fraction"):
            for modelInlineFact in htmlElement.iterdescendants(tag=tag):
                if isinstance(modelInlineFact,ModelObject):
                    self.inlineXbrlLocateFactInTuple(modelInlineFact, tuplesByTupleID)
        # order tuple facts
        for tupleFact in tupleElements:
            tupleFact.modelTupleFacts = [
                 self.modelXbrl.modelObject(objectIndex) 
                 for order,objectIndex in sorted(tupleFact.unorderedTupleFacts)]
            
        # validate particle structure of elements after transformations and established tuple structure
        for rootModelFact in self.modelXbrl.facts:
            XmlValidate.validate(self.modelXbrl, rootModelFact, ixFacts=True)
开发者ID:jaolguin,项目名称:Arelle,代码行数:38,代码来源:ModelDocument.py


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