private void handleKeysAttr ( final Attributes atts ) { final String attrValue = atts . getValue ( ATTRIBUTE_NAME_KEYS ) ; if ( attrValue != null ) { URI target = toURI ( atts . getValue ( ATTRIBUTE_NAME_HREF ) ) ; final URI copyTo = toURI ( atts . getValue ( ATTRIBUTE_NAME_COPY_TO ) ) ; if ( copyTo != null ) { target = copyTo ; } final String keyRef = atts . getValue ( ATTRIBUTE_NAME_KEYREF ) ; // Many keys can be defined in a single definition, like // keys="a b c", a, b and c are seperated by blank. for ( final String key : attrValue . trim ( ) . split ( "\\s+" ) ) { if ( ! keysDefMap . containsKey ( key ) ) { if ( target != null && ! target . toString ( ) . isEmpty ( ) ) { final String attrScope = atts . getValue ( ATTRIBUTE_NAME_SCOPE ) ; final String attrFormat = atts . getValue ( ATTRIBUTE_NAME_FORMAT ) ; if ( attrScope != null && ( attrScope . equals ( ATTR_SCOPE_VALUE_EXTERNAL ) || attrScope . equals ( ATTR_SCOPE_VALUE_PEER ) ) ) { keysDefMap . put ( key , new KeyDef ( key , target , attrScope , attrFormat , null , null ) ) ; } else { String tail = null ; if ( target . getFragment ( ) != null ) { tail = target . getFragment ( ) ; target = stripFragment ( target ) ; } if ( ! target . isAbsolute ( ) ) { target = currentDir . resolve ( target ) ; } keysDefMap . put ( key , new KeyDef ( key , setFragment ( target , tail ) , ATTR_SCOPE_VALUE_LOCAL , attrFormat , null , null ) ) ; } } else if ( ! StringUtils . isEmptyString ( keyRef ) ) { // store multi-level keys. keysRefMap . put ( key , keyRef ) ; } else { // target is null or empty, it is useful in the future // when consider the content of key definition keysDefMap . put ( key , new KeyDef ( key , null , null , null , null , null ) ) ; } } else { logger . info ( MessageUtils . getMessage ( "DOTJ045I" , key ) . toString ( ) ) ; } } } }
Parse the keys attributes .