Package org.docx4j.org.apache.fop.util
Class XMLResourceBundle
java.lang.Object
java.util.ResourceBundle
org.docx4j.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
Constructors Constructor Description XMLResourceBundle(java.io.InputStream in)Creates a resource bundle from an InputStream. -
Method Summary
Modifier and Type Method Description java.util.EnumerationgetKeys()java.util.LocalegetLocale()static java.util.ResourceBundlegetXMLBundle(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.ResourceBundlegetXMLBundle(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.ObjecthandleGetObject(java.lang.String key)java.lang.StringtoString()Methods inherited from class java.util.ResourceBundle
clearCache, clearCache, containsKey, getBaseBundleName, getBundle, getBundle, getBundle, getBundle, getBundle, getBundle, getBundle, getBundle, getObject, getString, getStringArray, handleKeySet, keySet, setParentMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Constructor Details
-
XMLResourceBundle
public XMLResourceBundle(java.io.InputStream in) throws java.io.IOExceptionCreates a resource bundle from an InputStream.- Parameters:
in- the stream to read from- Throws:
java.io.IOException- if an I/O error occurs
-
-
Method Details
-
getXMLBundle
public static java.util.ResourceBundle getXMLBundle(java.lang.String baseName, java.lang.ClassLoader loader) throws java.util.MissingResourceExceptionGets 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 nameloader- 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.MissingResourceExceptionGets 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 namelocale- the locale for which a resource bundle is desiredloader- 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:
getLocalein classjava.util.ResourceBundle
-
getKeys
public java.util.Enumeration getKeys()- Specified by:
getKeysin classjava.util.ResourceBundle
-
handleGetObject
protected java.lang.Object handleGetObject(java.lang.String key)- Specified by:
handleGetObjectin classjava.util.ResourceBundle
-
toString
public java.lang.String toString()- Overrides:
toStringin classjava.lang.Object
-