return fitst child Element of a Element, if there are no child Elements return null

@param parent parent node
@return child Element
495696
private Element getChildElement(Element parent) {
	NodeList list = parent.getChildNodes();
	int len = list.getLength();
	for (int i = 0; i < len; i++) {
	    Node node = list.item(i);
	    if (node instanceof Element) {
		return (Element) node;
	    }
	}
	return null;
    }
741909
public static boolean contains(Element parent, Element descendant) {
    return parent != descendant && parent.isOrHasChild(descendant);
  }
954482
public static boolean hasChildsOf(final Element parentElement, XsdElementEnum child) {
        NodeList nodeList = parentElement.getChildNodes();
        for (int i = 0; i < nodeList.getLength(); i++) {
            final Node childNode = nodeList.item(i);
            if (childNode.getNodeType() == Node.ELEMENT_NODE) {
                final Element childElement = (Element) childNode;
                if (child.isTagNameEqual(childElement.getTagName())) {
                    return true;
                }

                if (childElement.hasChildNodes()) {
                    if (hasChildsOf(childElement, child)) {
                        return true;
                    }
                }
            }
        }
        return false;
    }
881970
@Override
    public RemoteWebElement getElement() {
        /*
         * Note: Rationale behind throwing ParentNotFoundException here.
         * 
         * Container's being a parent type is searched using a locator. When the locator is invalid it will be better to
         * throw ParentNotFoundException to the user so that it clearly indicates its the container.
         */
        List<WebElement> elements = null;
        try {
            if (getParent() != null) {
                elements = getParent().locateChildElements(getLocator());
            } else {
                // Its a case where there is a stand alone container and no parent
                elements = HtmlElementUtils.locateElements(getLocator());
            }
        } catch (NoSuchElementException n) {
            throw new ParentNotFoundException("Could not find any parent with the locator " + getLocator(), n);
        }
        if (index <= elements.size()) {
            return (RemoteWebElement) elements.get(index);
        }
        throw new NoSuchElementException("Cannot find Element With index :{" + index + "} in Container"
                + this.getClass().getSimpleName());
    }
453206
public static NodeImpl createReturnValue(final NodeImpl parent) {
    return new NodeImpl( //
        RETURN_VALUE_NODE_NAME, //
        parent, //
        false, //
        null, //
        null, //
        ElementKind.RETURN_VALUE, //
        EMPTY_CLASS_ARRAY, //
        null, //
        null, //
        null, //
        null //
    );
  }
627280
public AnnotationMetadata getAnnotationMetadata(Element parent, Element element) {
        return newAnnotationBuilder().buildForParent(parent, element);
    }
182108
public boolean canAcceptParent(ElementBase parent) {
        if (!canAcceptParent()) {
            return false;
        }
        
        if (!canAcceptParent(getClass(), parent.getClass())) {
            rejectReason = getDisplayName() + " does not accept " + parent.getDisplayName() + " as a parent.";
        } else {
            rejectReason = null;
        }
        
        return rejectReason == null;
    }
1197428
protected static Element getChildElement(final Element parent, final String tagName) {
        List<Element> elements = getElements(parent, tagName);
        if (elements.size() > 0) {
            return elements.get(0);
        } else {
            return null;
        }
    }
1123057
public String getFormattedParentValue()
   {
      String result = null;
      if (m_elements.size() > 2)
      {
         result = joinElements(m_elements.size() - 2);
      }
      return result;
   }
1128363
protected CmsContainerElementBean getParentElement(CmsContainerElementBean element) {

        if (m_elementInstances == null) {
            initPageData();
        }
        CmsContainerElementBean parent = null;
        CmsContainerBean cont = m_parentContainers.get(element.getInstanceId());
        if ((cont != null) && cont.isNestedContainer()) {
            parent = m_elementInstances.get(cont.getParentInstanceId());
        }
        return parent;
    }
1068519
protected Element[] getElements(Element base, String childTag) {
		NodeList nodeList = base.getElementsByTagName(childTag);
		if (nodeList.getLength() == 0) {
			return null;
		}
		Element[] elements = new Element[nodeList.getLength()];
		for (int i=0; i<nodeList.getLength(); i++) {
		    elements[i] = (Element) nodeList.item(i);
		}
		return elements;
	}
902335
private static Map<String,List<Node>> getChildNodes(Node parent) {
		if (parent==null)
			return Collections.emptyMap();

		Map<String,List<Node>> children = new HashMap<String,List<Node>>();

		NodeList nodes = parent.getChildNodes();
		int nNodes = nodes.getLength();
		for (int i=0; i<nNodes; i++) {
			Node node = nodes.item(i);
			if (node.getNodeType()!=Node.ELEMENT_NODE)
				continue;

			String name = node.getNodeName();
			List<Node> namesakes = children.get(name);
			if (namesakes==null) {
				namesakes = new ArrayList<Node>();
				children.put(name, namesakes);
			}
			namesakes.add(node);
		}

		return children;
	}
328990
function (element, containerTag) {
    if (element && element.hasChildNodes)
      for (var i = 0; i < element.childNodes.length; ++i)
        if (element.childNodes[i].tagName == containerTag)
          return element.childNodes[i];
  
    return null;
  }
730286
def get_element_tree(parent_to_parse):
    

    if isinstance(parent_to_parse, ElementTree):
        return parent_to_parse

    element = get_element(parent_to_parse)

    return ElementTree() if element is None else ElementTree(element)
281250
@Nullable
  public final Node getAncestor(int level) {
    checkArgument(level >= 0);
    Node node = this;
    while (node != null && level-- > 0) {
      node = node.getParent();
    }
    return node;
  }
952152
private String getParentContainerId(Element elem) {

        String attr = CmsContainerPageContainer.PROP_CONTAINER_MARKER;
        Element lastElem;
        do {
            String propValue = elem.getPropertyString(attr);
            if (!CmsStringUtil.isEmptyOrWhitespaceOnly(propValue)) {
                return propValue;
            }
            lastElem = elem;
            elem = elem.getParentElement();
        } while ((elem != null) && (elem != lastElem));
        return null;
    }
790986
public static Node getChildNode(Node parentNode, String name, String value){
                List<Node> matchingChildren = getChildren(parentNode, name, value);
                return (matchingChildren.size() > 0) ? matchingChildren.get(0) : null;
        }