001: /*
002: * Copyright 1999-2005 The Apache Software Foundation.
003: *
004: * Licensed under the Apache License, Version 2.0 (the "License");
005: * you may not use this file except in compliance with the License.
006: * You may obtain a copy of the License at
007: *
008: * http://www.apache.org/licenses/LICENSE-2.0
009: *
010: * Unless required by applicable law or agreed to in writing, software
011: * distributed under the License is distributed on an "AS IS" BASIS,
012: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013: * See the License for the specific language governing permissions and
014: * limitations under the License.
015: */
016: /*
017: * $Id: XPATHErrorResources.java,v 1.32 2005/06/29 19:33:06 jycli Exp $
018: */
019: package org.apache.xpath.res;
020:
021: import java.util.ListResourceBundle;
022: import java.util.Locale;
023: import java.util.MissingResourceException;
024: import java.util.ResourceBundle;
025:
026: /**
027: * Set up error messages.
028: * We build a two dimensional array of message keys and
029: * message strings. In order to add a new message here,
030: * you need to first add a Static string constant for the
031: * Key and update the contents array with Key, Value pair
032: * Also you need to update the count of messages(MAX_CODE)or
033: * the count of warnings(MAX_WARNING) [ Information purpose only]
034: * @xsl.usage advanced
035: */
036: public class XPATHErrorResources extends ListResourceBundle {
037:
038: /*
039: * General notes to translators:
040: *
041: * This file contains error and warning messages related to XPath Error
042: * Handling.
043: *
044: * 1) Xalan (or more properly, Xalan-interpretive) and XSLTC are names of
045: * components.
046: * XSLT is an acronym for "XML Stylesheet Language: Transformations".
047: * XSLTC is an acronym for XSLT Compiler.
048: *
049: * 2) A stylesheet is a description of how to transform an input XML document
050: * into a resultant XML document (or HTML document or text). The
051: * stylesheet itself is described in the form of an XML document.
052: *
053: * 3) A template is a component of a stylesheet that is used to match a
054: * particular portion of an input document and specifies the form of the
055: * corresponding portion of the output document.
056: *
057: * 4) An element is a mark-up tag in an XML document; an attribute is a
058: * modifier on the tag. For example, in <elem attr='val' attr2='val2'>
059: * "elem" is an element name, "attr" and "attr2" are attribute names with
060: * the values "val" and "val2", respectively.
061: *
062: * 5) A namespace declaration is a special attribute that is used to associate
063: * a prefix with a URI (the namespace). The meanings of element names and
064: * attribute names that use that prefix are defined with respect to that
065: * namespace.
066: *
067: * 6) "Translet" is an invented term that describes the class file that
068: * results from compiling an XML stylesheet into a Java class.
069: *
070: * 7) XPath is a specification that describes a notation for identifying
071: * nodes in a tree-structured representation of an XML document. An
072: * instance of that notation is referred to as an XPath expression.
073: *
074: * 8) The context node is the node in the document with respect to which an
075: * XPath expression is being evaluated.
076: *
077: * 9) An iterator is an object that traverses nodes in the tree, one at a time.
078: *
079: * 10) NCName is an XML term used to describe a name that does not contain a
080: * colon (a "no-colon name").
081: *
082: * 11) QName is an XML term meaning "qualified name".
083: */
084:
085: /*
086: * static variables
087: */
088: public static final String ERROR0000 = "ERROR0000";
089: public static final String ER_CURRENT_NOT_ALLOWED_IN_MATCH = "ER_CURRENT_NOT_ALLOWED_IN_MATCH";
090: public static final String ER_CURRENT_TAKES_NO_ARGS = "ER_CURRENT_TAKES_NO_ARGS";
091: public static final String ER_DOCUMENT_REPLACED = "ER_DOCUMENT_REPLACED";
092: public static final String ER_CONTEXT_HAS_NO_OWNERDOC = "ER_CONTEXT_HAS_NO_OWNERDOC";
093: public static final String ER_LOCALNAME_HAS_TOO_MANY_ARGS = "ER_LOCALNAME_HAS_TOO_MANY_ARGS";
094: public static final String ER_NAMESPACEURI_HAS_TOO_MANY_ARGS = "ER_NAMESPACEURI_HAS_TOO_MANY_ARGS";
095: public static final String ER_NORMALIZESPACE_HAS_TOO_MANY_ARGS = "ER_NORMALIZESPACE_HAS_TOO_MANY_ARGS";
096: public static final String ER_NUMBER_HAS_TOO_MANY_ARGS = "ER_NUMBER_HAS_TOO_MANY_ARGS";
097: public static final String ER_NAME_HAS_TOO_MANY_ARGS = "ER_NAME_HAS_TOO_MANY_ARGS";
098: public static final String ER_STRING_HAS_TOO_MANY_ARGS = "ER_STRING_HAS_TOO_MANY_ARGS";
099: public static final String ER_STRINGLENGTH_HAS_TOO_MANY_ARGS = "ER_STRINGLENGTH_HAS_TOO_MANY_ARGS";
100: public static final String ER_TRANSLATE_TAKES_3_ARGS = "ER_TRANSLATE_TAKES_3_ARGS";
101: public static final String ER_UNPARSEDENTITYURI_TAKES_1_ARG = "ER_UNPARSEDENTITYURI_TAKES_1_ARG";
102: public static final String ER_NAMESPACEAXIS_NOT_IMPLEMENTED = "ER_NAMESPACEAXIS_NOT_IMPLEMENTED";
103: public static final String ER_UNKNOWN_AXIS = "ER_UNKNOWN_AXIS";
104: public static final String ER_UNKNOWN_MATCH_OPERATION = "ER_UNKNOWN_MATCH_OPERATION";
105: public static final String ER_INCORRECT_ARG_LENGTH = "ER_INCORRECT_ARG_LENGTH";
106: public static final String ER_CANT_CONVERT_TO_NUMBER = "ER_CANT_CONVERT_TO_NUMBER";
107: public static final String ER_CANT_CONVERT_XPATHRESULTTYPE_TO_NUMBER = "ER_CANT_CONVERT_XPATHRESULTTYPE_TO_NUMBER";
108: public static final String ER_CANT_CONVERT_TO_NODELIST = "ER_CANT_CONVERT_TO_NODELIST";
109: public static final String ER_CANT_CONVERT_TO_MUTABLENODELIST = "ER_CANT_CONVERT_TO_MUTABLENODELIST";
110: public static final String ER_CANT_CONVERT_TO_TYPE = "ER_CANT_CONVERT_TO_TYPE";
111: public static final String ER_EXPECTED_MATCH_PATTERN = "ER_EXPECTED_MATCH_PATTERN";
112: public static final String ER_COULDNOT_GET_VAR_NAMED = "ER_COULDNOT_GET_VAR_NAMED";
113: public static final String ER_UNKNOWN_OPCODE = "ER_UNKNOWN_OPCODE";
114: public static final String ER_EXTRA_ILLEGAL_TOKENS = "ER_EXTRA_ILLEGAL_TOKENS";
115: public static final String ER_EXPECTED_DOUBLE_QUOTE = "ER_EXPECTED_DOUBLE_QUOTE";
116: public static final String ER_EXPECTED_SINGLE_QUOTE = "ER_EXPECTED_SINGLE_QUOTE";
117: public static final String ER_EMPTY_EXPRESSION = "ER_EMPTY_EXPRESSION";
118: public static final String ER_EXPECTED_BUT_FOUND = "ER_EXPECTED_BUT_FOUND";
119: public static final String ER_INCORRECT_PROGRAMMER_ASSERTION = "ER_INCORRECT_PROGRAMMER_ASSERTION";
120: public static final String ER_BOOLEAN_ARG_NO_LONGER_OPTIONAL = "ER_BOOLEAN_ARG_NO_LONGER_OPTIONAL";
121: public static final String ER_FOUND_COMMA_BUT_NO_PRECEDING_ARG = "ER_FOUND_COMMA_BUT_NO_PRECEDING_ARG";
122: public static final String ER_FOUND_COMMA_BUT_NO_FOLLOWING_ARG = "ER_FOUND_COMMA_BUT_NO_FOLLOWING_ARG";
123: public static final String ER_PREDICATE_ILLEGAL_SYNTAX = "ER_PREDICATE_ILLEGAL_SYNTAX";
124: public static final String ER_ILLEGAL_AXIS_NAME = "ER_ILLEGAL_AXIS_NAME";
125: public static final String ER_UNKNOWN_NODETYPE = "ER_UNKNOWN_NODETYPE";
126: public static final String ER_PATTERN_LITERAL_NEEDS_BE_QUOTED = "ER_PATTERN_LITERAL_NEEDS_BE_QUOTED";
127: public static final String ER_COULDNOT_BE_FORMATTED_TO_NUMBER = "ER_COULDNOT_BE_FORMATTED_TO_NUMBER";
128: public static final String ER_COULDNOT_CREATE_XMLPROCESSORLIAISON = "ER_COULDNOT_CREATE_XMLPROCESSORLIAISON";
129: public static final String ER_DIDNOT_FIND_XPATH_SELECT_EXP = "ER_DIDNOT_FIND_XPATH_SELECT_EXP";
130: public static final String ER_COULDNOT_FIND_ENDOP_AFTER_OPLOCATIONPATH = "ER_COULDNOT_FIND_ENDOP_AFTER_OPLOCATIONPATH";
131: public static final String ER_ERROR_OCCURED = "ER_ERROR_OCCURED";
132: public static final String ER_ILLEGAL_VARIABLE_REFERENCE = "ER_ILLEGAL_VARIABLE_REFERENCE";
133: public static final String ER_AXES_NOT_ALLOWED = "ER_AXES_NOT_ALLOWED";
134: public static final String ER_KEY_HAS_TOO_MANY_ARGS = "ER_KEY_HAS_TOO_MANY_ARGS";
135: public static final String ER_COUNT_TAKES_1_ARG = "ER_COUNT_TAKES_1_ARG";
136: public static final String ER_COULDNOT_FIND_FUNCTION = "ER_COULDNOT_FIND_FUNCTION";
137: public static final String ER_UNSUPPORTED_ENCODING = "ER_UNSUPPORTED_ENCODING";
138: public static final String ER_PROBLEM_IN_DTM_NEXTSIBLING = "ER_PROBLEM_IN_DTM_NEXTSIBLING";
139: public static final String ER_CANNOT_WRITE_TO_EMPTYNODELISTIMPL = "ER_CANNOT_WRITE_TO_EMPTYNODELISTIMPL";
140: public static final String ER_SETDOMFACTORY_NOT_SUPPORTED = "ER_SETDOMFACTORY_NOT_SUPPORTED";
141: public static final String ER_PREFIX_MUST_RESOLVE = "ER_PREFIX_MUST_RESOLVE";
142: public static final String ER_PARSE_NOT_SUPPORTED = "ER_PARSE_NOT_SUPPORTED";
143: public static final String ER_SAX_API_NOT_HANDLED = "ER_SAX_API_NOT_HANDLED";
144: public static final String ER_IGNORABLE_WHITESPACE_NOT_HANDLED = "ER_IGNORABLE_WHITESPACE_NOT_HANDLED";
145: public static final String ER_DTM_CANNOT_HANDLE_NODES = "ER_DTM_CANNOT_HANDLE_NODES";
146: public static final String ER_XERCES_CANNOT_HANDLE_NODES = "ER_XERCES_CANNOT_HANDLE_NODES";
147: public static final String ER_XERCES_PARSE_ERROR_DETAILS = "ER_XERCES_PARSE_ERROR_DETAILS";
148: public static final String ER_XERCES_PARSE_ERROR = "ER_XERCES_PARSE_ERROR";
149: public static final String ER_INVALID_UTF16_SURROGATE = "ER_INVALID_UTF16_SURROGATE";
150: public static final String ER_OIERROR = "ER_OIERROR";
151: public static final String ER_CANNOT_CREATE_URL = "ER_CANNOT_CREATE_URL";
152: public static final String ER_XPATH_READOBJECT = "ER_XPATH_READOBJECT";
153: public static final String ER_FUNCTION_TOKEN_NOT_FOUND = "ER_FUNCTION_TOKEN_NOT_FOUND";
154: public static final String ER_CANNOT_DEAL_XPATH_TYPE = "ER_CANNOT_DEAL_XPATH_TYPE";
155: public static final String ER_NODESET_NOT_MUTABLE = "ER_NODESET_NOT_MUTABLE";
156: public static final String ER_NODESETDTM_NOT_MUTABLE = "ER_NODESETDTM_NOT_MUTABLE";
157: /** Variable not resolvable: */
158: public static final String ER_VAR_NOT_RESOLVABLE = "ER_VAR_NOT_RESOLVABLE";
159: /** Null error handler */
160: public static final String ER_NULL_ERROR_HANDLER = "ER_NULL_ERROR_HANDLER";
161: /** Programmer's assertion: unknown opcode */
162: public static final String ER_PROG_ASSERT_UNKNOWN_OPCODE = "ER_PROG_ASSERT_UNKNOWN_OPCODE";
163: /** 0 or 1 */
164: public static final String ER_ZERO_OR_ONE = "ER_ZERO_OR_ONE";
165: /** rtf() not supported by XRTreeFragSelectWrapper */
166: public static final String ER_RTF_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_RTF_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER";
167: /** asNodeIterator() not supported by XRTreeFragSelectWrapper */
168: public static final String ER_ASNODEITERATOR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_ASNODEITERATOR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER";
169: /** fsb() not supported for XStringForChars */
170: public static final String ER_FSB_NOT_SUPPORTED_XSTRINGFORCHARS = "ER_FSB_NOT_SUPPORTED_XSTRINGFORCHARS";
171: /** Could not find variable with the name of */
172: public static final String ER_COULD_NOT_FIND_VAR = "ER_COULD_NOT_FIND_VAR";
173: /** XStringForChars can not take a string for an argument */
174: public static final String ER_XSTRINGFORCHARS_CANNOT_TAKE_STRING = "ER_XSTRINGFORCHARS_CANNOT_TAKE_STRING";
175: /** The FastStringBuffer argument can not be null */
176: public static final String ER_FASTSTRINGBUFFER_CANNOT_BE_NULL = "ER_FASTSTRINGBUFFER_CANNOT_BE_NULL";
177: /** 2 or 3 */
178: public static final String ER_TWO_OR_THREE = "ER_TWO_OR_THREE";
179: /** Variable accessed before it is bound! */
180: public static final String ER_VARIABLE_ACCESSED_BEFORE_BIND = "ER_VARIABLE_ACCESSED_BEFORE_BIND";
181: /** XStringForFSB can not take a string for an argument! */
182: public static final String ER_FSB_CANNOT_TAKE_STRING = "ER_FSB_CANNOT_TAKE_STRING";
183: /** Error! Setting the root of a walker to null! */
184: public static final String ER_SETTING_WALKER_ROOT_TO_NULL = "ER_SETTING_WALKER_ROOT_TO_NULL";
185: /** This NodeSetDTM can not iterate to a previous node! */
186: public static final String ER_NODESETDTM_CANNOT_ITERATE = "ER_NODESETDTM_CANNOT_ITERATE";
187: /** This NodeSet can not iterate to a previous node! */
188: public static final String ER_NODESET_CANNOT_ITERATE = "ER_NODESET_CANNOT_ITERATE";
189: /** This NodeSetDTM can not do indexing or counting functions! */
190: public static final String ER_NODESETDTM_CANNOT_INDEX = "ER_NODESETDTM_CANNOT_INDEX";
191: /** This NodeSet can not do indexing or counting functions! */
192: public static final String ER_NODESET_CANNOT_INDEX = "ER_NODESET_CANNOT_INDEX";
193: /** Can not call setShouldCacheNodes after nextNode has been called! */
194: public static final String ER_CANNOT_CALL_SETSHOULDCACHENODE = "ER_CANNOT_CALL_SETSHOULDCACHENODE";
195: /** {0} only allows {1} arguments */
196: public static final String ER_ONLY_ALLOWS = "ER_ONLY_ALLOWS";
197: /** Programmer's assertion in getNextStepPos: unknown stepType: {0} */
198: public static final String ER_UNKNOWN_STEP = "ER_UNKNOWN_STEP";
199: /** Problem with RelativeLocationPath */
200: public static final String ER_EXPECTED_REL_LOC_PATH = "ER_EXPECTED_REL_LOC_PATH";
201: /** Problem with LocationPath */
202: public static final String ER_EXPECTED_LOC_PATH = "ER_EXPECTED_LOC_PATH";
203: public static final String ER_EXPECTED_LOC_PATH_AT_END_EXPR = "ER_EXPECTED_LOC_PATH_AT_END_EXPR";
204: /** Problem with Step */
205: public static final String ER_EXPECTED_LOC_STEP = "ER_EXPECTED_LOC_STEP";
206: /** Problem with NodeTest */
207: public static final String ER_EXPECTED_NODE_TEST = "ER_EXPECTED_NODE_TEST";
208: /** Expected step pattern */
209: public static final String ER_EXPECTED_STEP_PATTERN = "ER_EXPECTED_STEP_PATTERN";
210: /** Expected relative path pattern */
211: public static final String ER_EXPECTED_REL_PATH_PATTERN = "ER_EXPECTED_REL_PATH_PATTERN";
212: /** ER_CANT_CONVERT_XPATHRESULTTYPE_TO_BOOLEAN */
213: public static final String ER_CANT_CONVERT_TO_BOOLEAN = "ER_CANT_CONVERT_TO_BOOLEAN";
214: /** Field ER_CANT_CONVERT_TO_SINGLENODE */
215: public static final String ER_CANT_CONVERT_TO_SINGLENODE = "ER_CANT_CONVERT_TO_SINGLENODE";
216: /** Field ER_CANT_GET_SNAPSHOT_LENGTH */
217: public static final String ER_CANT_GET_SNAPSHOT_LENGTH = "ER_CANT_GET_SNAPSHOT_LENGTH";
218: /** Field ER_NON_ITERATOR_TYPE */
219: public static final String ER_NON_ITERATOR_TYPE = "ER_NON_ITERATOR_TYPE";
220: /** Field ER_DOC_MUTATED */
221: public static final String ER_DOC_MUTATED = "ER_DOC_MUTATED";
222: public static final String ER_INVALID_XPATH_TYPE = "ER_INVALID_XPATH_TYPE";
223: public static final String ER_EMPTY_XPATH_RESULT = "ER_EMPTY_XPATH_RESULT";
224: public static final String ER_INCOMPATIBLE_TYPES = "ER_INCOMPATIBLE_TYPES";
225: public static final String ER_NULL_RESOLVER = "ER_NULL_RESOLVER";
226: public static final String ER_CANT_CONVERT_TO_STRING = "ER_CANT_CONVERT_TO_STRING";
227: public static final String ER_NON_SNAPSHOT_TYPE = "ER_NON_SNAPSHOT_TYPE";
228: public static final String ER_WRONG_DOCUMENT = "ER_WRONG_DOCUMENT";
229: /* Note to translators: The XPath expression cannot be evaluated with respect
230: * to this type of node.
231: */
232: /** Field ER_WRONG_NODETYPE */
233: public static final String ER_WRONG_NODETYPE = "ER_WRONG_NODETYPE";
234: public static final String ER_XPATH_ERROR = "ER_XPATH_ERROR";
235:
236: //BEGIN: Keys needed for exception messages of JAXP 1.3 XPath API implementation
237: public static final String ER_EXTENSION_FUNCTION_CANNOT_BE_INVOKED = "ER_EXTENSION_FUNCTION_CANNOT_BE_INVOKED";
238: public static final String ER_RESOLVE_VARIABLE_RETURNS_NULL = "ER_RESOLVE_VARIABLE_RETURNS_NULL";
239: public static final String ER_UNSUPPORTED_RETURN_TYPE = "ER_UNSUPPORTED_RETURN_TYPE";
240: public static final String ER_SOURCE_RETURN_TYPE_CANNOT_BE_NULL = "ER_SOURCE_RETURN_TYPE_CANNOT_BE_NULL";
241: public static final String ER_ARG_CANNOT_BE_NULL = "ER_ARG_CANNOT_BE_NULL";
242:
243: public static final String ER_OBJECT_MODEL_NULL = "ER_OBJECT_MODEL_NULL";
244: public static final String ER_OBJECT_MODEL_EMPTY = "ER_OBJECT_MODEL_EMPTY";
245: public static final String ER_FEATURE_NAME_NULL = "ER_FEATURE_NAME_NULL";
246: public static final String ER_FEATURE_UNKNOWN = "ER_FEATURE_UNKNOWN";
247: public static final String ER_GETTING_NULL_FEATURE = "ER_GETTING_NULL_FEATURE";
248: public static final String ER_GETTING_UNKNOWN_FEATURE = "ER_GETTING_UNKNOWN_FEATURE";
249: public static final String ER_NULL_XPATH_FUNCTION_RESOLVER = "ER_NULL_XPATH_FUNCTION_RESOLVER";
250: public static final String ER_NULL_XPATH_VARIABLE_RESOLVER = "ER_NULL_XPATH_VARIABLE_RESOLVER";
251: //END: Keys needed for exception messages of JAXP 1.3 XPath API implementation
252:
253: public static final String WG_LOCALE_NAME_NOT_HANDLED = "WG_LOCALE_NAME_NOT_HANDLED";
254: public static final String WG_PROPERTY_NOT_SUPPORTED = "WG_PROPERTY_NOT_SUPPORTED";
255: public static final String WG_DONT_DO_ANYTHING_WITH_NS = "WG_DONT_DO_ANYTHING_WITH_NS";
256: public static final String WG_SECURITY_EXCEPTION = "WG_SECURITY_EXCEPTION";
257: public static final String WG_QUO_NO_LONGER_DEFINED = "WG_QUO_NO_LONGER_DEFINED";
258: public static final String WG_NEED_DERIVED_OBJECT_TO_IMPLEMENT_NODETEST = "WG_NEED_DERIVED_OBJECT_TO_IMPLEMENT_NODETEST";
259: public static final String WG_FUNCTION_TOKEN_NOT_FOUND = "WG_FUNCTION_TOKEN_NOT_FOUND";
260: public static final String WG_COULDNOT_FIND_FUNCTION = "WG_COULDNOT_FIND_FUNCTION";
261: public static final String WG_CANNOT_MAKE_URL_FROM = "WG_CANNOT_MAKE_URL_FROM";
262: public static final String WG_EXPAND_ENTITIES_NOT_SUPPORTED = "WG_EXPAND_ENTITIES_NOT_SUPPORTED";
263: public static final String WG_ILLEGAL_VARIABLE_REFERENCE = "WG_ILLEGAL_VARIABLE_REFERENCE";
264: public static final String WG_UNSUPPORTED_ENCODING = "WG_UNSUPPORTED_ENCODING";
265:
266: /** detach() not supported by XRTreeFragSelectWrapper */
267: public static final String ER_DETACH_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_DETACH_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER";
268: /** num() not supported by XRTreeFragSelectWrapper */
269: public static final String ER_NUM_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_NUM_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER";
270: /** xstr() not supported by XRTreeFragSelectWrapper */
271: public static final String ER_XSTR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_XSTR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER";
272: /** str() not supported by XRTreeFragSelectWrapper */
273: public static final String ER_STR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_STR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER";
274:
275: // Error messages...
276:
277: /**
278: * Get the association list.
279: *
280: * @return The association list.
281: */
282: public Object[][] getContents() {
283: return new Object[][] {
284:
285: { "ERROR0000", "{0}" },
286:
287: { ER_CURRENT_NOT_ALLOWED_IN_MATCH,
288: "The current() function is not allowed in a match pattern!" },
289:
290: { ER_CURRENT_TAKES_NO_ARGS,
291: "The current() function does not accept arguments!" },
292:
293: {
294: ER_DOCUMENT_REPLACED,
295: "document() function implementation has been replaced by org.apache.xalan.xslt.FuncDocument!" },
296:
297: { ER_CONTEXT_HAS_NO_OWNERDOC,
298: "context does not have an owner document!" },
299:
300: { ER_LOCALNAME_HAS_TOO_MANY_ARGS,
301: "local-name() has too many arguments." },
302:
303: { ER_NAMESPACEURI_HAS_TOO_MANY_ARGS,
304: "namespace-uri() has too many arguments." },
305:
306: { ER_NORMALIZESPACE_HAS_TOO_MANY_ARGS,
307: "normalize-space() has too many arguments." },
308:
309: { ER_NUMBER_HAS_TOO_MANY_ARGS,
310: "number() has too many arguments." },
311:
312: { ER_NAME_HAS_TOO_MANY_ARGS,
313: "name() has too many arguments." },
314:
315: { ER_STRING_HAS_TOO_MANY_ARGS,
316: "string() has too many arguments." },
317:
318: { ER_STRINGLENGTH_HAS_TOO_MANY_ARGS,
319: "string-length() has too many arguments." },
320:
321: { ER_TRANSLATE_TAKES_3_ARGS,
322: "The translate() function takes three arguments!" },
323:
324: { ER_UNPARSEDENTITYURI_TAKES_1_ARG,
325: "The unparsed-entity-uri function should take one argument!" },
326:
327: { ER_NAMESPACEAXIS_NOT_IMPLEMENTED,
328: "namespace axis not implemented yet!" },
329:
330: { ER_UNKNOWN_AXIS, "unknown axis: {0}" },
331:
332: { ER_UNKNOWN_MATCH_OPERATION,
333: "unknown match operation!" },
334:
335: { ER_INCORRECT_ARG_LENGTH,
336: "Arg length of processing-instruction() node test is incorrect!" },
337:
338: { ER_CANT_CONVERT_TO_NUMBER,
339: "Can not convert {0} to a number" },
340:
341: { ER_CANT_CONVERT_TO_NODELIST,
342: "Can not convert {0} to a NodeList!" },
343:
344: { ER_CANT_CONVERT_TO_MUTABLENODELIST,
345: "Can not convert {0} to a NodeSetDTM!" },
346:
347: { ER_CANT_CONVERT_TO_TYPE,
348: "Can not convert {0} to a type#{1}" },
349:
350: { ER_EXPECTED_MATCH_PATTERN,
351: "Expected match pattern in getMatchScore!" },
352:
353: { ER_COULDNOT_GET_VAR_NAMED,
354: "Could not get variable named {0}" },
355:
356: { ER_UNKNOWN_OPCODE, "ERROR! Unknown op code: {0}" },
357:
358: { ER_EXTRA_ILLEGAL_TOKENS, "Extra illegal tokens: {0}" },
359:
360: { ER_EXPECTED_DOUBLE_QUOTE,
361: "misquoted literal... expected double quote!" },
362:
363: { ER_EXPECTED_SINGLE_QUOTE,
364: "misquoted literal... expected single quote!" },
365:
366: { ER_EMPTY_EXPRESSION, "Empty expression!" },
367:
368: { ER_EXPECTED_BUT_FOUND, "Expected {0}, but found: {1}" },
369:
370: { ER_INCORRECT_PROGRAMMER_ASSERTION,
371: "Programmer assertion is incorrect! - {0}" },
372:
373: { ER_BOOLEAN_ARG_NO_LONGER_OPTIONAL,
374: "boolean(...) argument is no longer optional with 19990709 XPath draft." },
375:
376: { ER_FOUND_COMMA_BUT_NO_PRECEDING_ARG,
377: "Found ',' but no preceding argument!" },
378:
379: { ER_FOUND_COMMA_BUT_NO_FOLLOWING_ARG,
380: "Found ',' but no following argument!" },
381:
382: {
383: ER_PREDICATE_ILLEGAL_SYNTAX,
384: "'..[predicate]' or '.[predicate]' is illegal syntax. Use 'self::node()[predicate]' instead." },
385:
386: { ER_ILLEGAL_AXIS_NAME, "illegal axis name: {0}" },
387:
388: { ER_UNKNOWN_NODETYPE, "Unknown nodetype: {0}" },
389:
390: { ER_PATTERN_LITERAL_NEEDS_BE_QUOTED,
391: "Pattern literal ({0}) needs to be quoted!" },
392:
393: { ER_COULDNOT_BE_FORMATTED_TO_NUMBER,
394: "{0} could not be formatted to a number!" },
395:
396: { ER_COULDNOT_CREATE_XMLPROCESSORLIAISON,
397: "Could not create XML TransformerFactory Liaison: {0}" },
398:
399: { ER_DIDNOT_FIND_XPATH_SELECT_EXP,
400: "Error! Did not find xpath select expression (-select)." },
401:
402: { ER_COULDNOT_FIND_ENDOP_AFTER_OPLOCATIONPATH,
403: "ERROR! Could not find ENDOP after OP_LOCATIONPATH" },
404:
405: { ER_ERROR_OCCURED, "Error occured!" },
406:
407: {
408: ER_ILLEGAL_VARIABLE_REFERENCE,
409: "VariableReference given for variable out of context or without definition! Name = {0}" },
410:
411: {
412: ER_AXES_NOT_ALLOWED,
413: "Only child:: and attribute:: axes are allowed in match patterns! Offending axes = {0}" },
414:
415: { ER_KEY_HAS_TOO_MANY_ARGS,
416: "key() has an incorrect number of arguments." },
417:
418: { ER_COUNT_TAKES_1_ARG,
419: "The count function should take one argument!" },
420:
421: { ER_COULDNOT_FIND_FUNCTION,
422: "Could not find function: {0}" },
423:
424: { ER_UNSUPPORTED_ENCODING, "Unsupported encoding: {0}" },
425:
426: { ER_PROBLEM_IN_DTM_NEXTSIBLING,
427: "Problem occured in DTM in getNextSibling... trying to recover" },
428:
429: { ER_CANNOT_WRITE_TO_EMPTYNODELISTIMPL,
430: "Programmer error: EmptyNodeList can not be written to." },
431:
432: { ER_SETDOMFACTORY_NOT_SUPPORTED,
433: "setDOMFactory is not supported by XPathContext!" },
434:
435: { ER_PREFIX_MUST_RESOLVE,
436: "Prefix must resolve to a namespace: {0}" },
437:
438: { ER_PARSE_NOT_SUPPORTED,
439: "parse (InputSource source) not supported in XPathContext! Can not open {0}" },
440:
441: { ER_SAX_API_NOT_HANDLED,
442: "SAX API characters(char ch[]... not handled by the DTM!" },
443:
444: { ER_IGNORABLE_WHITESPACE_NOT_HANDLED,
445: "ignorableWhitespace(char ch[]... not handled by the DTM!" },
446:
447: { ER_DTM_CANNOT_HANDLE_NODES,
448: "DTMLiaison can not handle nodes of type {0}" },
449:
450: { ER_XERCES_CANNOT_HANDLE_NODES,
451: "DOM2Helper can not handle nodes of type {0}" },
452:
453: { ER_XERCES_PARSE_ERROR_DETAILS,
454: "DOM2Helper.parse error: SystemID - {0} line - {1}" },
455:
456: { ER_XERCES_PARSE_ERROR, "DOM2Helper.parse error" },
457:
458: { ER_INVALID_UTF16_SURROGATE,
459: "Invalid UTF-16 surrogate detected: {0} ?" },
460:
461: { ER_OIERROR, "IO error" },
462:
463: { ER_CANNOT_CREATE_URL, "Cannot create url for: {0}" },
464:
465: { ER_XPATH_READOBJECT, "In XPath.readObject: {0}" },
466:
467: { ER_FUNCTION_TOKEN_NOT_FOUND,
468: "function token not found." },
469:
470: { ER_CANNOT_DEAL_XPATH_TYPE,
471: "Can not deal with XPath type: {0}" },
472:
473: { ER_NODESET_NOT_MUTABLE, "This NodeSet is not mutable" },
474:
475: { ER_NODESETDTM_NOT_MUTABLE,
476: "This NodeSetDTM is not mutable" },
477:
478: { ER_VAR_NOT_RESOLVABLE, "Variable not resolvable: {0}" },
479:
480: { ER_NULL_ERROR_HANDLER, "Null error handler" },
481:
482: { ER_PROG_ASSERT_UNKNOWN_OPCODE,
483: "Programmer''s assertion: unknown opcode: {0}" },
484:
485: { ER_ZERO_OR_ONE, "0 or 1" },
486:
487: { ER_RTF_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER,
488: "rtf() not supported by XRTreeFragSelectWrapper" },
489:
490: { ER_RTF_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER,
491: "asNodeIterator() not supported by XRTreeFragSelectWrapper" },
492:
493: /** detach() not supported by XRTreeFragSelectWrapper */
494: { ER_DETACH_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER,
495: "detach() not supported by XRTreeFragSelectWrapper" },
496:
497: /** num() not supported by XRTreeFragSelectWrapper */
498: { ER_NUM_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER,
499: "num() not supported by XRTreeFragSelectWrapper" },
500:
501: /** xstr() not supported by XRTreeFragSelectWrapper */
502: { ER_XSTR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER,
503: "xstr() not supported by XRTreeFragSelectWrapper" },
504:
505: /** str() not supported by XRTreeFragSelectWrapper */
506: { ER_STR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER,
507: "str() not supported by XRTreeFragSelectWrapper" },
508:
509: { ER_FSB_NOT_SUPPORTED_XSTRINGFORCHARS,
510: "fsb() not supported for XStringForChars" },
511:
512: { ER_COULD_NOT_FIND_VAR,
513: "Could not find variable with the name of {0}" },
514:
515: { ER_XSTRINGFORCHARS_CANNOT_TAKE_STRING,
516: "XStringForChars can not take a string for an argument" },
517:
518: { ER_FASTSTRINGBUFFER_CANNOT_BE_NULL,
519: "The FastStringBuffer argument can not be null" },
520:
521: { ER_TWO_OR_THREE, "2 or 3" },
522:
523: { ER_VARIABLE_ACCESSED_BEFORE_BIND,
524: "Variable accessed before it is bound!" },
525:
526: { ER_FSB_CANNOT_TAKE_STRING,
527: "XStringForFSB can not take a string for an argument!" },
528:
529: { ER_SETTING_WALKER_ROOT_TO_NULL,
530: "\n !!!! Error! Setting the root of a walker to null!!!" },
531:
532: { ER_NODESETDTM_CANNOT_ITERATE,
533: "This NodeSetDTM can not iterate to a previous node!" },
534:
535: { ER_NODESET_CANNOT_ITERATE,
536: "This NodeSet can not iterate to a previous node!" },
537:
538: { ER_NODESETDTM_CANNOT_INDEX,
539: "This NodeSetDTM can not do indexing or counting functions!" },
540:
541: { ER_NODESET_CANNOT_INDEX,
542: "This NodeSet can not do indexing or counting functions!" },
543:
544: { ER_CANNOT_CALL_SETSHOULDCACHENODE,
545: "Can not call setShouldCacheNodes after nextNode has been called!" },
546:
547: { ER_ONLY_ALLOWS, "{0} only allows {1} arguments" },
548:
549: { ER_UNKNOWN_STEP,
550: "Programmer''s assertion in getNextStepPos: unknown stepType: {0}" },
551:
552: //Note to translators: A relative location path is a form of XPath expression.
553: // The message indicates that such an expression was expected following the
554: // characters '/' or '//', but was not found.
555: { ER_EXPECTED_REL_LOC_PATH,
556: "A relative location path was expected following the '/' or '//' token." },
557:
558: // Note to translators: A location path is a form of XPath expression.
559: // The message indicates that syntactically such an expression was expected,but
560: // the characters specified by the substitution text were encountered instead.
561: {
562: ER_EXPECTED_LOC_PATH,
563: "A location path was expected, but the following token was encountered\u003a {0}" },
564:
565: // Note to translators: A location path is a form of XPath expression.
566: // The message indicates that syntactically such a subexpression was expected,
567: // but no more characters were found in the expression.
568: {
569: ER_EXPECTED_LOC_PATH_AT_END_EXPR,
570: "A location path was expected, but the end of the XPath expression was found instead." },
571:
572: // Note to translators: A location step is part of an XPath expression.
573: // The message indicates that syntactically such an expression was expected
574: // following the specified characters.
575: { ER_EXPECTED_LOC_STEP,
576: "A location step was expected following the '/' or '//' token." },
577:
578: // Note to translators: A node test is part of an XPath expression that is
579: // used to test for particular kinds of nodes. In this case, a node test that
580: // consists of an NCName followed by a colon and an asterisk or that consists
581: // of a QName was expected, but was not found.
582: { ER_EXPECTED_NODE_TEST,
583: "A node test that matches either NCName:* or QName was expected." },
584:
585: // Note to translators: A step pattern is part of an XPath expression.
586: // The message indicates that syntactically such an expression was expected,
587: // but the specified character was found in the expression instead.
588: { ER_EXPECTED_STEP_PATTERN,
589: "A step pattern was expected, but '/' was encountered." },
590:
591: // Note to translators: A relative path pattern is part of an XPath expression.
592: // The message indicates that syntactically such an expression was expected,
593: // but was not found.
594: { ER_EXPECTED_REL_PATH_PATTERN,
595: "A relative path pattern was expected." },
596:
597: // Note to translators: The substitution text is the name of a data type. The
598: // message indicates that a value of a particular type could not be converted
599: // to a value of type boolean.
600: {
601: ER_CANT_CONVERT_TO_BOOLEAN,
602: "The XPathResult of XPath expression ''{0}'' has an XPathResultType of {1} which cannot be converted to a boolean." },
603:
604: // Note to translators: Do not translate ANY_UNORDERED_NODE_TYPE and
605: // FIRST_ORDERED_NODE_TYPE.
606: {
607: ER_CANT_CONVERT_TO_SINGLENODE,
608: "The XPathResult of XPath expression ''{0}'' has an XPathResultType of {1} which cannot be converted to a single node. The method getSingleNodeValue applies only to types ANY_UNORDERED_NODE_TYPE and FIRST_ORDERED_NODE_TYPE." },
609:
610: // Note to translators: Do not translate UNORDERED_NODE_SNAPSHOT_TYPE and
611: // ORDERED_NODE_SNAPSHOT_TYPE.
612: {
613: ER_CANT_GET_SNAPSHOT_LENGTH,
614: "The method getSnapshotLength cannot be called on the XPathResult of XPath expression ''{0}'' because its XPathResultType is {1}. This method applies only to types UNORDERED_NODE_SNAPSHOT_TYPE and ORDERED_NODE_SNAPSHOT_TYPE." },
615:
616: {
617: ER_NON_ITERATOR_TYPE,
618: "The method iterateNext cannot be called on the XPathResult of XPath expression ''{0}'' because its XPathResultType is {1}. This method applies only to types UNORDERED_NODE_ITERATOR_TYPE and ORDERED_NODE_ITERATOR_TYPE." },
619:
620: // Note to translators: This message indicates that the document being operated
621: // upon changed, so the iterator object that was being used to traverse the
622: // document has now become invalid.
623: { ER_DOC_MUTATED,
624: "Document mutated since result was returned. Iterator is invalid." },
625:
626: { ER_INVALID_XPATH_TYPE,
627: "Invalid XPath type argument: {0}" },
628:
629: { ER_EMPTY_XPATH_RESULT, "Empty XPath result object" },
630:
631: {
632: ER_INCOMPATIBLE_TYPES,
633: "The XPathResult of XPath expression ''{0}'' has an XPathResultType of {1} which cannot be coerced into the specified XPathResultType of {2}." },
634:
635: { ER_NULL_RESOLVER,
636: "Unable to resolve prefix with null prefix resolver." },
637:
638: // Note to translators: The substitution text is the name of a data type. The
639: // message indicates that a value of a particular type could not be converted
640: // to a value of type string.
641: {
642: ER_CANT_CONVERT_TO_STRING,
643: "The XPathResult of XPath expression ''{0}'' has an XPathResultType of {1} which cannot be converted to a string." },
644:
645: // Note to translators: Do not translate snapshotItem,
646: // UNORDERED_NODE_SNAPSHOT_TYPE and ORDERED_NODE_SNAPSHOT_TYPE.
647: {
648: ER_NON_SNAPSHOT_TYPE,
649: "The method snapshotItem cannot be called on the XPathResult of XPath expression ''{0}'' because its XPathResultType is {1}. This method applies only to types UNORDERED_NODE_SNAPSHOT_TYPE and ORDERED_NODE_SNAPSHOT_TYPE." },
650:
651: // Note to translators: XPathEvaluator is a Java interface name. An
652: // XPathEvaluator is created with respect to a particular XML document, and in
653: // this case the expression represented by this object was being evaluated with
654: // respect to a context node from a different document.
655: {
656: ER_WRONG_DOCUMENT,
657: "Context node does not belong to the document that is bound to this XPathEvaluator." },
658:
659: // Note to translators: The XPath expression cannot be evaluated with respect
660: // to this type of node.
661: { ER_WRONG_NODETYPE,
662: "The context node type is not supported." },
663:
664: { ER_XPATH_ERROR, "Unknown error in XPath." },
665:
666: {
667: ER_CANT_CONVERT_XPATHRESULTTYPE_TO_NUMBER,
668: "The XPathResult of XPath expression ''{0}'' has an XPathResultType of {1} which cannot be converted to a number" },
669:
670: //BEGIN: Definitions of error keys used in exception messages of JAXP 1.3 XPath API implementation
671:
672: /** Field ER_EXTENSION_FUNCTION_CANNOT_BE_INVOKED */
673:
674: {
675: ER_EXTENSION_FUNCTION_CANNOT_BE_INVOKED,
676: "Extension function: ''{0}'' can not be invoked when the XMLConstants.FEATURE_SECURE_PROCESSING feature is set to true." },
677:
678: /** Field ER_RESOLVE_VARIABLE_RETURNS_NULL */
679:
680: { ER_RESOLVE_VARIABLE_RETURNS_NULL,
681: "resolveVariable for variable {0} returning null" },
682:
683: /** Field ER_UNSUPPORTED_RETURN_TYPE */
684:
685: { ER_UNSUPPORTED_RETURN_TYPE,
686: "UnSupported Return Type : {0}" },
687:
688: /** Field ER_SOURCE_RETURN_TYPE_CANNOT_BE_NULL */
689:
690: { ER_SOURCE_RETURN_TYPE_CANNOT_BE_NULL,
691: "Source and/or Return Type can not be null" },
692:
693: /** Field ER_SOURCE_RETURN_TYPE_CANNOT_BE_NULL */
694:
695: { ER_SOURCE_RETURN_TYPE_CANNOT_BE_NULL,
696: "Source and/or Return Type can not be null" },
697:
698: /** Field ER_ARG_CANNOT_BE_NULL */
699:
700: { ER_ARG_CANNOT_BE_NULL, "{0} argument can not be null" },
701:
702: /** Field ER_OBJECT_MODEL_NULL */
703:
704: {
705: ER_OBJECT_MODEL_NULL,
706: "{0}#isObjectModelSupported( String objectModel ) cannot be called with objectModel == null" },
707:
708: /** Field ER_OBJECT_MODEL_EMPTY */
709:
710: {
711: ER_OBJECT_MODEL_EMPTY,
712: "{0}#isObjectModelSupported( String objectModel ) cannot be called with objectModel == \"\"" },
713:
714: /** Field ER_OBJECT_MODEL_EMPTY */
715:
716: { ER_FEATURE_NAME_NULL,
717: "Trying to set a feature with a null name: {0}#setFeature( null, {1})" },
718:
719: /** Field ER_FEATURE_UNKNOWN */
720:
721: { ER_FEATURE_UNKNOWN,
722: "Trying to set the unknown feature \"{0}\":{1}#setFeature({0},{2})" },
723:
724: /** Field ER_GETTING_NULL_FEATURE */
725:
726: { ER_GETTING_NULL_FEATURE,
727: "Trying to get a feature with a null name: {0}#getFeature(null)" },
728:
729: /** Field ER_GETTING_NULL_FEATURE */
730:
731: { ER_GETTING_UNKNOWN_FEATURE,
732: "Trying to get the unknown feature \"{0}\":{1}#getFeature({0})" },
733:
734: /** Field ER_NULL_XPATH_FUNCTION_RESOLVER */
735:
736: {
737: ER_NULL_XPATH_FUNCTION_RESOLVER,
738: "Attempting to set a null XPathFunctionResolver:{0}#setXPathFunctionResolver(null)" },
739:
740: /** Field ER_NULL_XPATH_VARIABLE_RESOLVER */
741:
742: {
743: ER_NULL_XPATH_VARIABLE_RESOLVER,
744: "Attempting to set a null XPathVariableResolver:{0}#setXPathVariableResolver(null)" },
745:
746: //END: Definitions of error keys used in exception messages of JAXP 1.3 XPath API implementation
747:
748: // Warnings...
749:
750: { WG_LOCALE_NAME_NOT_HANDLED,
751: "locale name in the format-number function not yet handled!" },
752:
753: { WG_PROPERTY_NOT_SUPPORTED,
754: "XSL Property not supported: {0}" },
755:
756: { WG_DONT_DO_ANYTHING_WITH_NS,
757: "Do not currently do anything with namespace {0} in property: {1}" },
758:
759: { WG_SECURITY_EXCEPTION,
760: "SecurityException when trying to access XSL system property: {0}" },
761:
762: { WG_QUO_NO_LONGER_DEFINED,
763: "Old syntax: quo(...) is no longer defined in XPath." },
764:
765: { WG_NEED_DERIVED_OBJECT_TO_IMPLEMENT_NODETEST,
766: "XPath needs a derived object to implement nodeTest!" },
767:
768: { WG_FUNCTION_TOKEN_NOT_FOUND,
769: "function token not found." },
770:
771: { WG_COULDNOT_FIND_FUNCTION,
772: "Could not find function: {0}" },
773:
774: { WG_CANNOT_MAKE_URL_FROM, "Can not make URL from: {0}" },
775:
776: { WG_EXPAND_ENTITIES_NOT_SUPPORTED,
777: "-E option not supported for DTM parser" },
778:
779: {
780: WG_ILLEGAL_VARIABLE_REFERENCE,
781: "VariableReference given for variable out of context or without definition! Name = {0}" },
782:
783: { WG_UNSUPPORTED_ENCODING, "Unsupported encoding: {0}" },
784:
785: // Other miscellaneous text used inside the code...
786: { "ui_language", "en" },
787: { "help_language", "en" },
788: { "language", "en" },
789: { "BAD_CODE",
790: "Parameter to createMessage was out of bounds" },
791: { "FORMAT_FAILED",
792: "Exception thrown during messageFormat call" },
793: { "version", ">>>>>>> Xalan Version " },
794: { "version2", "<<<<<<<" },
795: { "yes", "yes" },
796: { "line", "Line #" },
797: { "column", "Column #" },
798: { "xsldone", "XSLProcessor: done" },
799: { "xpath_option", "xpath options: " },
800: { "optionIN", " [-in inputXMLURL]" },
801: { "optionSelect", " [-select xpath expression]" },
802: { "optionMatch",
803: " [-match match pattern (for match diagnostics)]" },
804: { "optionAnyExpr",
805: "Or just an xpath expression will do a diagnostic dump" },
806: { "noParsermsg1", "XSL Process was not successful." },
807: { "noParsermsg2", "** Could not find parser **" },
808: { "noParsermsg3", "Please check your classpath." },
809: { "noParsermsg4",
810: "If you don't have IBM's XML Parser for Java, you can download it from" },
811: { "noParsermsg5",
812: "IBM's AlphaWorks: http://www.alphaworks.ibm.com/formula/xml" },
813: { "gtone", ">1" }, { "zero", "0" }, { "one", "1" },
814: { "two", "2" }, { "three", "3" }
815:
816: };
817: }
818:
819: // ================= INFRASTRUCTURE ======================
820:
821: /** Field BAD_CODE */
822: public static final String BAD_CODE = "BAD_CODE";
823:
824: /** Field FORMAT_FAILED */
825: public static final String FORMAT_FAILED = "FORMAT_FAILED";
826:
827: /** Field ERROR_RESOURCES */
828: public static final String ERROR_RESOURCES = "org.apache.xpath.res.XPATHErrorResources";
829:
830: /** Field ERROR_STRING */
831: public static final String ERROR_STRING = "#error";
832:
833: /** Field ERROR_HEADER */
834: public static final String ERROR_HEADER = "Error: ";
835:
836: /** Field WARNING_HEADER */
837: public static final String WARNING_HEADER = "Warning: ";
838:
839: /** Field XSL_HEADER */
840: public static final String XSL_HEADER = "XSL ";
841:
842: /** Field XML_HEADER */
843: public static final String XML_HEADER = "XML ";
844:
845: /** Field QUERY_HEADER */
846: public static final String QUERY_HEADER = "PATTERN ";
847:
848: /**
849: * Return a named ResourceBundle for a particular locale. This method mimics the behavior
850: * of ResourceBundle.getBundle().
851: *
852: * @param className Name of local-specific subclass.
853: * @return the ResourceBundle
854: * @throws MissingResourceException
855: */
856: public static final XPATHErrorResources loadResourceBundle(
857: String className) throws MissingResourceException {
858:
859: Locale locale = Locale.getDefault();
860: String suffix = getResourceSuffix(locale);
861:
862: try {
863:
864: // first try with the given locale
865: return (XPATHErrorResources) ResourceBundle.getBundle(
866: className + suffix, locale);
867: } catch (MissingResourceException e) {
868: try // try to fall back to en_US if we can't load
869: {
870:
871: // Since we can't find the localized property file,
872: // fall back to en_US.
873: return (XPATHErrorResources) ResourceBundle.getBundle(
874: className, new Locale("en", "US"));
875: } catch (MissingResourceException e2) {
876:
877: // Now we are really in trouble.
878: // very bad, definitely very bad...not going to get very far
879: throw new MissingResourceException(
880: "Could not load any resource bundles.",
881: className, "");
882: }
883: }
884: }
885:
886: /**
887: * Return the resource file suffic for the indicated locale
888: * For most locales, this will be based the language code. However
889: * for Chinese, we do distinguish between Taiwan and PRC
890: *
891: * @param locale the locale
892: * @return an String suffix which canbe appended to a resource name
893: */
894: private static final String getResourceSuffix(Locale locale) {
895:
896: String suffix = "_" + locale.getLanguage();
897: String country = locale.getCountry();
898:
899: if (country.equals("TW"))
900: suffix += "_" + country;
901:
902: return suffix;
903: }
904:
905: }
|