def pushQName(sourceStr, loc, toks): qname = toks[0] if xmlElement is not None: nsLocalname = XmlUtil.prefixedNameToNamespaceLocalname( xmlElement, qname, defaultNsmap=defaultNsmap) if nsLocalname is None: modelXbrl.error("err:XPST0081", _("QName prefix not defined for %(name)s"), modelObject=xmlElement, name=qname) return if (nsLocalname == (XbrlConst.xff, "uncovered-aspect") and xmlElement.localName not in ("formula", "consistencyAssertion", "valueAssertion")): modelXbrl.error( "xffe:invalidFunctionUse", _("Function %(name)s cannot be used on an XPath expression associated with a %(name2)s" ), modelObject=xmlElement, name=qname, name2=xmlElement.localName) else: nsLocalname = (None, qname) q = QNameDef(loc, nsLocalname[2], nsLocalname[0], nsLocalname[1]) if qname not in ("INF", "NaN", "for", "some", "every", "return") and \ len(exprStack) == 0 or exprStack[-1] != q: exprStack.append(q) return q
def pushQName(sourceStr, loc, toks): qname = toks[0] if xmlElement is not None: nsLocalname = XmlUtil.prefixedNameToNamespaceLocalname(xmlElement, qname, defaultNsmap=defaultNsmap) if nsLocalname is None: modelXbrl.error( "err:XPST0081", _("QName prefix not defined for %(name)s"), modelObject=xmlElement, name=qname ) return if nsLocalname == (XbrlConst.xff, "uncovered-aspect") and xmlElement.localName not in ( "formula", "consistencyAssertion", "valueAssertion", ): modelXbrl.error( "xffe:invalidFunctionUse", _("Function %(name)s cannot be used on an XPath expression associated with a %(name2)s"), modelObject=xmlElement, name=qname, name2=xmlElement.localName, ) else: nsLocalname = (None, qname) q = QNameDef(loc, nsLocalname[2], nsLocalname[0], nsLocalname[1]) if qname not in ("INF", "NaN", "for", "some", "every", "return") and len(exprStack) == 0 or exprStack[-1] != q: exprStack.append(q) return q
def pushQName(sourceStr, loc, toks): step = toks[0] axis, sep, qname = step.rpartition( "::") # axes are not splitting correctly if axis not in axesSupported: modelXbrl.error("err:XPST0010", _("Axis %(axis)s is not supported in %(step)s"), modelObject=xmlElement, axis=axis, step=step) return if xmlElement is not None: if qname == '*': # prevent simple wildcard from taking the default namespace nsLocalname = (None, '*', None) else: nsLocalname = XmlUtil.prefixedNameToNamespaceLocalname( xmlElement, qname, defaultNsmap=defaultNsmap) if nsLocalname is None: if qname.startswith("*:"): # wildcad QName special case prefix, sep, localName = qname.partition(":") q = QNameDef(loc, prefix, prefix, localName, axis=axis) if len(exprStack) == 0 or exprStack[-1] != q: exprStack.append(q) return q modelXbrl.error("err:XPST0081", _("QName prefix not defined for %(name)s"), modelObject=xmlElement, name=qname) return if (nsLocalname == (XbrlConst.xff, "uncovered-aspect", "xff") and xmlElement.localName not in ("formula", "consistencyAssertion", "valueAssertion", "message")): modelXbrl.error( "xffe:invalidFunctionUse", _("Function %(name)s cannot be used on an XPath expression associated with a %(name2)s" ), modelObject=xmlElement, name=qname, name2=xmlElement.localName) else: nsLocalname = (None, qname) q = QNameDef(loc, nsLocalname[2], nsLocalname[0], nsLocalname[1], axis=axis) if qname not in ("INF", "NaN", "for", "some", "every", "return") and \ len(exprStack) == 0 or exprStack[-1] != q: exprStack.append(q) return q
def pushQName(sourceStr, loc, toks): step = toks[0] axis, sep, qname = step.rpartition("::") # axes are not splitting correctly if axis not in axesSupported: modelXbrl.error( "err:XPST0010", _("Axis %(axis)s is not supported in %(step)s"), modelObject=xmlElement, axis=axis, step=step, ) return if xmlElement is not None: if qname == "*": # prevent simple wildcard from taking the default namespace nsLocalname = (None, "*", None) else: nsLocalname = XmlUtil.prefixedNameToNamespaceLocalname(xmlElement, qname, defaultNsmap=defaultNsmap) if nsLocalname is None: if qname.startswith("*:"): # wildcad QName special case prefix, sep, localName = qname.partition(":") q = QNameDef(loc, prefix, prefix, localName, axis=axis) if len(exprStack) == 0 or exprStack[-1] != q: exprStack.append(q) return q modelXbrl.error( "err:XPST0081", _("QName prefix not defined for %(name)s"), modelObject=xmlElement, name=qname ) return if nsLocalname == (XbrlConst.xff, "uncovered-aspect", "xff") and xmlElement.localName not in ( "formula", "consistencyAssertion", "valueAssertion", "message", ): modelXbrl.error( "xffe:invalidFunctionUse", _("Function %(name)s cannot be used on an XPath expression associated with a %(name2)s"), modelObject=xmlElement, name=qname, name2=xmlElement.localName, ) else: nsLocalname = (None, qname) q = QNameDef(loc, nsLocalname[2], nsLocalname[0], nsLocalname[1], axis=axis) if qname not in ("INF", "NaN", "for", "some", "every", "return") and len(exprStack) == 0 or exprStack[-1] != q: exprStack.append(q) return q
def pushQName( sourceStr, loc, toks ): qname = toks[0] if xmlElement: nsLocalname = XmlUtil.prefixedNameToNamespaceLocalname(xmlElement, qname) if nsLocalname is None: modelXbrl.error( _("QName prefix not defined for {0}").format(qname), "err","err:XPST0081") return if (nsLocalname == (XbrlConst.xff,"uncovered-aspect") and xmlElement.localName not in ("formula", "consistencyAssertion", "valueAssertion")): modelXbrl.error( _("Function {0} cannot be used on an XPath expression associated with a {1}").format(qname, xmlElement.localName), "err","xffe:invalidFunctionUse") else: nsLocalname = (None,qname) q = QNameDef(loc, nsLocalname[2], nsLocalname[0], nsLocalname[1]) if qname not in ("INF", "NaN", "for", "some", "every", "return") and \ len(exprStack) == 0 or exprStack[-1] != q: exprStack.append( q ) return q