public static IXMLFormatter getXMLFormatter(Class toClass)
    {
        if (g_oFormatters == null)
        {
            g_oFormatters = new HashTable<Class, IXMLFormatter>();
        }

        if (g_oFormatters.containsKey(toClass))
        {
            return g_oFormatters.get(toClass);
        }

        // Need to load and cache the formatter for this type


        // TODO: Need to implement the usage of FormatTypes
        List<IXMLFormatter> loFormatters = Application.getInstance().getObjectCache().getObjects(IXMLFormatter.class, "supports");
        IXMLFormatter loDefaultFormatter = getDefaultFormatter();

        IXMLFormatter loCurrent = null;
        for (IXMLFormatter loFormatter : loFormatters)
        {
            // Taking note of what this formatter (examined in the loop) supports.
            Class loSupportedClass = loFormatter.supports();
            if (loSupportedClass == toClass)
            {
                loCurrent = loFormatter;
                break;
            }

            // If this formatter is not a default formatter
            // and the class (whose formatter we are looking for) is equal or assignable
            // to the class this formatter supports
            if (loFormatter.getClass() != loDefaultFormatter.getClass() && Goliath.DynamicCode.Java.isEqualOrAssignable(loSupportedClass, toClass))
            {
                // Get the formatter whose supported class is at the closest distance to the class whose formatter we're looking for

                // If currently there's no selected formatter, or the class supported by the currently selected
                // extends the class supported by this formatter
                if (loCurrent == null || Goliath.DynamicCode.Java.isEqualOrAssignable(loCurrent.supports(), loSupportedClass))
                {
                    loCurrent = loFormatter;
                }
            }
        }
        g_oFormatters.put(toClass, (loCurrent == null) ? loDefaultFormatter : loCurrent);
        return g_oFormatters.get(toClass);
    }