Get the first descendant of source identified by path.

  Path must be either a an xpath string, or a 2-tuple of (xpath, namespace_dict).
513890
def get_xml_child(source, path):
  
  if isinstance(path, (tuple, list)):
    return source.find(*path)
  else:
    return source.find(path)
256598
def get_cached_element_by_path(data_tree, path):
    # type: (ArTree, str) -> typing.Optional[_Element]
    """"""
    if not isinstance(data_tree, ArTree):
        logger.warning("%s not called with ArTree, return None", get_cached_element_by_path.__name__)
        return None
    ptr = data_tree
    for name in path.split('/'):
        if ptr is None:
            return None
        if name.strip():
            ptr = ptr.get_child_by_name(name)
    return ptr.ref if ptr else None
652235
def getNodeByName(node, name):
    

    if node is None:
        raise Exception(
            "Cannot search for a child '%s' in a None object" % (name,)
        )
    if not name:
        raise Exception("Unspecified name to find node for.")
    try:
        childNode = node.xpath("*[local-name() = '%s']" % name)[0]
    except:
        return None
    return childNode
468448
public String getXPath(NamespaceContext context, String xml, String xPathExpr) {
        return (String) evaluateXpath(context, xml, xPathExpr, null);
    }
867917
def xpathNextSelf(self, cur):
        
        if cur is None: cur__o = None
        else: cur__o = cur._o
        ret = libxml2mod.xmlXPathNextSelf(self._o, cur__o)
        if ret is None:raise xpathError('xmlXPathNextSelf() failed')
        __tmp = xmlNode(_obj=ret)
        return __tmp
440956
private Xml getNode(String... path)
    {
        Xml node = root;
        for (final String element : path)
        {
            try
            {
                node = node.getChild(element);
            }
            catch (final LionEngineException exception)
            {
                throw new LionEngineException(exception, media);
            }
        }
        return node;
    }
798133
public static String getNodeFromPath(String path)
    {
        PathUtils.validatePath(path);
        int i = path.lastIndexOf(PATH_SEPARATOR);
        if ( i < 0 )
        {
            return path;
        }
        if ( (i + 1) >= path.length() )
        {
            return "";
        }
        return path.substring(i + 1);
    }
517146
public function first($path)
    {
        // Convenience method
        $x = $this->xpath($path);

        return count($x) ? $x[0] : null;
    }
510196
public static String getParentPath(String path) {
        if (path == null) return null;
        path = path.trim();
        if (path.endsWith(PATH_ROOT) && path.length() > 1) {
            path = path.substring(0, path.length() - 1);
        }
        int lastIndex = path.lastIndexOf(PATH_ROOT);
        if (path.length() > 1 && lastIndex > 0) {
            return path.substring(0, lastIndex);
        }
        return PATH_ROOT;
    }
542202
def is_descendant_of(self, node):
        
        return self.pk in [obj.pk for obj in node.get_descendants()]
1286278
def get_source(path):
    '''  '''
    for line in read(path):
        if 'import' in line or len(line.strip()) == 0 or line.startswith('#'):
            continue
        if '__name__' in line and '__main__' in line:
            break
        else:
            yield line
782938
def is_descendant_of(self, node):
        
        return (
            self.tree_id == node.tree_id and
            self.lft > node.lft and
            self.rgt < node.rgt
        )
976130
def xpathNextChild(self, cur):
        
        if cur is None: cur__o = None
        else: cur__o = cur._o
        ret = libxml2mod.xmlXPathNextChild(self._o, cur__o)
        if ret is None:raise xpathError('xmlXPathNextChild() failed')
        __tmp = xmlNode(_obj=ret)
        return __tmp
542023
def find(self, node, path):
        """"""

        return node.find(path, namespaces=self.namespaces)
918509
public CmsPathTree<P, V> findNode(List<P> path) {

        List<P> pathToConsume = Lists.newLinkedList(path);
        CmsPathTree<P, V> descendant = findNodeInternal(pathToConsume);
        if (!pathToConsume.isEmpty()) {
            return null;
        } else {
            return descendant;
        }
    }
1250582
def path(self):
        ""
        prefix = ()
        if self.parent:
            prefix = self.parent.path

        if self.id_or_name:
            return prefix + (self.kind, self.id_or_name)

        return prefix + (self.kind,)
340333
public static Node getNode(Object root, Path path) {
         return path.getNode(convertToJson(root, "actual"));
     }