*
     * @param catalogueId if not null, this catalogue will be used instead of the default one.
     */
    private String getString(String key, String catalogueId, String defaultValue) {
        try {
            Bundle catalogue = defaultCatalogue;
            if (catalogueId != null) {
                CatalogueInfo catalogueInfo = (CatalogueInfo)catalogues.get(catalogueId);
                if (catalogueInfo == null) {
                    if (getLogger().isDebugEnabled())
                        debug("Catalogue not found: " + catalogueId + ", could not translate key " + key);
                    return defaultValue;
                }
                try {
                    catalogue = catalogueInfo.getCatalogue();
                } catch (Exception e) {
                    getLogger().error("Error getting catalogue " + catalogueInfo.getName() + " from location " + catalogueInfo.getLocation() + " for locale " + locale + ", will not translate key " + key);
                    return defaultValue;
                }
            }
            Node res = (Node)catalogue.getObject(
                    I18N_CATALOGUE_PREFIX + "[@key='" + key + "']");
            String value = getTextValue(res);
            return value != null ? value : defaultValue;
        } catch (MissingResourceException e)  {