code: protected String getPrefix(String namespace, boolean generatePrefix, boolean nonEmpty) {
  		// assert namespace != null;
  		if (!namesInterned) {
  			// when String is interned we can do much faster namespace stack
  			// lookups ...
  			namespace = namespace.intern();
  		} else if (checkNamesInterned) {
  			checkInterning(namespace);
  			// assert namespace != namespace.intern();
  		}
  		if (namespace == null) {
  			throw new IllegalArgumentException("namespace must be not null" + getLocation());
  		} else if (namespace.length() == 0) {
  			throw new IllegalArgumentException("default namespace cannot have prefix" + getLocation());
  		}
  
  		// first check if namespace is already in scope
  		for (int i = namespaceEnd - 1; i >= 0; --i) {
  			if (namespace == namespaceUri[i]) {
  				final String prefix = namespacePrefix[i];
  				if (nonEmpty && prefix.length() == 0)
  					continue;
  				// now check that prefix is still in scope
  				for (int p = namespaceEnd - 1; p > i; --p) {
  					if (prefix == namespacePrefix[p])
  						continue; // too bad - prefix is redeclared with
  									// different namespace
  				}
  				return prefix;
  			}
  		}
  
  		// so not found it ...
  		if (!generatePrefix) {
  			return null;
  		}
  		return generatePrefix(namespace);
  	}
docs: Gets the prefix.
  
  @param namespace the namespace
  @param generatePrefix the generate prefix
  @param nonEmpty the non empty
  @return prefix