def namespace_uri_for_prefix(xc, p, contextItem, args): prefix = nodeArg(xc, args, 0, 'string?', emptyFallback='') node = nodeArg(xc, args, 1, 'element()', emptyFallback=()) if node and isinstance( node, xml.dom.Node) and node.nodeType == xml.dom.Node.ELEMENT_NODE: return XmlUtil.xmlns(node, prefix) return ()
def nodes_correspond(xc, p, args): if len(args) != 2: raise XPathContext.FunctionNumArgs() node1 = nodeArg(xc, args, 0, "node()?", missingArgFallback=(), emptyFallback=()) node2 = nodeArg(xc, args, 1, "node()?", missingArgFallback=(), emptyFallback=()) if node1 == (): if node2 == (): return True return False if node2 == (): return False return XbrlUtil.nodesCorrespond(xc.modelXbrl, node1, node2, xc.modelXbrl)
def Node_functions(xc, contextItem, args, name=None, localName=None, namespaceURI=None): node = nodeArg(xc, args, 0, 'node()?', missingArgFallback=contextItem, emptyFallback=()) if node != () and isinstance(node, ModelObject): if name: return node.prefixedName if localName: return node.localName if namespaceURI: return node.namespaceURI return ''
def Node_functions(xc, contextItem, args, name=None, localName=None, namespaceURI=None): node = nodeArg(xc, args, 0, 'node()?', missingArgFallback=contextItem, emptyFallback=()) if node != () and node.nodeType in (xml.dom.Node.ELEMENT_NODE, xml.dom.Node.ATTRIBUTE_NODE): if name: return node.tagName if localName: return node.localName if namespaceURI: return node.namespaceURI return ''
def node_name(xc, p, contextItem, args): node = nodeArg(xc, args, 0, "node()?", missingArgFallback=contextItem, emptyFallback=()) if node != (): return qname(node) return ()
def nilled(xc, p, contextItem, args): node = nodeArg(xc, args, 0, "node()?", missingArgFallback=contextItem, emptyFallback=()) if node != () and node.nodeType == xml.dom.Node.ELEMENT_NODE: return node.getAttribute("xsi:nil") == "true" return ()
def nilled(xc, p, contextItem, args): node = nodeArg(xc, args, 0, "node()?", missingArgFallback=contextItem, emptyFallback=()) if node != () and isinstance(node, ModelObject): return node.get( "{http://www.w3.org/2001/XMLSchema-instance}nil") == "true" return ()
def namespace_uri_for_prefix(xc, p, contextItem, args): prefix = nodeArg(xc, args, 0, 'string?', emptyFallback='') node = nodeArg(xc, args, 1, 'element()', emptyFallback=()) if node is not None and isinstance(node,ModelObject): return XmlUtil.xmlns(node, prefix) return ()
def nilled(xc, p, contextItem, args): node = nodeArg(xc, args, 0, "node()?", missingArgFallback=contextItem, emptyFallback=()) if node != () and isinstance(node,ModelObject): return node.get("{http://www.w3.org/2001/XMLSchema-instance}nil") == "true" return ()
def namespace_uri_for_prefix(xc, p, contextItem, args): prefix = nodeArg(xc, args, 0, 'string?', emptyFallback='') node = nodeArg(xc, args, 1, 'element()', emptyFallback=()) if node and isinstance(node,xml.dom.Node) and node.nodeType == xml.dom.Node.ELEMENT_NODE: return XmlUtil.xmlns(node, prefix) return ()