Java Utililty Methods XML Child Get by Type

List of utility methods to do XML Child Get by Type

Description

The list of methods to do XML Child Get by Type are organized into topic(s).

Method

NodegetChildByType(Element element, short nodeType)
Returns first of the element's child nodes that is of type nodeType.
if (element == null)
    return null;
NodeList nodes = element.getChildNodes();
if (nodes == null || nodes.getLength() < 1)
    return null;
Node node;
String data;
for (int i = 0; i < nodes.getLength(); i++) {
...
NodegetChildByType(Node root, int type)
get Child By Type
NodeList nodeList = root.getChildNodes();
int count = (nodeList != null ? nodeList.getLength() : 0);
for (int i = 0; i < count; i++) {
    Node child = nodeList.item(i);
    if (child.getNodeType() == type)
        return child;
return null;
...