Skip to content

Commit a092d3d

Browse files
committed
XML: add utility method to get child elements
When you have an element, and want all child elements with the given tag name, you can now call this handy new static utility method.
1 parent 12a62dd commit a092d3d

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/main/java/org/scijava/util/XML.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,13 @@ public static ArrayList<Element> elements(final NodeList nodes) {
252252
return elements;
253253
}
254254

255+
/** Gets the given element's specified child elements. */
256+
public static ArrayList<Element>
257+
elements(final Element el, final String child)
258+
{
259+
return elements(el.getElementsByTagName(child));
260+
}
261+
255262
// -- Helper methods --
256263

257264
/** Loads an XML document from the given file. */

0 commit comments

Comments
 (0)