public boolean hasChild(String child)
    {
        final NodeList list = root.getChildNodes();
        for (int i = 0; i < list.getLength(); i++)
        {
            final Node node = list.item(i);
            if (node.getNodeName().equals(child))
            {
                return true;
            }
        }
        return false;
    }
public boolean hasChild ( String child ) { final NodeList list = root . getChildNodes ( ) ; for ( int i = 0 ; i < list . getLength ( ) ; i ++ ) { final Node node = list . item ( i ) ; if ( node . getNodeName ( ) . equals ( child ) ) { return true ; } } return false ; }
Check if node has the following child.

@param child The child name (can be <code>null</code>).
@return <code>true</code> if child exists, <code>false</code> else.