private TreeElement findDepthFirst(TreeElement parent,String name){
  int len=parent.getNumChildren();
  for (int i=0; i < len; ++i) {
    TreeElement e=parent.getChildAt(i);
    if (name.equals(e.getName())) {
      return e;
    }
 else     if (e.getNumChildren() != 0) {
      TreeElement v=findDepthFirst(e,name);
      if (v != null)       return v;
    }
  }
  return null;
}

private TreeElement findDepthFirst ( TreeElement parent , String name ) { int len = parent . getNumChildren ( ) ; for ( int i = 0 ; i < len ; ++ i ) { TreeElement e = parent . getChildAt ( i ) ; if ( name . equals ( e . getName ( ) ) ) { return e ; } else if ( e . getNumChildren ( ) != 0 ) { TreeElement v = findDepthFirst ( e , name ) ; if ( v != null ) return v ; } } return null ; }
traverse the submission looking for the first matching tag in depth - first order .
