void assertContentModel ( Collection < Class < ? extends Element > > permittedChildren ) throws InvalidInputException { for ( Element child : this . getChildren ( ) ) { if ( ! permittedChildren . contains ( child . getClass ( ) ) ) { //Permit whitespace if ( child instanceof TextNode && StringUtils . isBlank ( ( ( TextNode ) child ) . getText ( ) ) ) { continue ; } throw new InvalidInputException ( "Element \"" + child . getMessageMLTag ( ) + "\" is not allowed in \"" + this . getMessageMLTag ( ) + "\"" ) ; } } }
Check that the element s children are limited to allowed element types .