Get the namespace of a node
431401
def nsDefs(self):
        
        ret = libxml2mod.xmlNodeGetNsDefs(self._o)
        if ret is None:return None
        __tmp = xmlNs(_obj=ret)
        return __tmp
1079427
static public Namespace gatherNamespaces(Document doc) {
   	NamespaceGatherer gatherer=new NamespaceGatherer();	
   	u.forAllStatementOrBundle(doc.getStatementOrBundle(), 
   	                          gatherer);
   	
   	Namespace ns=gatherer.getNamespace();
   	return ns;
    }
541345
def namespace_inclusion_builder(namespace: Strings) -> NodePredicate:
    """"""
    if isinstance(namespace, str):
        def namespace_filter(_: BELGraph, node: BaseEntity) -> bool:
            """Pass only for a node that has the enclosed namespace."""
            return NAMESPACE in node and node[NAMESPACE] == namespace

    elif isinstance(namespace, Iterable):
        namespaces = set(namespace)

        def namespace_filter(_: BELGraph, node: BaseEntity) -> bool:
            """Pass only for a node that has a namespace in the enclosed set."""
            return NAMESPACE in node and node[NAMESPACE] in namespaces

    else:
        raise TypeError('Invalid type for argument: {}'.format(namespace))

    return namespace_filter
65851
def _node_has_namespace_helper(node: BaseEntity, namespace: str) -> bool:
        
        return namespace == node.get(NAMESPACE)
87691
def findNamespaceURI(self, prefix, node):
        """"""
        attrkey = (self.NS_XMLNS, prefix)
        DOCUMENT_NODE = node.DOCUMENT_NODE
        ELEMENT_NODE = node.ELEMENT_NODE
        while 1:
            if node is None:
                raise DOMException('Value for prefix %s not found.' % prefix)
            if node.nodeType != ELEMENT_NODE:
                node = node.parentNode
                continue
            result = node._attrsNS.get(attrkey, None)
            if result is not None:
                return result.value
            if hasattr(node, '__imported__'):
                raise DOMException('Value for prefix %s not found.' % prefix)
            node = node.parentNode
            if node.nodeType == DOCUMENT_NODE:
                raise DOMException('Value for prefix %s not found.' % prefix)
343205
function isHtmlNamespace(node) {
            var ns;
            return typeof node.namespaceURI == UNDEF || ((ns = node.namespaceURI) === null || ns == "http://www.w3.org/1999/xhtml");
        }
249433
def checkNode(self, namespaceURI=None, localName=None):
        '''
            
        '''
        namespaceURI = namespaceURI or self.namespaceURI
        localName = localName or self.name
        check = False
        if localName and self.node:
            check = self._dom.isElement(self.node, localName, namespaceURI)
        if not check:
            raise NamespaceError, 'unexpected node type %s, expecting %s' %(self.node, localName)
2532
def namespace(self):
        
        if self.m_name == -1 or (self.m_event != const.START_TAG and self.m_event != const.END_TAG):
            return u''

        # No Namespace
        if self.m_namespaceUri == 0xFFFFFFFF:
            return u''

        return self.sb[self.m_namespaceUri]
200245
function (node) {
        var ownerDocument = node.ownerDocument,
            qualified = _gpfWebGetNamespaceAndName(this._nodeName);
        if (qualified) {
            return ownerDocument.createElementNS(qualified.namespace, qualified.name);
        }
        return ownerDocument.createElement(this._nodeName);
    }
542023
def find(self, node, path):
        """"""

        return node.find(path, namespaces=self.namespaces)
1277809
def parse_namespacepath(self, tup_tree):
        

        self.check_node(tup_tree, 'NAMESPACEPATH')

        k = kids(tup_tree)

        if len(k) != 2:
            raise CIMXMLParseError(
                _format("Element {0!A} has invalid number of child elements "
                        "{1!A} (expecting two child elements "
                        "(HOST, LOCALNAMESPACEPATH))", name(tup_tree), k),
                conn_id=self.conn_id)

        host = self.parse_host(k[0])
        namespace = self.parse_localnamespacepath(k[1])

        return (host, namespace)
638073
def get_calling_namespaces():
    """"""
    try: 1//0
    except ZeroDivisionError:
        # Don't start iterating with the current stack-frame to
        # prevent creating reference cycles (f_back is safe).
        frame = sys.exc_info()[2].tb_frame.f_back

    # Find the first frame that *isn't* from this file.  This means
    # that we expect all of the SCons frames that implement an Export()
    # or SConscript() call to be in this file, so that we can identify
    # the first non-Script.SConscript frame as the user's local calling
    # environment, and the locals and globals dictionaries from that
    # frame as the calling namespaces.  See the comment below preceding
    # the DefaultEnvironmentCall block for even more explanation.
    while frame.f_globals.get("__name__") == __name__:
        frame = frame.f_back

    return frame.f_locals, frame.f_globals
41243
private Properties getNamespaces(Node node)
   {
      Properties namespaces = new Properties();
      NamedNodeMap attributes = node.getAttributes();
      for (int i = 0; i < attributes.getLength(); i++)
      {
         Attr attribute = (Attr)attributes.item(i);
         if (attribute.getName().startsWith("xmlns:"))
         {
            namespaces.setProperty(attribute.getName().substring(6), attribute.getValue());
         }
      }
      return namespaces;
   }
514938
function getNamespacedData(namespace, data){
        var namespacedData = {};
        for (var key in data){
            // key starts with namespace
            if (key.slice(0, namespace.length) == namespace){
                var namespacedKey = key.slice(namespace.length, key.length);
                namespacedKey = namespacedKey.charAt(0).toLowerCase() + namespacedKey.slice(1);
                namespacedData[namespacedKey] = data[key];
            }
        }

        return namespacedData;
    }
849182
def namespaces(
            self,
            name=None,
            function=None,
            recursive=None,
            allow_empty=None):
        

        return (
            self._find_multiple(
                scopedef.scopedef_t._impl_matchers[namespace_t.namespace],
                name=name,
                function=function,
                recursive=recursive,
                allow_empty=allow_empty)
        )
888480
def xmlns(source):
    
    namespaces = {}
    events=("end", "start-ns", "end-ns")
    for (event, elem) in iterparse(source, events):
        if event == "start-ns":
            prefix, ns = elem
            namespaces[prefix] = ns
        elif event == "end":
            break

    # Reset stream
    if hasattr(source, "seek"):
        source.seek(0)

    return namespaces
999495
private function _namespace() {
    $node = new NamespaceNode();
    $this->matchDocComment($node);
    $this->mustMatch(T_NAMESPACE, $node);
    if ($this->currentType === T_STRING) {
      $name = $this->namespaceName();
      $node->addChild($name, 'name');
    }
    $this->matchHidden($node);
    $body = new StatementBlockNode();
    if ($this->tryMatch('{', $body)) {
      $this->topStatementList($body, '}');
      $this->mustMatch('}', $body);
      $node->addChild($body, 'body');
    }
    else {
      $this->endStatement($node);
      $this->matchHidden($node);
      $node->addChild($this->namespaceBlock(), 'body');
    }
    return $node;
  }