Find the child element whose tag matches the specified tag name.

@param tagName Tag name to locate.
@param element Parent element whose children are to be searched.
@return The matching node (first occurrence only) or null if not found.
352240
protected Element findTag(String tagName, Element element) {
        Node result = element.getFirstChild();
        
        while (result != null) {
            if (result instanceof Element
                    && (tagName.equals(((Element) result).getNodeName()) || tagName
                            .equals(((Element) result).getLocalName()))) {
                break;
            }
            result = result.getNextSibling();
        }
        
        return (Element) result;
    }
528899
public boolean isUnderTag(String superTagName, String subTagName)
    {
        if (superTagName == null || subTagName == null)
            throw new IllegalArgumentException("Looking for a null tag name.");

        superTagName = Tag.normalizeName(superTagName);
        subTagName = Tag.normalizeName(subTagName);

        if (superTagName.equals(subTagName))
            return false;

        final Tag superTag = this.findTag(superTagName);
        final Tag subTag = this.findTag(subTagName);
        if (subTag == null || superTag == null)
            return false;
        return this.isUnderTag(superTag, subTag);
    }
177728
function(event, tagName) {
    var element = Event.element(event);
    while (element.parentNode && (!element.tagName ||
        (element.tagName.toUpperCase() != tagName.toUpperCase())))
      element = element.parentNode;
    return element;
  }
370336
private Element findFirstElementByTagName(String tag, Node node) {
        if (node.nodeName().equals(tag))
            return (Element) node;
        else {
            int size = node.childNodeSize();
            for (int i = 0; i < size; i++) {
                Element found = findFirstElementByTagName(tag, node.childNode(i));
                if (found != null)
                    return found;
            }
        }
        return null;
    }
413710
public static String elementText(Element element, String tagName) {
		Element child = getElement(element, tagName);
		return child == null ? null : child.getTextContent();
	}
1071302
public TreeElement findNode(String nodeName)
    {
        TreeElement root = getRoot(this);
        return root.findNodeRecurse(nodeName, nodeName);
    }
438518
public static String getAttributeValue(final Element element, final String name) {
        final Node node = element.getAttributes().getNamedItem(name);
        if (node != null) {
            return node.getNodeValue();
        }

        return null;
    }
811318
private String getElementValue(Element parent, String elementName) {
        String value = null;
        NodeList nodes = parent.getElementsByTagName(elementName);
        if (nodes.getLength() > 0) {
            value = nodes.item(0).getChildNodes().item(0).getNodeValue();
        }
        return value;
    }
394119
public static List<String> childrenText(Element parentElement, String tagname) {
        final Iterable<Element> children = children(parentElement, tagname);

        List<String> result = new ArrayList<String>();

        for (Element element : children) {
            result.add(elementText(element));
        }

        return result;
    }
998020
public Node find(String nodeName)
	{
		// Sanity check
		if (IS_EMPTY.test(nodeName))
		{
			throw new IllegalArgumentException("The node name should not be empty");
		}
		Node _result = null;
		while (hasMoreAvailableElement() && (null == _result))
		{
			int _position = getPosition();
			Node _current = getSource().item(_position);
			_position++;
			setPosition(_position);

			if (nodeName.equals(_current.getNodeName()))
			{
				_result = _current;
			}
		}
		return _result;
	}
1063554
private XmlElementFinder getElementFinder(final Element element) {
		if (elementFinder == null) {
			elementFinder = new XmlElementFinder(element.getDocument());
		}
		return elementFinder;
	}
255198
public static String getChildValue(Element element, String name) {
        return getValue(getChild(element, name));
    }
722633
private static Element findElement(Document document, String name) {
        Element result = null;

        List<Element> elementList = getElements(document);

        for (Element element : elementList) {
            if (element.getAttribute("id").equalsIgnoreCase(name) == true) {
                result = element;
                break;
            }
        }

        return result;
    }
744514
public static Element getElement(Element element, String tagName) {
		final NodeList nodeList = element.getElementsByTagName(tagName);
		if (nodeList == null || nodeList.getLength() < 1) {
			return null;
		}
		int length = nodeList.getLength();
		for (int i = 0; i < length; i++) {
			Element childEle = (Element) nodeList.item(i);
			if (childEle == null || childEle.getParentNode() == element) {
				return childEle;
			}
		}
		return null;
	}
817293
protected NodeList getTagChildren(String tagName, Element element) {
        return element.getNamespaceURI() == null ? element.getElementsByTagName(tagName) : element.getElementsByTagNameNS(
            element.getNamespaceURI(), tagName);
    }
1216204
def getElements(self,name=''):
		''
		#If no tag name is specified, return the all children
		if not name:
			return self.children
		else:
			# else return only those children with a matching tag name
			elements = []
			for element in self.children:
				if element.name == name:
					elements.append(element)
			return elements
949835
public Element findChild(Element child) {
        return new Element(child.getDriver(), reporter, child.getType(), child.getLocator(), child.getMatch(), this);
    }