Module root )
Module root, Module module )
	public static String needTheNamespacePrefix( ReferenceValue refValue,			Module root )	{		if ( refValue == null )			return null;		String namespace = refValue.getLibraryNamespace( );		String name = refValue.getName( );		if ( namespace == null )			return name;		Module module = null;		if ( refValue.isResolved( ) && refValue instanceof ElementRefValue )			module = ( (ElementRefValue) refValue ).getElement( ).getRoot( );		else		{			module = root.getLibraryWithNamespace( namespace );			// if it is resolved as structure, the element of strcuture			// cannot be retrieved.			if ( root instanceof Library && module == null )			{				Library lib = (Library) root;				if ( namespace.equalsIgnoreCase( lib.getNamespace( ) ) )					module = root;			}		}		// if reference value is not resolved.		String retNamespace = null;		// if cannot find the library with the given namespace, uses the		// namespace in the reference value.		if ( module == null )			retNamespace = namespace;		// if the root eqauls module and they are all not null , just return the		// name.		while ( module != root && module instanceof Library )		{			Library lib = (Library) module;			if ( retNamespace != null )				retNamespace = lib.getNamespace( )						+ ReferenceValue.NAMESPACE_DELIMITER + retNamespace;			else				retNamespace = lib.getNamespace( );			module = lib.getHost( );		}		if ( retNamespace != null )			name = retNamespace + ReferenceValue.NAMESPACE_DELIMITER + name;		return name;	}