private void putValuePairsIntoMap ( final Element subtree , final String elementName , final QName attName , final String category ) { if ( subtree == null || attName == null ) { return ; } Map < String , Set < String > > valueMap = validValuesMap . get ( attName ) ; if ( valueMap == null ) { valueMap = new HashMap <> ( ) ; } Set < String > valueSet = valueMap . get ( elementName ) ; if ( valueSet == null ) { valueSet = new HashSet <> ( ) ; } final LinkedList < Element > queue = new LinkedList <> ( ) ; queue . offer ( subtree ) ; while ( ! queue . isEmpty ( ) ) { final Element node = queue . poll ( ) ; final NodeList children = node . getChildNodes ( ) ; for ( int i = 0 ; i < children . getLength ( ) ; i ++ ) { if ( children . item ( i ) . getNodeType ( ) == Node . ELEMENT_NODE ) { queue . offer ( ( Element ) children . item ( i ) ) ; } } if ( SUBJECTSCHEME_SUBJECTDEF . matches ( node ) ) { final String key = node . getAttribute ( ATTRIBUTE_NAME_KEYS ) ; if ( ! ( key == null || key . trim ( ) . isEmpty ( ) || key . equals ( category ) ) ) { valueSet . add ( key ) ; } } } valueMap . put ( elementName , valueSet ) ; validValuesMap . put ( attName , valueMap ) ; }
Populate valid values map