private static Node getFirstNonEmptyChild(Node n) {
    for (Node c = n.getFirstChild(); c != null; c = c.getNext()) {
      if (c.isBlock()) {
        Node result = getFirstNonEmptyChild(c);
        if (result != null) {
          return result;
        }
      } else if (!c.isEmpty()) {
        return c;
      }
    }
    return null;
  }
private static Node getFirstNonEmptyChild ( Node n ) { for ( Node c = n . getFirstChild ( ) ; c != null ; c = c . getNext ( ) ) { if ( c . isBlock ( ) ) { Node result = getFirstNonEmptyChild ( c ) ; if ( result != null ) { return result ; } } else if ( ! c . isEmpty ( ) ) { return c ; } } return null ; }
Gets the first non-empty child of the given node.