public String addGeneratedMapping ( String prefixBase , NamespaceContext ctxt , String uri , int [ ] seqArr ) { String [ ] strs = mNsStrings ; int seqNr = seqArr [ 0 ] ; String prefix ; main_loop : while ( true ) { /* We better intern the resulting prefix? Or not? * TODO: maybe soft cache these for other docs? */ prefix = ( prefixBase + seqNr ) . intern ( ) ; ++ seqNr ; /* Ok, let's see if we have a mapping (masked or not) for * the prefix. If we do, let's just not use it: we could * of course mask it (unless it's in current scope), but * it's easier to just get a "virgin" prefix... */ int phash = prefix . hashCode ( ) ; for ( int ix = mScopeEnd - 2 ; ix >= 0 ; ix -= 2 ) { String thisP = strs [ ix ] ; if ( thisP == prefix || ( thisP . hashCode ( ) == phash && thisP . equals ( prefix ) ) ) { continue main_loop ; } } /* So far so good... but do we have a root context that might * have something too? */ if ( ctxt != null && ctxt . getNamespaceURI ( prefix ) != null ) { continue ; } break ; } seqArr [ 0 ] = seqNr ; // Ok, good; then let's just add it in... if ( mScopeEnd >= strs . length ) { // let's just double the array sizes... strs = DataUtil . growArrayBy ( strs , strs . length ) ; mNsStrings = strs ; } strs [ mScopeEnd ++ ] = prefix ; strs [ mScopeEnd ++ ] = uri ; return prefix ; }
Method used to add a dynamic binding and return the prefix used to bind the specified namespace URI .