本文整理汇总了Python中arelle.ModelDocument.loadSchemalocatedSchema方法的典型用法代码示例。如果您正苦于以下问题:Python ModelDocument.loadSchemalocatedSchema方法的具体用法?Python ModelDocument.loadSchemalocatedSchema怎么用?Python ModelDocument.loadSchemalocatedSchema使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类arelle.ModelDocument
的用法示例。
在下文中一共展示了ModelDocument.loadSchemalocatedSchema方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: lookup
# 需要导入模块: from arelle import ModelDocument [as 别名]
# 或者: from arelle.ModelDocument import loadSchemalocatedSchema [as 别名]
def lookup(self, document, proxyElement):
# check if proxyElement's namespace is not known
ns, sep, ln = proxyElement.tag.partition("}")
if sep:
ns = ns[1:]
else:
ln = ns
ns = None
if (ns and
ns not in self.discoveryAttempts and
ns not in self.modelXbrl.namespaceDocs):
# is schema loadable? requires a schemaLocation
from arelle import XmlUtil, ModelDocument
relativeUrl = XmlUtil.schemaLocation(proxyElement, ns)
self.discoveryAttempts.add(ns)
if relativeUrl:
doc = ModelDocument.loadSchemalocatedSchema(self.modelXbrl, proxyElement, relativeUrl, ns, self.baseUrl)
modelObjectClass = self.modelXbrl.matchSubstitutionGroup(
qnameNsLocalName(ns, ln),
elementSubstitutionModelClass)
if modelObjectClass is not None:
return modelObjectClass
else:
xlinkType = proxyElement.get("{http://www.w3.org/1999/xlink}type")
if xlinkType == "extended": return ModelLink
elif xlinkType == "locator": return ModelLocator
elif xlinkType == "resource": return ModelResource
return ModelObject
示例2: lookup
# 需要导入模块: from arelle import ModelDocument [as 别名]
# 或者: from arelle.ModelDocument import loadSchemalocatedSchema [as 别名]
def lookup(self, document, proxyElement):
# check if proxyElement's namespace is not known
ns, sep, ln = proxyElement.tag.partition("}")
if sep:
ns = ns[1:]
else:
ln = ns
ns = None
if (ns and
ns not in self.discoveryAttempts and
ns not in self.modelXbrl.namespaceDocs):
# is schema loadable? requires a schemaLocation
relativeUrl = XmlUtil.schemaLocation(proxyElement, ns)
self.discoveryAttempts.add(ns)
if relativeUrl:
doc = ModelDocument.loadSchemalocatedSchema(self.modelXbrl, proxyElement, relativeUrl, ns, self.baseUrl)
modelObjectClass = self.modelXbrl.matchSubstitutionGroup(
qnameNsLocalName(ns, ln),
elementSubstitutionModelClass)
if modelObjectClass is not None:
return modelObjectClass
elif (self.streamingOrSkipDTS and
ns not in (XbrlConst.xbrli, XbrlConst.link)):
# self.makeelementParentModelObject is set in streamingExtensions.py and ModelXbrl.createFact
ancestor = proxyElement.getparent() or getattr(self.modelXbrl, "makeelementParentModelObject", None)
while ancestor is not None:
tag = ancestor.tag # not a modelObject yet, just parser prototype
if tag.startswith("{http://www.xbrl.org/2003/instance}") or tag.startswith("{http://www.xbrl.org/2003/linkbase}"):
if tag == "{http://www.xbrl.org/2003/instance}xbrl":
return ModelFact # element not parented by context or footnoteLink
else:
break # cannot be a fact
ancestor = ancestor.getparent()
xlinkType = proxyElement.get("{http://www.w3.org/1999/xlink}type")
if xlinkType == "extended": return ModelLink
elif xlinkType == "locator": return ModelLocator
elif xlinkType == "resource": return ModelResource
return ModelObject