private void fillScopeCodes ( NodeList scopeNodeList , Map < String , Scope > scopes , Map < String , Code > codes ) { for ( int i = 0 ; i < scopeNodeList . getLength ( ) ; i ++ ) { Element scopeElement = ( Element ) scopeNodeList . item ( i ) ; Scope scope = scopes . get ( scopeElement . getAttribute ( TAG_SCOPE_ATTR_NAME ) ) ; // Add codes to scope Set < Code > scopeCodes = new HashSet < Code > ( ) ; // bind exists codes NodeList coderefs = scopeElement . getElementsByTagNameNS ( SCHEMA_LOCATION , TAG_CODEREF ) ; for ( int j = 0 ; j < coderefs . getLength ( ) ; j ++ ) { Element ref = ( Element ) coderefs . item ( j ) ; String codeName = ref . getAttribute ( TAG_CODEREF_ATTR_NAME ) ; Code code = codes . get ( codeName ) ; if ( code == null ) { throw new TextProcessorFactoryException ( "Can't find code \"" + codeName + "\"." ) ; } scopeCodes . add ( code ) ; } // Add inline codes NodeList inlineCodes = scopeElement . getElementsByTagNameNS ( SCHEMA_LOCATION , TAG_CODE ) ; for ( int j = 0 ; j < inlineCodes . getLength ( ) ; j ++ ) { // Inline element code Element ice = ( Element ) inlineCodes . item ( j ) ; scopeCodes . add ( parseCode ( ice , scopes ) ) ; } // Set codes to scope scope . setCodes ( scopeCodes ) ; } }
Fill codes of scopes .