Get the node at the specified location in the dom.
    Location is a sequence of child indices, starting at the children of the
    root element. If there is no node at this location, raise a ValueError.
421496
def get_location(dom, location):
    
    node = dom.documentElement
    for i in location:
        node = get_child(node, i)
        if not node:
            raise ValueError('Node at location %s does not exist.' % location) #TODO: line not covered
    return node
1246614
function () {
            var node, sel, range;
            if (window.getSelection) {
                sel = window.getSelection();
                if (sel.rangeCount) {
                    range = sel.getRangeAt(0);
                    if (!range.collapsed) {
                        node = sel.anchorNode.parentNode;
                    }
                }
            } else if (document.selection) {
                node = document.selection.createRange().parentElement();
            }
            return node;
        }
278075
def startElement(self, node):
        """"""
        if node is None:
            return

        if self.__filter_location is not None:
            # dont even parse includes.
            # FIXME: go back on dependencies ?
            if node.location.file is None:
                return
            elif node.location.file.name not in self.__filter_location:
                return
        # find and call the handler for this element
        log.debug(
            '%s:%d: Found a %s|%s|%s',
            node.location.file,
            node.location.line,
            node.kind.name,
            node.displayname,
            node.spelling)
        # build stuff.
        try:
            stop_recurse = self.parse_cursor(node)
            # Signature of parse_cursor is:
            # if the fn returns True, do not recurse into children.
            # anything else will be ignored.
            if stop_recurse is not False:  # True:
                return
            # if fn returns something, if this element has children, treat
            # them.
            for child in node.get_children():
                self.startElement(child)
        except InvalidDefinitionError:
            # if the definition is invalid
            pass
        # startElement returns None.
        return None
640903
def get_node(self, index):
        

        index = self.mapToSource(index)
        if not index.isValid():
            return self.sourceModel().root_node

        return index.internalPointer() or self.sourceModel().root_node
85283
def get_element_attribute(self, locator, attribute):
        
        elements = self._element_find(locator, False, True)
        ele_len = len(elements)
        if ele_len == 0:
            raise AssertionError("Element '%s' could not be found" % locator)
        elif ele_len > 1:
            self._info("CAUTION: '%s' matched %s elements - using the first element only" % (locator, len(elements)))

        try:
            attr_val = elements[0].get_attribute(attribute)
            self._info("Element '%s' attribute '%s' value '%s' " % (locator, attribute, attr_val))
            return attr_val
        except:
            raise AssertionError("Attribute '%s' is not valid for element '%s'" % (attribute, locator))
231761
Node getNode(Node root) {
        if (isRoot()) {
            return root;
        }

        Node startNode = root;
        Matcher pathMatcher = dotWithPreviousChar.matcher(path);
        int pos = 0;
        while (pathMatcher.find()) {
            String step = path.substring(pos, pathMatcher.end() - 1);
            pos = pathMatcher.end();
            startNode = doStep(step, startNode);
        }
        startNode = doStep(path.substring(pos), startNode);
        return startNode;
    }
1363248
def xpointerNewLocationSetNodes(self, end):
        
        if end is None: end__o = None
        else: end__o = end._o
        ret = libxml2mod.xmlXPtrNewLocationSetNodes(self._o, end__o)
        if ret is None:raise treeError('xmlXPtrNewLocationSetNodes() failed')
        return xpathObjectRet(ret)
33657
function(node) {
    var index = '';
    do {
      if (node.id) index = '[' + node.position + ']' + index;
    } while ((node = node.parent) != null);
    return index;
  }
43278
function getPlaceholder() {
  const type = NodeType.PlaceholderType;
  const token = tokens[pos];
  const line = token.ln;
  const column = token.col;
  let content = [];

  // Skip `%`.
  pos++;

  content = content.concat(getIdentOrInterpolation());

  return newNode(type, content, line, column);
}
259578
function(node, method) {
            node = Y.Dom.get(node);
            if (!node) {
                YAHOO.log('getFirstChild failed: invalid node argument', 'error', 'Dom');
                return null;
            }
            return Y.Dom.getFirstChildBy(node);
        }
378242
public static int getXPathLocation(String dom, String xpath) {
		String dom_lower = dom.toLowerCase();
		String xpath_lower = xpath.toLowerCase();
		String[] elements = xpath_lower.split("/");
		int pos = 0;
		int temp;
		int number;
		for (String element : elements) {
			if (!element.isEmpty() && !element.startsWith("@") && !element.contains("()")) {
				if (element.contains("[")) {
					try {
						number =
								Integer.parseInt(element.substring(element.indexOf("[") + 1,
										element.indexOf("]")));
					} catch (NumberFormatException e) {
						return -1;
					}
				} else {
					number = 1;
				}
				for (int i = 0; i < number; i++) {
					// find new open element
					temp = dom_lower.indexOf("<" + stripEndSquareBrackets(element), pos);

					if (temp > -1) {
						pos = temp + 1;

						// if depth>1 then goto end of current element
						if (number > 1 && i < number - 1) {
							pos =
									getCloseElementLocation(dom_lower, pos,
											stripEndSquareBrackets(element));
						}

					}
				}
			}
		}
		return pos - 1;
	}
706764
def get_node(self, element):
        
        """
        ns, tag = self.split_namespace(element.tag)
        return {'tag': tag, 'value': (element.text or '').strip(), 'attr': element.attrib, 'namespace': ns}
489978
public int getPositionInContextNodeList(XPathContext xctxt)
  {

    // System.out.println("FuncPosition- entry");
    // If we're in a predicate, then this will return non-null.
    SubContextList iter = m_isTopLevel ? null : xctxt.getSubContextList();

    if (null != iter)
    {
      int prox = iter.getProximityPosition(xctxt);
 
      // System.out.println("FuncPosition- prox: "+prox);
      return prox;
    }

    DTMIterator cnl = xctxt.getContextNodeList();

    if (null != cnl)
    {
      int n = cnl.getCurrentNode();
      if(n == DTM.NULL)
      {
        if(cnl.getCurrentPos() == 0)
          return 0;
          
        // Then I think we're in a sort.  See sort21.xsl. So the iterator has 
        // already been spent, and is not on the node we're processing. 
        // It's highly possible that this is an issue for other context-list 
        // functions.  Shouldn't be a problem for last(), and it shouldn't be 
        // a problem for current().
        try 
        { 
          cnl = cnl.cloneWithReset(); 
        }
        catch(CloneNotSupportedException cnse)
        {
          throw new org.apache.xml.utils.WrappedRuntimeException(cnse);
        }
        int currentNode = xctxt.getContextNode();
        // System.out.println("currentNode: "+currentNode);
        while(DTM.NULL != (n = cnl.nextNode()))
        {
          if(n == currentNode)
            break;
        }
      }
      // System.out.println("n: "+n);
      // System.out.println("FuncPosition- cnl.getCurrentPos(): "+cnl.getCurrentPos());
      return cnl.getCurrentPos();
    }

    // System.out.println("FuncPosition - out of guesses: -1");
    return -1;
  }
1035601
def get(self, position):
        

        counter = 0
        current_node = self.head

        while current_node is not None and counter <= position:
            if counter == position:
                return current_node.val

            current_node = current_node.next_node
            counter += 1

        return None
1354893
function getPosition(element) {
        var pos = {'left': 0, 'top': 0};
        do {
            pos.top += element.offsetTop || 0;
            pos.left += element.offsetLeft || 0;
            element = element.offsetParent;
        }
        while (element);
        return pos;
    }
586410
private Element findRootFolderElement( Document dom )
    {
        NodeList list = dom.getElementsByTagNameNS( "*", "folder" );

        final String localRootId = getRootId(); // cache it also in this method

        for ( int i = 0; i < list.getLength(); i++ ) {
            Element e = ( Element ) list.item( i );
            if ( e.getAttribute( "id" ).equals( localRootId ) ) {
                return e;
            }
        }
        throw new CStorageException( "Could not find root folder with id=" + localRootId );
    }
650112
def locationFromElement(self, element):
        
        elementLocation = None
        for locationElement in element.findall('.location'):
            elementLocation = self.readLocationElement(locationElement)
            break
        return elementLocation