protected boolean shouldSkipChildren ( Element jspElement ) throws JspCoreException { if ( ! shouldSkipChildrenForThisVisitor ( ) ) { return false ; } String uri = jspElement . getNamespaceURI ( ) ; String name = jspElement . getLocalName ( ) ; NodeList children ; // First, see if this is a <jsp:body> tag. if ( uri . equalsIgnoreCase ( Constants . JSP_NAMESPACE ) && name . equalsIgnoreCase ( Constants . JSP_BODY_TYPE ) ) { // It is, so we need to skip processing children if the parent tag is // tagdependent. return isNodeTagDependent ( jspElement . getParentNode ( ) ) ; } // Otherwise, this is a custom tag. We have three cases: if ( ! isElementTagDependent ( jspElement ) ) { // Case 1: not a tagdependent tag, so return. return false ; } // Now, we know this is a tagdependent tag. Look at the children. children = jspElement . getChildNodes ( ) ; if ( children . getLength ( ) == 0 ) { // Case 2: there are no children, so there's no harm in allowing processing to continue. return false ; } for ( int i = 0 ; i < children . getLength ( ) ; ++ i ) { Node node = children . item ( i ) ; if ( node . getNodeType ( ) == Node . ELEMENT_NODE ) { Element element = ( Element ) node ; String elemURI = element . getNamespaceURI ( ) ; if ( elemURI . equalsIgnoreCase ( Constants . JSP_NAMESPACE ) ) { String elemName = element . getLocalName ( ) ; if ( elemName . equalsIgnoreCase ( Constants . JSP_ATTRIBUTE_TYPE ) || elemName . equalsIgnoreCase ( Constants . JSP_BODY_TYPE ) ) { // Case 3: the first child is <jsp:attribute> or <jsp:body>, so we // have to process children. return false ; } else { // Default case: the first child is not <jsp:attribute> or <jsp:body>, // so we have an implicit body defined. Skip processing. return true ; } } } } // Not likely we'd make it here... return false ; }
validate the children ) .