def schemalocateElementNamespace(self, element): eltNamespace = element.namespaceURI if eltNamespace not in self.modelXbrl.namespaceDocs and eltNamespace not in self.referencedNamespaces: schemaLocationElement = XmlUtil.schemaLocation(element, eltNamespace, returnElement=True) if schemaLocationElement is not None: self.schemaLocationElements.add(schemaLocationElement) self.referencedNamespaces.add(eltNamespace)
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
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( qname(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
def schemalocateElementNamespace(self, element): eltNamespace = element.namespaceURI if eltNamespace not in self.modelXbrl.namespaceDocs and eltNamespace not in self.referencedNamespaces: schemaLocationElement = XmlUtil.schemaLocation( element, eltNamespace) if schemaLocationElement: self.schemaLocationElements.add(schemaLocationElement) self.referencedNamespaces.add(eltNamespace)
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
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