fop 2.0

org.apache.fop.util
Class XMLResourceBundle

java.lang.Object
  extended by java.util.ResourceBundle
      extended by org.apache.fop.util.XMLResourceBundle

public class XMLResourceBundle
extends java.util.ResourceBundle

This class is a ResourceBundle that loads its contents from XML files instead of properties files (like PropertiesResourceBundle).

The XML format for this resource bundle implementation is the following (the same as Apache Cocoon's XMLResourceBundle):

 <catalogue xml:lang="en">
   <message key="key1">Message <br/> Value 1</message>
   <message key="key2">Message <br/> Value 1</message>
   ...
 </catalogue>
 


Nested Class Summary
 
Nested classes/interfaces inherited from class java.util.ResourceBundle
java.util.ResourceBundle.Control
 
Field Summary
 
Fields inherited from class java.util.ResourceBundle
parent
 
Constructor Summary
XMLResourceBundle(java.io.InputStream in)
          Creates a resource bundle from an InputStream.
 
Method Summary
 java.util.Enumeration getKeys()
          
 java.util.Locale getLocale()
          
static java.util.ResourceBundle getXMLBundle(java.lang.String baseName, java.lang.ClassLoader loader)
          Gets a resource bundle using the specified base name, default locale, and class loader.
static java.util.ResourceBundle getXMLBundle(java.lang.String baseName, java.util.Locale locale, java.lang.ClassLoader loader)
          Gets a resource bundle using the specified base name, locale, and class loader.
protected  java.lang.Object handleGetObject(java.lang.String key)
          
 java.lang.String toString()
          
 
Methods inherited from class java.util.ResourceBundle
clearCache, clearCache, containsKey, getBundle, getBundle, getBundle, getBundle, getBundle, getBundle, getObject, getString, getStringArray, handleKeySet, keySet, setParent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

XMLResourceBundle

public XMLResourceBundle(java.io.InputStream in)
                  throws java.io.IOException
Creates a resource bundle from an InputStream.

Parameters:
in - the stream to read from
Throws:
java.io.IOException - if an I/O error occurs
Method Detail

getXMLBundle

public static java.util.ResourceBundle getXMLBundle(java.lang.String baseName,
                                                    java.lang.ClassLoader loader)
                                             throws java.util.MissingResourceException
Gets a resource bundle using the specified base name, default locale, and class loader.

Parameters:
baseName - the base name of the resource bundle, a fully qualified class name
loader - the class loader from which to load the resource bundle
Returns:
a resource bundle for the given base name and the default locale
Throws:
java.util.MissingResourceException - if no resource bundle for the specified base name can be found
See Also:
ResourceBundle.getBundle(String)

getXMLBundle

public static java.util.ResourceBundle getXMLBundle(java.lang.String baseName,
                                                    java.util.Locale locale,
                                                    java.lang.ClassLoader loader)
                                             throws java.util.MissingResourceException
Gets a resource bundle using the specified base name, locale, and class loader.

Parameters:
baseName - the base name of the resource bundle, a fully qualified class name
locale - the locale for which a resource bundle is desired
loader - the class loader from which to load the resource bundle
Returns:
a resource bundle for the given base name and locale
Throws:
java.util.MissingResourceException - if no resource bundle for the specified base name can be found
See Also:
ResourceBundle.getBundle(String, Locale, ClassLoader)

getLocale

public java.util.Locale getLocale()

Overrides:
getLocale in class java.util.ResourceBundle

getKeys

public java.util.Enumeration getKeys()

Specified by:
getKeys in class java.util.ResourceBundle

handleGetObject

protected java.lang.Object handleGetObject(java.lang.String key)

Specified by:
handleGetObject in class java.util.ResourceBundle

toString

public java.lang.String toString()

Overrides:
toString in class java.lang.Object

fop 2.0

Copyright 1999-2015 The Apache Software Foundation. All Rights Reserved.