String [ ] processName ( String qName , boolean isAttribute ) { String name [ ] ; Hashtable table ; // Select the appropriate table. if ( isAttribute ) { if ( elementNameTable == null ) elementNameTable = new Hashtable ( ) ; table = elementNameTable ; } else { if ( attributeNameTable == null ) attributeNameTable = new Hashtable ( ) ; table = attributeNameTable ; } // Start by looking in the cache, and // return immediately if the name // is already known in this content name = ( String [ ] ) table . get ( qName ) ; if ( name != null ) { return name ; } // We haven't seen this name in this // context before. name = new String [ 3 ] ; int index = qName . indexOf ( ' ' ) ; // No prefix. if ( index == - 1 ) { if ( isAttribute || defaultNS == null ) { name [ 0 ] = "" ; } else { name [ 0 ] = defaultNS ; } name [ 1 ] = qName . intern ( ) ; name [ 2 ] = name [ 1 ] ; } // Prefix else { String prefix = qName . substring ( 0 , index ) ; String local = qName . substring ( index + 1 ) ; String uri ; if ( "" . equals ( prefix ) ) { uri = defaultNS ; } else { uri = ( String ) prefixTable . get ( prefix ) ; } if ( uri == null ) { return null ; } name [ 0 ] = uri ; name [ 1 ] = local . intern ( ) ; name [ 2 ] = qName . intern ( ) ; } // Save in the cache for future use. table . put ( name [ 2 ] , name ) ; tablesDirty = true ; return name ; }
Process a raw XML 1 . 0 name in this context .