snaker-core/src/main/java/org/snaker/engine/helper/XmlHelper.java
public static List<Element> elements(Element element, String tagName) {
		if (element == null || !element.hasChildNodes()) {
			return Collections.emptyList();
		}

		List<Element> elements = new ArrayList<Element>();
		for (Node child = element.getFirstChild(); child != null; child = child.getNextSibling()) {
			if (child.getNodeType() == Node.ELEMENT_NODE) {
				Element childElement = (Element) child;
				String childTagName = childElement.getNodeName();
				if (tagName.equals(childTagName))
					elements.add(childElement);
			}
		}
		return elements;
	}
public static List<Element> elements(Element element, String tagName) {
		if (element == null || !element.hasChildNodes()) {
			return Collections.emptyList();
		}

		List<Element> elements = new ArrayList<Element>();
		for (Node child = element.getFirstChild(); child != null; child = child.getNextSibling()) {
			if (child.getNodeType() == Node.ELEMENT_NODE) {
				Element childElement = (Element) child;
				String childTagName = childElement.getNodeName();
				if (tagName.equals(childTagName))
					elements.add(childElement);
			}
		}
		return elements;
	}
public static List < Element > elements ( Element element , String tagName ) { if ( element == null || ! element . hasChildNodes ( ) ) { return Collections . emptyList ( ) ; } List < Element > elements = new ArrayList < Element > ( ) ; for ( Node child = element . getFirstChild ( ) ; child != null ; child = child . getNextSibling ( ) ) { if ( child . getNodeType ( ) == Node . ELEMENT_NODE ) { Element childElement = ( Element ) child ; String childTagName = childElement . getNodeName ( ) ; if ( tagName . equals ( childTagName ) ) elements . add ( childElement ) ; } } return elements ; }
从element元素查找所有tagName指定的子节点元素集合
@param element
@param tagName
@return
从element元素查找所有tagName指定的子节点元素集合