XSMessageFormatterpublic class XSMessageFormatter extends Object implements MessageFormatterSchemaMessageProvider implements an XMLMessageProvider that
provides localizable error messages for the W3C XML Schema Language |
Fields Summary |
---|
public static final String | SCHEMA_DOMAINThe domain of messages concerning the XML Schema: Structures specification. | private Locale | fLocale | private ResourceBundle | fResourceBundle |
Methods Summary |
---|
public java.lang.String | formatMessage(java.util.Locale locale, java.lang.String key, java.lang.Object[] arguments)Formats a message with the specified arguments using the given
locale information.
if (fResourceBundle == null || locale != fLocale) {
if (locale != null) {
fResourceBundle = PropertyResourceBundle.getBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLSchemaMessages", locale);
// memorize the most-recent locale
fLocale = locale;
}
if (fResourceBundle == null)
fResourceBundle = PropertyResourceBundle.getBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLSchemaMessages");
}
String msg = fResourceBundle.getString(key);
if (arguments != null) {
try {
msg = java.text.MessageFormat.format(msg, arguments);
} catch (Exception e) {
msg = fResourceBundle.getString("FormatFailed");
msg += " " + fResourceBundle.getString(key);
}
}
if (msg == null) {
msg = fResourceBundle.getString("BadMessageKey");
throw new MissingResourceException(msg, "com.sun.org.apache.xerces.internal.impl.msg.SchemaMessages", key);
}
return msg;
|
|