Debian Codegraph @

net/sf/saxon/om/StandardNames.java

raw symbols SCIP
1 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2 // Copyright (c) 2018 Saxonica Limited.
3 // This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
4 // If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
5 // This Source Code Form is "Incompatible With Secondary Licenses", as defined by the Mozilla Public License, v. 2.0.
6 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
7
8 package net.sf.saxon.om;
9
10 import net.sf.saxon.lib.NamespaceConstant;
11
12 import java.util.HashMap;
13
14
15 /**
16 * Well-known names used in XSLT processing. These names must all have
17 * fingerprints in the range 0-1023, to avoid clashing with codes allocated
18 * in a NamePool. We use the top three bits for the namespace, and the bottom
19 * seven bits for the local name.
20 * <p>Codes in the range 0-100 are used for standard node kinds such as ELEMENT,
21 * DOCUMENT, etc, and for built-in types such as ITEM and EMPTY.</p>
22 */
23
24 public abstract class StandardNames {
25
26 private static final int DFLT_NS = 0;
27 private static final int XSL_NS = 1;
28 private static final int SAXON_NS = 2;
29 private static final int XML_NS = 3;
30 private static final int XS_NS = 4;
31 private static final int XSI_NS = 5;
32 private static final int SCM_NS = 6;
33
34 public static final int DFLT = 0; // 0
35 public static final int XSL = 128; // 128
36 public static final int SAXON = 128 * 2; // 256
37 public static final int XML = 128 * 3; // 384
38 public static final int XS = 128 * 4; // 512
39 public static final int XSI = 128 * 5; // 640
40 public static final int SCM = 128 * 6; // 768
41
42 public static final int XSL_ACCEPT = XSL;
43 public static final int XSL_ACCUMULATOR = XSL + 1;
44 public static final int XSL_ACCUMULATOR_RULE = XSL + 2;
45 public static final int XSL_ANALYZE_STRING = XSL + 3;
46 public static final int XSL_APPLY_IMPORTS = XSL + 4;
47 public static final int XSL_APPLY_TEMPLATES = XSL + 5;
48 public static final int XSL_ASSERT = XSL + 6;
49 public static final int XSL_ATTRIBUTE = XSL + 7;
50 public static final int XSL_ATTRIBUTE_SET = XSL + 8;
51 public static final int XSL_BREAK = XSL + 9;
52 public static final int XSL_CALL_TEMPLATE = XSL + 10;
53 public static final int XSL_CATCH = XSL + 11;
54 public static final int XSL_CHARACTER_MAP = XSL + 13;
55 public static final int XSL_CHOOSE = XSL + 14;
56 public static final int XSL_COMMENT = XSL + 15;
57 public static final int XSL_CONTEXT_ITEM = XSL + 16;
58 public static final int XSL_COPY = XSL + 17;
59 public static final int XSL_COPY_OF = XSL + 18;
60 public static final int XSL_DECIMAL_FORMAT = XSL + 19;
61 public static final int XSL_DOCUMENT = XSL + 22;
62 public static final int XSL_ELEMENT = XSL + 23;
63 public static final int XSL_EXPOSE = XSL + 24;
64 public static final int XSL_EVALUATE = XSL + 25;
65 public static final int XSL_FALLBACK = XSL + 26;
66 public static final int XSL_FOR_EACH = XSL + 27;
67 public static final int XSL_FORK = XSL + 28;
68 public static final int XSL_FOR_EACH_GROUP = XSL + 29;
69 public static final int XSL_FUNCTION = XSL + 30;
70 public static final int XSL_GLOBAL_CONTEXT_ITEM = XSL + 31;
71 public static final int XSL_IF = XSL + 32;
72 public static final int XSL_IMPORT = XSL + 33;
73 public static final int XSL_IMPORT_SCHEMA = XSL + 34;
74 public static final int XSL_INCLUDE = XSL + 35;
75 public static final int XSL_ITERATE = XSL + 36;
76 public static final int XSL_KEY = XSL + 37;
77 public static final int XSL_MAP = XSL + 38;
78 public static final int XSL_MAP_ENTRY = XSL + 39;
79 public static final int XSL_MATCHING_SUBSTRING = XSL + 40;
80 public static final int XSL_MERGE = XSL + 41;
81 public static final int XSL_MERGE_ACTION = XSL + 42;
82 public static final int XSL_MERGE_KEY = XSL + 43;
83 public static final int XSL_MERGE_SOURCE = XSL + 44;
84 public static final int XSL_MESSAGE = XSL + 45;
85 public static final int XSL_MODE = XSL + 46;
86 public static final int XSL_NAMESPACE = XSL + 47;
87 public static final int XSL_NAMESPACE_ALIAS = XSL + 48;
88 public static final int XSL_NEXT_ITERATION = XSL + 49;
89 public static final int XSL_NEXT_MATCH = XSL + 50;
90 public static final int XSL_NON_MATCHING_SUBSTRING = XSL + 51;
91 public static final int XSL_NUMBER = XSL + 52;
92 public static final int XSL_OTHERWISE = XSL + 53;
93 public static final int XSL_ON_COMPLETION = XSL + 54;
94 public static final int XSL_ON_EMPTY = XSL + 55;
95 public static final int XSL_ON_NON_EMPTY = XSL + 56;
96 public static final int XSL_OUTPUT = XSL + 57;
97 public static final int XSL_OVERRIDE = XSL + 58;
98 public static final int XSL_OUTPUT_CHARACTER = XSL + 59;
99 public static final int XSL_PACKAGE = XSL + 60;
100 public static final int XSL_PARAM = XSL + 61;
101 public static final int XSL_PERFORM_SORT = XSL + 62;
102 public static final int XSL_PRESERVE_SPACE = XSL + 63;
103 public static final int XSL_PROCESSING_INSTRUCTION = XSL + 64;
104 public static final int XSL_RESULT_DOCUMENT = XSL + 65;
105 public static final int XSL_SEQUENCE = XSL + 66;
106 public static final int XSL_SORT = XSL + 67;
107 public static final int XSL_SOURCE_DOCUMENT = XSL + 68;
108 public static final int XSL_STRIP_SPACE = XSL + 70;
109 public static final int XSL_STYLESHEET = XSL + 71;
110 public static final int XSL_TEMPLATE = XSL + 72;
111 public static final int XSL_TEXT = XSL + 73;
112 public static final int XSL_TRANSFORM = XSL + 74;
113 public static final int XSL_TRY = XSL + 75;
114 public static final int XSL_USE_PACKAGE = XSL + 76;
115 public static final int XSL_VALUE_OF = XSL + 77;
116 public static final int XSL_VARIABLE = XSL + 78;
117 public static final int XSL_WHEN = XSL + 79;
118 public static final int XSL_WITH_PARAM = XSL + 80;
119 public static final int XSL_WHERE_POPULATED = XSL + 81;
120
121
122 public static final int XSL_DEFAULT_COLLATION = XSL + 100;
123 public static final int XSL_DEFAULT_MODE = XSL + 101;
124 public static final int XSL_DEFAULT_VALIDATION = XSL + 102;
125 public static final int XSL_EXCLUDE_RESULT_PREFIXES = XSL + 103;
126 public static final int XSL_EXPAND_TEXT = XSL + 104;
127 public static final int XSL_EXTENSION_ELEMENT_PREFIXES = XSL + 105;
128 public static final int XSL_INHERIT_NAMESPACES = XSL + 106;
129 public static final int XSL_TYPE = XSL + 107;
130 public static final int XSL_USE_ATTRIBUTE_SETS = XSL + 108;
131 public static final int XSL_USE_WHEN = XSL + 109;
132 public static final int XSL_VALIDATION = XSL + 110;
133 public static final int XSL_VERSION = XSL + 111;
134 public static final int XSL_XPATH_DEFAULT_NAMESPACE = XSL + 112;
135
136
137 public static final int SAXON_ASSIGN = SAXON + 1;
138 public static final int SAXON_DEEP_UPDATE = SAXON + 3;
139 public static final int SAXON_DO = SAXON + 6;
140 public static final int SAXON_DOCTYPE = SAXON + 7;
141 public static final int SAXON_ENTITY_REF = SAXON + 8;
142 public static final int SAXON_TABULATE_MAPS = SAXON + 9;
143 public static final int SAXON_WHILE = SAXON + 15;
144
145 // Schema extension elements
146 public static final int SAXON_PARAM = SAXON + 20;
147 public static final int SAXON_PREPROCESS = SAXON + 21;
148
149 private static final String SAXON_B = '{' + NamespaceConstant.SAXON + '}';
150 public static final String SAXON_ASSIGNABLE = SAXON_B + "assignable";
151 public static final String SAXON_ASYCHRONOUS = SAXON_B + "asynchronous";
152 public static final String SAXON_EXPLAIN = SAXON_B + "explain";
153 public static final String SAXON_READ_ONCE = SAXON_B + "read-once";
154 public static final String SAXON_MEMO_FUNCTION = SAXON_B + "memo-function";
155 public static final String SAXON_THREADS = SAXON_B + "threads";
156
157 // Not sure about this one...
158 public static final int SAXON_JAVA_LANG_OBJECT = SAXON + 29;
159
160 public static final int XML_BASE = XML + 1;
161 public static final int XML_SPACE = XML + 2;
162 public static final int XML_LANG = XML + 3;
163 public static final int XML_ID = XML + 4;
164 public static final int XML_LANG_TYPE = XML + 5;
165 public static final int XML_SPACE_TYPE = 6;
166
167 public static final NodeName XML_ID_NAME = new FingerprintedQName("xml", NamespaceConstant.XML, "id", XML_ID);
168
169 public static final int XS_STRING = XS + 1;
170 public static final int XS_BOOLEAN = XS + 2;
171 public static final int XS_DECIMAL = XS + 3;
172 public static final int XS_FLOAT = XS + 4;
173 public static final int XS_DOUBLE = XS + 5;
174 public static final int XS_DURATION = XS + 6;
175 public static final int XS_DATE_TIME = XS + 7;
176 public static final int XS_TIME = XS + 8;
177 public static final int XS_DATE = XS + 9;
178 public static final int XS_G_YEAR_MONTH = XS + 10;
179 public static final int XS_G_YEAR = XS + 11;
180 public static final int XS_G_MONTH_DAY = XS + 12;
181 public static final int XS_G_DAY = XS + 13;
182 public static final int XS_G_MONTH = XS + 14;
183 public static final int XS_HEX_BINARY = XS + 15;
184 public static final int XS_BASE64_BINARY = XS + 16;
185 public static final int XS_ANY_URI = XS + 17;
186 public static final int XS_QNAME = XS + 18;
187 public static final int XS_NOTATION = XS + 19;
188 //public static final int XS_PRECISION_DECIMAL = XS + 20;
189 public static final int XS_INTEGER = XS + 21;
190
191 // Note that any type code <= XS_INTEGER is considered to represent a
192 // primitive type: see Type.isPrimitiveType()
193
194 public static final int XS_NON_POSITIVE_INTEGER = XS + 22;
195 public static final int XS_NEGATIVE_INTEGER = XS + 23;
196 public static final int XS_LONG = XS + 24;
197 public static final int XS_INT = XS + 25;
198 public static final int XS_SHORT = XS + 26;
199 public static final int XS_BYTE = XS + 27;
200 public static final int XS_NON_NEGATIVE_INTEGER = XS + 28;
201 public static final int XS_POSITIVE_INTEGER = XS + 29;
202 public static final int XS_UNSIGNED_LONG = XS + 30;
203 public static final int XS_UNSIGNED_INT = XS + 31;
204 public static final int XS_UNSIGNED_SHORT = XS + 32;
205 public static final int XS_UNSIGNED_BYTE = XS + 33;
206 public static final int XS_NORMALIZED_STRING = XS + 41;
207 public static final int XS_TOKEN = XS + 42;
208 public static final int XS_LANGUAGE = XS + 43;
209 public static final int XS_NMTOKEN = XS + 44;
210 public static final int XS_NMTOKENS = XS + 45; // NB: list type
211 public static final int XS_NAME = XS + 46;
212 public static final int XS_NCNAME = XS + 47;
213 public static final int XS_ID = XS + 48;
214 public static final int XS_IDREF = XS + 49;
215 public static final int XS_IDREFS = XS + 50; // NB: list type
216 public static final int XS_ENTITY = XS + 51;
217 public static final int XS_ENTITIES = XS + 52; // NB: list type
218 public static final int XS_DATE_TIME_STAMP = XS + 53;
219
220 public static final int XS_ANY_TYPE = XS + 60;
221 public static final int XS_ANY_SIMPLE_TYPE = XS + 61;
222
223 public static final int XS_INVALID_NAME = XS + 62;
224 public static final int XS_ERROR = XS + 63;
225
226
227 public static final int XS_ALL = XS + 64;
228 public static final int XS_ALTERNATIVE = XS + 65;
229 public static final int XS_ANNOTATION = XS + 66;
230 public static final int XS_ANY = XS + 67;
231 public static final int XS_ANY_ATTRIBUTE = XS + 68;
232 public static final int XS_APPINFO = XS + 69;
233 public static final int XS_ASSERT = XS + 70;
234 public static final int XS_ASSERTION = XS + 71;
235 public static final int XS_ATTRIBUTE = XS + 72;
236 public static final int XS_ATTRIBUTE_GROUP = XS + 73;
237 public static final int XS_CHOICE = XS + 74;
238 public static final int XS_COMPLEX_CONTENT = XS + 75;
239 public static final int XS_COMPLEX_TYPE = XS + 76;
240 public static final int XS_DEFAULT_OPEN_CONTENT = XS + 77;
241 public static final int XS_DOCUMENTATION = XS + 78;
242 public static final int XS_ELEMENT = XS + 79;
243 public static final int XS_ENUMERATION = XS + 80;
244 public static final int XS_EXTENSION = XS + 81;
245 public static final int XS_FIELD = XS + 82;
246 public static final int XS_FRACTION_DIGITS = XS + 83;
247 public static final int XS_GROUP = XS + 84;
248 public static final int XS_IMPORT = XS + 85;
249 public static final int XS_INCLUDE = XS + 86;
250 public static final int XS_KEY = XS + 87;
251 public static final int XS_KEYREF = XS + 88;
252 public static final int XS_LENGTH = XS + 89;
253 public static final int XS_LIST = XS + 90;
254 public static final int XS_MAX_EXCLUSIVE = XS + 91;
255 public static final int XS_MAX_INCLUSIVE = XS + 92;
256 public static final int XS_MAX_LENGTH = XS + 93;
257 public static final int XS_MAX_SCALE = XS + 94;
258 public static final int XS_MIN_EXCLUSIVE = XS + 95;
259 public static final int XS_MIN_INCLUSIVE = XS + 96;
260 public static final int XS_MIN_LENGTH = XS + 97;
261 public static final int XS_MIN_SCALE = XS + 98;
262 public static final int XS_notation = XS + 99;
263 public static final int XS_OPEN_CONTENT = XS + 100;
264 public static final int XS_OVERRIDE = XS + 101;
265 public static final int XS_PATTERN = XS + 102;
266 public static final int XS_REDEFINE = XS + 103;
267 public static final int XS_RESTRICTION = XS + 104;
268 public static final int XS_SCHEMA = XS + 105;
269 public static final int XS_SELECTOR = XS + 106;
270 public static final int XS_SEQUENCE = XS + 107;
271 public static final int XS_SIMPLE_CONTENT = XS + 108;
272 public static final int XS_SIMPLE_TYPE = XS + 109;
273 public static final int XS_EXPLICIT_TIMEZONE = XS + 110;
274 public static final int XS_TOTAL_DIGITS = XS + 111;
275 public static final int XS_UNION = XS + 112;
276 public static final int XS_UNIQUE = XS + 113;
277 public static final int XS_WHITE_SPACE = XS + 114;
278
279 public static final int XS_UNTYPED = XS + 118;
280 public static final int XS_UNTYPED_ATOMIC = XS + 119;
281 public static final int XS_ANY_ATOMIC_TYPE = XS + 120;
282 public static final int XS_YEAR_MONTH_DURATION = XS + 121;
283 public static final int XS_DAY_TIME_DURATION = XS + 122;
284 public static final int XS_NUMERIC = XS + 123;
285
286
287 public static final int XSI_TYPE = XSI + 1;
288 public static final int XSI_NIL = XSI + 2;
289 public static final int XSI_SCHEMA_LOCATION = XSI + 3;
290 public static final int XSI_NO_NAMESPACE_SCHEMA_LOCATION = XSI + 4;
291 public static final int XSI_SCHEMA_LOCATION_TYPE = XSI + 5;
292
293 public static final int SCM_SCHEMA = SCM + 1;
294 public static final int SCM_ELEMENT_DECLARATION = SCM + 2;
295 public static final int SCM_ATTRIBUTE_DECLARATION = SCM + 3;
296 public static final int SCM_COMPLEX_TYPE_DEFINITION = SCM + 4;
297 public static final int SCM_SIMPLE_TYPE_DEFINITION = SCM + 5;
298 public static final int SCM_ATTRIBUTE_GROUP_DECLARATION = SCM + 6;
299 public static final int SCM_MODEL_GROUP_DECLARATION = SCM + 7;
300 public static final int SCM_NOTATION_DECLARATION = SCM + 2;
301 public static final int SCM_ANNOTATION = SCM + 2;
302 public static final int SCM_NAME = SCM + 2;
303 public static final int SCM_TARGET_NAMESPACE = SCM + 2;
304
305
306 private static String[] localNames = new String[1023];
307 private static HashMap<String, Integer> lookup = new HashMap<>(1023);
308 public static StructuredQName[] errorVariables = {
309 new StructuredQName("err", NamespaceConstant.ERR, "code"),
310 new StructuredQName("err", NamespaceConstant.ERR, "description"),
311 new StructuredQName("err", NamespaceConstant.ERR, "value"),
312 new StructuredQName("err", NamespaceConstant.ERR, "module"),
313 new StructuredQName("err", NamespaceConstant.ERR, "line-number"),
314 new StructuredQName("err", NamespaceConstant.ERR, "column-number"),
315 new StructuredQName("err", NamespaceConstant.ERR, "additional")
316 };
317 // key is an expanded QName in Clark notation
318 // value is a fingerprint, as a java.lang.Integer
319
320 private StandardNames() {
321 //pool = namePool;
322 }
323
324 private static void bindXSLTName(int constant, String localName) {
325 localNames[constant] = localName;
326 lookup.put('{' + NamespaceConstant.XSLT + '}' + localName, constant);
327 }
328
329 private static void bindSaxonName(int constant, String localName) {
330 localNames[constant] = localName;
331 lookup.put('{' + NamespaceConstant.SAXON + '}' + localName, constant);
332 }
333
334 private static void bindXMLName(int constant, String localName) {
335 localNames[constant] = localName;
336 lookup.put('{' + NamespaceConstant.XML + '}' + localName, constant);
337 }
338
339 private static void bindXSName(int constant, String localName) {
340 localNames[constant] = localName;
341 lookup.put('{' + NamespaceConstant.SCHEMA + '}' + localName, constant);
342 }
343
344 private static void bindXSIName(int constant, String localName) {
345 localNames[constant] = localName;
346 lookup.put('{' + NamespaceConstant.SCHEMA_INSTANCE + '}' + localName, constant);
347 }
348
349 static {
350
351 bindXSLTName(XSL_ACCEPT, "accept");
352 bindXSLTName(XSL_ACCUMULATOR, "accumulator");
353 bindXSLTName(XSL_ACCUMULATOR_RULE, "accumulator-rule");
354 bindXSLTName(XSL_ANALYZE_STRING, "analyze-string");
355 bindXSLTName(XSL_APPLY_IMPORTS, "apply-imports");
356 bindXSLTName(XSL_APPLY_TEMPLATES, "apply-templates");
357 bindXSLTName(XSL_ASSERT, "assert");
358 bindXSLTName(XSL_ATTRIBUTE, "attribute");
359 bindXSLTName(XSL_ATTRIBUTE_SET, "attribute-set");
360 bindXSLTName(XSL_BREAK, "break");
361 bindXSLTName(XSL_CALL_TEMPLATE, "call-template");
362 bindXSLTName(XSL_CATCH, "catch");
363 bindXSLTName(XSL_CHARACTER_MAP, "character-map");
364 bindXSLTName(XSL_CHOOSE, "choose");
365 bindXSLTName(XSL_COMMENT, "comment");
366 bindXSLTName(XSL_CONTEXT_ITEM, "context-item");
367 bindXSLTName(XSL_COPY, "copy");
368 bindXSLTName(XSL_COPY_OF, "copy-of");
369 bindXSLTName(XSL_DECIMAL_FORMAT, "decimal-format");
370 bindXSLTName(XSL_DOCUMENT, "document");
371 bindXSLTName(XSL_ELEMENT, "element");
372 bindXSLTName(XSL_EVALUATE, "evaluate");
373 bindXSLTName(XSL_EXPOSE, "expose");
374 bindXSLTName(XSL_FALLBACK, "fallback");
375 bindXSLTName(XSL_FOR_EACH, "for-each");
376 bindXSLTName(XSL_FOR_EACH_GROUP, "for-each-group");
377 bindXSLTName(XSL_FORK, "fork");
378 bindXSLTName(XSL_FUNCTION, "function");
379 bindXSLTName(XSL_GLOBAL_CONTEXT_ITEM, "global-context-item");
380 bindXSLTName(XSL_IF, "if");
381 bindXSLTName(XSL_IMPORT, "import");
382 bindXSLTName(XSL_IMPORT_SCHEMA, "import-schema");
383 bindXSLTName(XSL_INCLUDE, "include");
384 bindXSLTName(XSL_ITERATE, "iterate");
385 bindXSLTName(XSL_KEY, "key");
386 bindXSLTName(XSL_MAP, "map");
387 bindXSLTName(XSL_MAP_ENTRY, "map-entry");
388 bindXSLTName(XSL_MATCHING_SUBSTRING, "matching-substring");
389 bindXSLTName(XSL_MERGE, "merge");
390 bindXSLTName(XSL_MERGE_SOURCE, "merge-source");
391 bindXSLTName(XSL_MERGE_ACTION, "merge-action");
392 bindXSLTName(XSL_MERGE_KEY, "merge-key");
393 bindXSLTName(XSL_MESSAGE, "message");
394 bindXSLTName(XSL_MODE, "mode");
395 bindXSLTName(XSL_NEXT_MATCH, "next-match");
396 bindXSLTName(XSL_NUMBER, "number");
397 bindXSLTName(XSL_NAMESPACE, "namespace");
398 bindXSLTName(XSL_NAMESPACE_ALIAS, "namespace-alias");
399 bindXSLTName(XSL_NEXT_ITERATION, "next-iteration");
400 bindXSLTName(XSL_NON_MATCHING_SUBSTRING, "non-matching-substring");
401 bindXSLTName(XSL_ON_COMPLETION, "on-completion");
402 bindXSLTName(XSL_ON_EMPTY, "on-empty");
403 bindXSLTName(XSL_ON_NON_EMPTY, "on-non-empty");
404 bindXSLTName(XSL_OTHERWISE, "otherwise");
405 bindXSLTName(XSL_OUTPUT, "output");
406 bindXSLTName(XSL_OUTPUT_CHARACTER, "output-character");
407 bindXSLTName(XSL_OVERRIDE, "override");
408 bindXSLTName(XSL_PACKAGE, "package");
409 bindXSLTName(XSL_PARAM, "param");
410 bindXSLTName(XSL_PERFORM_SORT, "perform-sort");
411 bindXSLTName(XSL_PRESERVE_SPACE, "preserve-space");
412 bindXSLTName(XSL_PROCESSING_INSTRUCTION, "processing-instruction");
413 bindXSLTName(XSL_RESULT_DOCUMENT, "result-document");
414 bindXSLTName(XSL_SEQUENCE, "sequence");
415 bindXSLTName(XSL_SORT, "sort");
416 bindXSLTName(XSL_SOURCE_DOCUMENT, "source-document");
417 bindXSLTName(XSL_STRIP_SPACE, "strip-space");
418 bindXSLTName(XSL_STYLESHEET, "stylesheet");
419 bindXSLTName(XSL_TEMPLATE, "template");
420 bindXSLTName(XSL_TEXT, "text");
421 bindXSLTName(XSL_TRANSFORM, "transform");
422 bindXSLTName(XSL_TRY, "try");
423 bindXSLTName(XSL_USE_PACKAGE, "use-package");
424 bindXSLTName(XSL_VALUE_OF, "value-of");
425 bindXSLTName(XSL_VARIABLE, "variable");
426 bindXSLTName(XSL_WITH_PARAM, "with-param");
427 bindXSLTName(XSL_WHEN, "when");
428 bindXSLTName(XSL_WHERE_POPULATED, "where-populated");
429
430
431 bindXSLTName(XSL_DEFAULT_COLLATION, "default-collation");
432 bindXSLTName(XSL_DEFAULT_MODE, "default-mode");
433 bindXSLTName(XSL_DEFAULT_VALIDATION, "default-validation");
434 bindXSLTName(XSL_EXPAND_TEXT, "expand-text");
435 bindXSLTName(XSL_EXCLUDE_RESULT_PREFIXES, "exclude-result-prefixes");
436 bindXSLTName(XSL_EXTENSION_ELEMENT_PREFIXES, "extension-element-prefixes");
437 bindXSLTName(XSL_INHERIT_NAMESPACES, "inherit-namespaces");
438 bindXSLTName(XSL_TYPE, "type");
439 bindXSLTName(XSL_USE_ATTRIBUTE_SETS, "use-attribute-sets");
440 bindXSLTName(XSL_USE_WHEN, "use-when");
441 bindXSLTName(XSL_VALIDATION, "validation");
442 bindXSLTName(XSL_VERSION, "version");
443 bindXSLTName(XSL_XPATH_DEFAULT_NAMESPACE, "xpath-default-namespace");
444
445
446 bindSaxonName(SAXON_ASSIGN, "assign");
447 bindSaxonName(SAXON_DEEP_UPDATE, "deep-update");
448 bindSaxonName(SAXON_DO, "do");
449 bindSaxonName(SAXON_DOCTYPE, "doctype");
450 bindSaxonName(SAXON_ENTITY_REF, "entity-ref");
451 bindSaxonName(SAXON_WHILE, "while");
452 bindSaxonName(SAXON_PARAM, "param");
453 bindSaxonName(SAXON_PREPROCESS, "preprocess");
454
455 bindXMLName(XML_BASE, "base");
456 bindXMLName(XML_SPACE, "space");
457 bindXMLName(XML_LANG, "lang");
458 bindXMLName(XML_ID, "id");
459 bindXMLName(XML_LANG_TYPE, "_langType");
460 bindXMLName(XML_SPACE_TYPE, "_spaceType");
461
462 bindXSName(XS_STRING, "string");
463 bindXSName(XS_BOOLEAN, "boolean");
464 bindXSName(XS_DECIMAL, "decimal");
465 bindXSName(XS_FLOAT, "float");
466 bindXSName(XS_DOUBLE, "double");
467 bindXSName(XS_DURATION, "duration");
468 bindXSName(XS_DATE_TIME, "dateTime");
469 bindXSName(XS_TIME, "time");
470 bindXSName(XS_DATE, "date");
471 bindXSName(XS_G_YEAR_MONTH, "gYearMonth");
472 bindXSName(XS_G_YEAR, "gYear");
473 bindXSName(XS_G_MONTH_DAY, "gMonthDay");
474 bindXSName(XS_G_DAY, "gDay");
475 bindXSName(XS_G_MONTH, "gMonth");
476 bindXSName(XS_HEX_BINARY, "hexBinary");
477 bindXSName(XS_BASE64_BINARY, "base64Binary");
478 bindXSName(XS_ANY_URI, "anyURI");
479 bindXSName(XS_QNAME, "QName");
480 bindXSName(XS_NOTATION, "NOTATION");
481 bindXSName(XS_NUMERIC, "numeric");
482 bindXSName(XS_INTEGER, "integer");
483 bindXSName(XS_NON_POSITIVE_INTEGER, "nonPositiveInteger");
484 bindXSName(XS_NEGATIVE_INTEGER, "negativeInteger");
485 bindXSName(XS_LONG, "long");
486 bindXSName(XS_INT, "int");
487 bindXSName(XS_SHORT, "short");
488 bindXSName(XS_BYTE, "byte");
489 bindXSName(XS_NON_NEGATIVE_INTEGER, "nonNegativeInteger");
490 bindXSName(XS_POSITIVE_INTEGER, "positiveInteger");
491 bindXSName(XS_UNSIGNED_LONG, "unsignedLong");
492 bindXSName(XS_UNSIGNED_INT, "unsignedInt");
493 bindXSName(XS_UNSIGNED_SHORT, "unsignedShort");
494 bindXSName(XS_UNSIGNED_BYTE, "unsignedByte");
495 bindXSName(XS_NORMALIZED_STRING, "normalizedString");
496 bindXSName(XS_TOKEN, "token");
497 bindXSName(XS_LANGUAGE, "language");
498 bindXSName(XS_NMTOKEN, "NMTOKEN");
499 bindXSName(XS_NMTOKENS, "NMTOKENS"); // NB: list type
500 bindXSName(XS_NAME, "Name");
501 bindXSName(XS_NCNAME, "NCName");
502 bindXSName(XS_ID, "ID");
503 bindXSName(XS_IDREF, "IDREF");
504 bindXSName(XS_IDREFS, "IDREFS"); // NB: list type
505 bindXSName(XS_ENTITY, "ENTITY");
506 bindXSName(XS_ENTITIES, "ENTITIES"); // NB: list type
507 bindXSName(XS_DATE_TIME_STAMP, "dateTimeStamp");
508
509 bindXSName(XS_ANY_TYPE, "anyType");
510 bindXSName(XS_ANY_SIMPLE_TYPE, "anySimpleType");
511 bindXSName(XS_INVALID_NAME, "invalidName");
512 bindXSName(XS_ERROR, "error");
513
514 bindXSName(XS_ALL, "all");
515 bindXSName(XS_ALTERNATIVE, "alternative");
516 bindXSName(XS_ANNOTATION, "annotation");
517 bindXSName(XS_ANY, "any");
518 bindXSName(XS_ANY_ATTRIBUTE, "anyAttribute");
519 bindXSName(XS_APPINFO, "appinfo");
520 bindXSName(XS_ASSERT, "assert");
521 bindXSName(XS_ASSERTION, "assertion");
522 bindXSName(XS_ATTRIBUTE, "attribute");
523 bindXSName(XS_ATTRIBUTE_GROUP, "attributeGroup");
524 bindXSName(XS_CHOICE, "choice");
525 bindXSName(XS_COMPLEX_CONTENT, "complexContent");
526 bindXSName(XS_COMPLEX_TYPE, "complexType");
527 bindXSName(XS_DEFAULT_OPEN_CONTENT, "defaultOpenContent");
528 bindXSName(XS_DOCUMENTATION, "documentation");
529 bindXSName(XS_ELEMENT, "element");
530 bindXSName(XS_ENUMERATION, "enumeration");
531 bindXSName(XS_EXPLICIT_TIMEZONE, "explicitTimezone");
532 bindXSName(XS_EXTENSION, "extension");
533 bindXSName(XS_FIELD, "field");
534 bindXSName(XS_FRACTION_DIGITS, "fractionDigits");
535 bindXSName(XS_GROUP, "group");
536 bindXSName(XS_IMPORT, "import");
537 bindXSName(XS_INCLUDE, "include");
538 bindXSName(XS_KEY, "key");
539 bindXSName(XS_KEYREF, "keyref");
540 bindXSName(XS_LENGTH, "length");
541 bindXSName(XS_LIST, "list");
542 bindXSName(XS_MAX_EXCLUSIVE, "maxExclusive");
543 bindXSName(XS_MAX_INCLUSIVE, "maxInclusive");
544 bindXSName(XS_MAX_LENGTH, "maxLength");
545 bindXSName(XS_MAX_SCALE, "maxScale");
546 bindXSName(XS_MIN_EXCLUSIVE, "minExclusive");
547 bindXSName(XS_MIN_INCLUSIVE, "minInclusive");
548 bindXSName(XS_MIN_LENGTH, "minLength");
549 bindXSName(XS_MIN_SCALE, "minScale");
550 bindXSName(XS_notation, "notation");
551 bindXSName(XS_OPEN_CONTENT, "openContent");
552 bindXSName(XS_OVERRIDE, "override");
553 bindXSName(XS_PATTERN, "pattern");
554 bindXSName(XS_REDEFINE, "redefine");
555 bindXSName(XS_RESTRICTION, "restriction");
556 bindXSName(XS_SCHEMA, "schema");
557 bindXSName(XS_SELECTOR, "selector");
558 bindXSName(XS_SEQUENCE, "sequence");
559 bindXSName(XS_SIMPLE_CONTENT, "simpleContent");
560 bindXSName(XS_SIMPLE_TYPE, "simpleType");
561 bindXSName(XS_TOTAL_DIGITS, "totalDigits");
562 bindXSName(XS_UNION, "union");
563 bindXSName(XS_UNIQUE, "unique");
564 bindXSName(XS_WHITE_SPACE, "whiteSpace");
565
566 bindXSName(XS_UNTYPED, "untyped");
567 bindXSName(XS_UNTYPED_ATOMIC, "untypedAtomic");
568 bindXSName(XS_ANY_ATOMIC_TYPE, "anyAtomicType");
569 bindXSName(XS_YEAR_MONTH_DURATION, "yearMonthDuration");
570 bindXSName(XS_DAY_TIME_DURATION, "dayTimeDuration");
571
572 bindXSIName(XSI_TYPE, "type");
573 bindXSIName(XSI_NIL, "nil");
574 bindXSIName(XSI_SCHEMA_LOCATION, "schemaLocation");
575 bindXSIName(XSI_NO_NAMESPACE_SCHEMA_LOCATION, "noNamespaceSchemaLocation");
576 bindXSIName(XSI_SCHEMA_LOCATION_TYPE, "anonymous_schemaLocationType");
577 }
578
579 /**
580 * Get the fingerprint of a system-defined name, from its URI and local name
581 *
582 * @param uri the namespace URI
583 * @param localName the local part of the name
584 * @return the standard fingerprint, or -1 if this is not a built-in name
585 */
586
587 public static int getFingerprint(String uri, String localName) {
588 Integer fp = lookup.get('{' + uri + '}' + localName);
589 if (fp == null) {
590 return -1;
591 } else {
592 return fp;
593 }
594 }
595
596 /**
597 * Get the local part of a system-defined name
598 *
599 * @param fingerprint the fingerprint of the name
600 * @return the local part of the name
601 */
602
603 public static String getLocalName(int fingerprint) {
604 return localNames[fingerprint];
605 }
606
607 /**
608 * Get the namespace URI part of a system-defined name
609 *
610 * @param fingerprint the fingerprint of the name
611 * @return the namespace URI part of the name
612 * @throws IllegalArgumentException if the fingerprint does not define a known name
613 */
614
615 /*@NotNull*/
616 public static String getURI(int fingerprint) {
617 int c = fingerprint >> 7;
618 switch (c) {
619 case DFLT_NS:
620 return "";
621 case XSL_NS:
622 return NamespaceConstant.XSLT;
623 case SAXON_NS:
624 return NamespaceConstant.SAXON;
625 case XML_NS:
626 return NamespaceConstant.XML;
627 case XS_NS:
628 return NamespaceConstant.SCHEMA;
629 case XSI_NS:
630 return NamespaceConstant.SCHEMA_INSTANCE;
631 case SCM_NS:
632 return NamespaceConstant.SCM;
633 default:
634 throw new IllegalArgumentException("Unknown system fingerprint " + fingerprint);
635 }
636 }
637
638 /**
639 * Get the Clark form of a system-defined name, given its name code or fingerprint
640 *
641 * @param fingerprint the fingerprint of the name
642 * @return the local name if the name is in the null namespace, or "{uri}local" otherwise.
643 */
644
645 public static String getClarkName(int fingerprint) {
646 String uri = getURI(fingerprint);
647 if (uri.isEmpty()) {
648 return getLocalName(fingerprint);
649 } else {
650 return '{' + uri + '}' + getLocalName(fingerprint);
651 }
652 }
653
654 /**
655 * Get the conventional prefix of a system-defined name
656 *
657 * @param fingerprint the fingerprint of the name
658 * @return the conventional prefix of the name
659 */
660
661 public static String getPrefix(int fingerprint) {
662 int c = fingerprint >> 7;
663 switch (c) {
664 case DFLT_NS:
665 return "";
666 case XSL_NS:
667 return "xsl";
668 case SAXON_NS:
669 return "saxon";
670 case XML_NS:
671 return "xml";
672 case XS_NS:
673 return "xs";
674 case XSI_NS:
675 return "xsi";
676 default:
677 return null;
678 }
679 }
680
681 /**
682 * Get the lexical display form of a system-defined name
683 *
684 * @param fingerprint the fingerprint of the name
685 * @return the lexical display form of the name, using a conventional prefix
686 */
687
688 public static String getDisplayName(int fingerprint) {
689 if (fingerprint == -1) {
690 return "(anonymous type)";
691 }
692 if (fingerprint > 1023) {
693 return "(" + fingerprint + ')';
694 }
695 if ((fingerprint >> 7) == DFLT) {
696 return getLocalName(fingerprint);
697 }
698 return getPrefix(fingerprint) + ':' + getLocalName(fingerprint);
699 }
700
701 /**
702 * Get a StructuredQName representing a system-defined name
703 *
704 * @param fingerprint the fingerprint of the name
705 * @return a StructuredQName representing the system-defined name
706 */
707
708 public static StructuredQName getStructuredQName(int fingerprint) {
709 return new StructuredQName(getPrefix(fingerprint), getURI(fingerprint), getLocalName(fingerprint));
710 }
711
712 /**
713 * Get a unprefixed StructuredQName representing a system-defined name
714 *
715 * @param fingerprint the fingerprint of the name
716 * @return a StructuredQName representing the system-defined name, with a URI and local name but no prefix
717 */
718
719 public static StructuredQName getUnprefixedQName(int fingerprint) {
720 return new StructuredQName("", getURI(fingerprint), getLocalName(fingerprint));
721 }
722
723 /**
724 * A commonly-used name held in static:
725 */
726
727 public final static StructuredQName SQ_XS_INVALID_NAME = getStructuredQName(XS_INVALID_NAME);
728
729 }
730