public static boolean hasParentOf ( final Element parentElement , XsdElementEnum parentEnum ) { Node parent = parentElement . getParentNode ( ) ; while ( parent != null ) { if ( parent . getNodeType ( ) == Node . ELEMENT_NODE ) { final Element parentElm = ( Element ) parent ; if ( parentEnum . isTagNameEqual ( parentElm . getTagName ( ) ) ) { return true ; } } parent = parent . getParentNode ( ) ; } return false ; }
Checks for the first parent node occurrence of the a w3c parentEnum element .