KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > sf > saxon > style > StandardNames


1 package net.sf.saxon.style;
2 import net.sf.saxon.om.NamespaceConstant;
3
4 import java.util.HashMap JavaDoc;
5
6 public abstract class StandardNames {
7
8     /**
9      * Well-known names used in XSLT processing. These names must all have
10      * fingerprints in the range 0-1023, to avoid clashing with codes allocated
11      * in a NamePool. We use the top three bits for the namespace, and the bottom
12      * seven bits for the local name
13     */

14
15     private static final int DFLT_NS = 0;
16     private static final int XSL_NS = 1;
17     private static final int SAXON_NS = 2;
18     private static final int XML_NS = 3;
19     private static final int XS_NS = 4;
20     private static final int XDT_NS = 5;
21     private static final int XSI_NS = 6;
22     //private static final int FN_NS = 7;
23

24     public static final int DFLT = 128*0;
25     public static final int XSL = 128*1;
26     public static final int SAXON = 128*2;
27     public static final int XML = 128*3;
28     public static final int XS = 128*4;
29     public static final int XDT = 128*5;
30     public static final int XSI = 128*6;
31
32     public static final int XSL_ANALYZE_STRING = XSL + 0;
33     public static final int XSL_APPLY_IMPORTS = XSL + 1;
34     public static final int XSL_APPLY_TEMPLATES = XSL + 2;
35     public static final int XSL_ATTRIBUTE = XSL + 3;
36     public static final int XSL_ATTRIBUTE_SET = XSL + 4;
37     public static final int XSL_CALL_TEMPLATE = XSL + 5;
38     public static final int XSL_CHARACTER_MAP = XSL + 6;
39     public static final int XSL_CHOOSE = XSL + 7;
40     public static final int XSL_COMMENT = XSL + 10;
41     public static final int XSL_COPY = XSL + 11;
42     public static final int XSL_COPY_OF = XSL + 12;
43     public static final int XSL_DECIMAL_FORMAT = XSL + 13;
44     public static final int XSL_DOCUMENT = XSL + 14;
45     public static final int XSL_ELEMENT = XSL + 15;
46     public static final int XSL_FALLBACK = XSL + 16;
47     public static final int XSL_FOR_EACH = XSL + 17;
48     public static final int XSL_FOR_EACH_GROUP = XSL + 20;
49     public static final int XSL_FUNCTION = XSL + 21;
50     public static final int XSL_IF = XSL + 22;
51     public static final int XSL_IMPORT = XSL + 23;
52     public static final int XSL_IMPORT_SCHEMA = XSL + 24;
53     public static final int XSL_INCLUDE = XSL + 25;
54     public static final int XSL_KEY = XSL + 26;
55     public static final int XSL_MATCHING_SUBSTRING = XSL + 27;
56     public static final int XSL_MESSAGE = XSL + 30;
57     public static final int XSL_NEXT_MATCH = XSL + 31;
58     public static final int XSL_NUMBER = XSL + 32;
59     public static final int XSL_NAMESPACE = XSL + 33;
60     public static final int XSL_NAMESPACE_ALIAS = XSL + 34;
61     public static final int XSL_NON_MATCHING_SUBSTRING = XSL + 35;
62     public static final int XSL_OTHERWISE = XSL + 36;
63     public static final int XSL_OUTPUT = XSL + 37;
64     public static final int XSL_OUTPUT_CHARACTER = XSL + 41;
65     public static final int XSL_PARAM = XSL + 42;
66     public static final int XSL_PERFORM_SORT = XSL + 43;
67     public static final int XSL_PRESERVE_SPACE = XSL + 44;
68     public static final int XSL_PROCESSING_INSTRUCTION = XSL + 45;
69     public static final int XSL_RESULT_DOCUMENT = XSL + 46;
70     public static final int XSL_SEQUENCE = XSL + 47;
71     public static final int XSL_SORT = XSL + 50;
72     public static final int XSL_STRIP_SPACE = XSL + 51;
73     public static final int XSL_STYLESHEET = XSL + 52;
74     public static final int XSL_TEMPLATE = XSL + 53;
75     public static final int XSL_TEXT = XSL + 54;
76     public static final int XSL_TRANSFORM = XSL + 55;
77     public static final int XSL_VALUE_OF = XSL + 56;
78     public static final int XSL_VARIABLE = XSL + 57;
79     public static final int XSL_WITH_PARAM = XSL + 60;
80     public static final int XSL_WHEN = XSL + 61;
81
82     public static final int XSL_DEFAULT_COLLATION = XSL + 100;
83     public static final int XSL_EXCLUDE_RESULT_PREFIXES = XSL + 101;
84     public static final int XSL_EXTENSION_ELEMENT_PREFIXES = XSL + 102;
85     public static final int XSL_INHERIT_NAMESPACES = XSL + 103;
86     public static final int XSL_TYPE = XSL + 104;
87     public static final int XSL_USE_ATTRIBUTE_SETS = XSL + 105;
88     public static final int XSL_USE_WHEN = XSL + 106;
89     public static final int XSL_VALIDATION = XSL + 107;
90     public static final int XSL_VERSION = XSL + 108;
91     public static final int XSL_XPATH_DEFAULT_NAMESPACE = XSL + 109;
92
93     private static final String JavaDoc XSL_B = '{' + NamespaceConstant.XSLT + '}';
94     public static final String JavaDoc XSL_DEFAULT_COLLATION_CLARK =
95             XSL_B + "default-collation";
96     public static final String JavaDoc XSL_INHERIT_NAMESPACES_CLARK =
97             XSL_B + "inherit-namespaces";
98     public static final String JavaDoc XSL_VERSION_CLARK =
99             XSL_B + "version";
100     public static final String JavaDoc XSL_XPATH_DEFAULT_NAMESPACE_CLARK =
101             XSL_B + "xpath-default-namespace";
102     public static final String JavaDoc XSL_EXTENSION_ELEMENT_PREFIXES_CLARK =
103             XSL_B + "extension-element-prefixes";
104     public static final String JavaDoc XSL_EXCLUDE_RESULT_PREFIXES_CLARK =
105             XSL_B + "exclude-result-prefixes";
106
107
108
109
110     public static final int SAXON_ASSIGN = SAXON + 1;
111     public static final int SAXON_CALL_TEMPLATE = SAXON + 2;
112     public static final int SAXON_COLLATION = SAXON + 3;
113     public static final int SAXON_DOCTYPE = SAXON + 4;
114     public static final int SAXON_ENTITY_REF = SAXON + 5;
115     public static final int SAXON_IMPORT_QUERY = SAXON + 6;
116     public static final int SAXON_SCRIPT = SAXON + 7;
117     public static final int SAXON_WHILE = SAXON + 8;
118
119     private static final String JavaDoc SAXON_B = '{' + NamespaceConstant.SAXON + '}';
120     public static final String JavaDoc SAXON_ASSIGNABLE = SAXON_B + "assignable";
121     public static final String JavaDoc SAXON_CHARACTER_REPRESENTATION = SAXON_B + "character-representation";
122     public static final String JavaDoc SAXON_EXPLAIN = SAXON_B + "explain";
123     public static final String JavaDoc SAXON_READ_ONCE = SAXON_B + "read-once";
124     public static final String JavaDoc SAXON_INDENT_SPACES = SAXON_B + "indent-spaces";
125     public static final String JavaDoc SAXON_NEXT_IN_CHAIN = SAXON_B + "next-in-chain";
126     public static final String JavaDoc SAXON_REQUIRE_WELL_FORMED = SAXON_B + "require-well-formed";
127     public static final String JavaDoc SAXON_MEMO_FUNCTION = SAXON_B + "memo-function";
128
129     // Not sure about this one...
130
public static final int SAXON_JAVA_LANG_OBJECT = SAXON + 29;
131
132     public static final int XML_BASE = XML + 1;
133     public static final int XML_SPACE = XML + 2;
134     public static final int XML_LANG = XML + 3;
135     public static final int XML_ID = XML + 4;
136
137
138
139     public static final String JavaDoc ARCHIVE = "archive";
140     public static final String JavaDoc AS = "as";
141     public static final String JavaDoc BYTE_ORDER_MARK = "byte-order-mark";
142     public static final String JavaDoc CASE_ORDER = "case-order";
143     public static final String JavaDoc CDATA_SECTION_ELEMENTS = "cdata-section-elements";
144     public static final String JavaDoc CHARACTER = "character";
145     public static final String JavaDoc CLASS = "class";
146     public static final String JavaDoc COLLATION = "collation";
147     public static final String JavaDoc COPY_NAMESPACES = "copy-namespaces";
148     public static final String JavaDoc COUNT = "count";
149     public static final String JavaDoc DATA_TYPE = "data-type";
150     public static final String JavaDoc DECIMAL_SEPARATOR = "decimal-separator";
151     public static final String JavaDoc DECOMPOSITION = "decomposition";
152     public static final String JavaDoc DEFAULT = "default";
153     public static final String JavaDoc DEFAULT_COLLATION = "default-collation";
154     public static final String JavaDoc DEFAULT_VALIDATION = "default-validation";
155     public static final String JavaDoc DIGIT = "digit";
156     public static final String JavaDoc DISABLE_OUTPUT_ESCAPING = "disable-output-escaping";
157     public static final String JavaDoc DOCTYPE_PUBLIC = "doctype-public";
158     public static final String JavaDoc DOCTYPE_SYSTEM = "doctype-system";
159     public static final String JavaDoc ELEMENTS = "elements";
160     public static final String JavaDoc ESCAPE_URI_ATTRIBUTES = "escape-uri-attributes";
161     public static final String JavaDoc ENCODING = "encoding";
162     public static final String JavaDoc EXCLUDE_RESULT_PREFIXES = "exclude-result-prefixes";
163     public static final String JavaDoc EXTENSION_ELEMENT_PREFIXES = "extension-element-prefixes";
164     public static final String JavaDoc FLAGS = "flags";
165     public static final String JavaDoc FORMAT = "format";
166     public static final String JavaDoc FROM = "from";
167     public static final String JavaDoc GROUP_ADJACENT = "group-adjacent";
168     public static final String JavaDoc GROUP_BY = "group-by";
169     public static final String JavaDoc GROUP_ENDING_WITH = "group-ending-with";
170     public static final String JavaDoc GROUP_STARTING_WITH = "group-starting-with";
171     public static final String JavaDoc GROUPING_SEPARATOR = "grouping-separator";
172     public static final String JavaDoc GROUPING_SIZE = "grouping-size";
173     public static final String JavaDoc HREF = "href";
174     public static final String JavaDoc ID = "id";
175     public static final String JavaDoc IMPLEMENTS_PREFIX = "implements-prefix";
176     public static final String JavaDoc INCLUDE_CONTENT_TYPE = "include-content-type";
177     public static final String JavaDoc INDENT = "indent";
178     public static final String JavaDoc INFINITY = "infinity";
179     public static final String JavaDoc INHERIT_NAMESPACES = "inherit-namespaces";
180     public static final String JavaDoc INPUT_TYPE_ANNOTATIONS = "input-type-annotations";
181     public static final String JavaDoc LANG = "lang";
182     public static final String JavaDoc LANGUAGE = "language";
183     public static final String JavaDoc LETTER_VALUE = "letter-value";
184     public static final String JavaDoc LEVEL = "level";
185     public static final String JavaDoc MATCH = "match";
186     public static final String JavaDoc MEDIA_TYPE = "media-type";
187     public static final String JavaDoc METHOD = "method";
188     public static final String JavaDoc MINUS_SIGN = "minus-sign";
189     public static final String JavaDoc MODE = "mode";
190     public static final String JavaDoc NAME = "name";
191     public static final String JavaDoc NAMESPACE = "namespace";
192     public static final String JavaDoc NAN = "NaN";
193     public static final String JavaDoc NORMALIZATION_FORM = "normalization-form";
194     public static final String JavaDoc OMIT_XML_DECLARATION = "omit-xml-declaration";
195     public static final String JavaDoc ORDER = "order";
196     public static final String JavaDoc ORDINAL = "ordinal";
197     public static final String JavaDoc OUTPUT_VERSION = "output-version";
198     public static final String JavaDoc OVERRIDE = "override";
199     public static final String JavaDoc PATTERN_SEPARATOR = "pattern-separator";
200     public static final String JavaDoc PERCENT = "percent";
201     public static final String JavaDoc PER_MILLE = "per-mille";
202     public static final String JavaDoc PRIORITY = "priority";
203     public static final String JavaDoc REGEX = "regex";
204     public static final String JavaDoc REQUIRED = "required";
205     public static final String JavaDoc RESULT_PREFIX = "result-prefix";
206     public static final String JavaDoc RULES = "rules";
207     public static final String JavaDoc SCHEMA_LOCATION = "schema-location";
208     public static final String JavaDoc SELECT = "select";
209     public static final String JavaDoc SEPARATOR = "separator";
210     public static final String JavaDoc SRC = "src";
211     public static final String JavaDoc STANDALONE = "standalone";
212     public static final String JavaDoc STRENGTH = "strength";
213     public static final String JavaDoc STRING = "string";
214     public static final String JavaDoc STYLESHEET_PREFIX = "stylesheet-prefix";
215     public static final String JavaDoc TERMINATE = "terminate";
216     public static final String JavaDoc TEST = "test";
217     public static final String JavaDoc TUNNEL = "tunnel";
218     public static final String JavaDoc TYPE = "type";
219     public static final String JavaDoc UNDECLARE_PREFIXES = "undeclare-prefixes";
220     public static final String JavaDoc USE = "use";
221     public static final String JavaDoc USE_ATTRIBUTE_SETS = "use-attribute-sets";
222     public static final String JavaDoc USE_CHARACTER_MAPS = "use-character-maps";
223     public static final String JavaDoc USE_WHEN = "use-when";
224     public static final String JavaDoc VALIDATION = "validation";
225     public static final String JavaDoc VALUE = "value";
226     public static final String JavaDoc VERSION = "version";
227     public static final String JavaDoc XPATH_DEFAULT_NAMESPACE = "xpath-default-namespace";
228     public static final String JavaDoc ZERO_DIGIT = "zero-digit";
229
230     public static final int XS_STRING = XS + 1;
231     public static final int XS_BOOLEAN = XS + 2;
232     public static final int XS_DECIMAL = XS + 3;
233     public static final int XS_FLOAT = XS + 4;
234     public static final int XS_DOUBLE = XS + 5;
235     public static final int XS_DURATION = XS + 6;
236     public static final int XS_DATE_TIME = XS + 7;
237     public static final int XS_TIME = XS + 8;
238     public static final int XS_DATE = XS + 9;
239     public static final int XS_G_YEAR_MONTH = XS + 10;
240     public static final int XS_G_YEAR = XS + 11;
241     public static final int XS_G_MONTH_DAY = XS + 12;
242     public static final int XS_G_DAY = XS + 13;
243     public static final int XS_G_MONTH = XS + 14;
244     public static final int XS_HEX_BINARY = XS + 15;
245     public static final int XS_BASE64_BINARY = XS + 16;
246     public static final int XS_ANY_URI = XS + 17;
247     public static final int XS_QNAME = XS + 18;
248     public static final int XS_NOTATION = XS + 19;
249     public static final int XS_INTEGER = XS + 20;
250
251     // Note that any type code <= XS_INTEGER is considered to represent a
252
// primitive type: see Type.isPrimitiveType()
253

254     public static final int XS_NON_POSITIVE_INTEGER = XS + 21;
255     public static final int XS_NEGATIVE_INTEGER = XS + 22;
256     public static final int XS_LONG = XS + 23;
257     public static final int XS_INT = XS + 24;
258     public static final int XS_SHORT = XS + 25;
259     public static final int XS_BYTE = XS + 26;
260     public static final int XS_NON_NEGATIVE_INTEGER = XS + 27;
261     public static final int XS_POSITIVE_INTEGER = XS + 28;
262     public static final int XS_UNSIGNED_LONG = XS + 29;
263     public static final int XS_UNSIGNED_INT = XS + 30;
264     public static final int XS_UNSIGNED_SHORT = XS + 31;
265     public static final int XS_UNSIGNED_BYTE = XS + 32;
266     public static final int XS_NORMALIZED_STRING = XS + 41;
267     public static final int XS_TOKEN = XS + 42;
268     public static final int XS_LANGUAGE = XS + 43;
269     public static final int XS_NMTOKEN = XS + 44;
270     public static final int XS_NMTOKENS = XS + 45; // NB: list type
271
public static final int XS_NAME = XS + 46;
272     public static final int XS_NCNAME = XS + 47;
273     public static final int XS_ID = XS + 48;
274     public static final int XS_IDREF = XS + 49;
275     public static final int XS_IDREFS = XS + 50; // NB: list type
276
public static final int XS_ENTITY = XS + 51;
277     public static final int XS_ENTITIES = XS + 52; // NB: list type
278

279     public static final int XS_ANY_TYPE = XS + 60;
280     public static final int XS_ANY_SIMPLE_TYPE = XS + 61;
281
282     public static final int XS_INVALID_NAME = XS + 62;
283
284     public static final int XS_ALL = XS + 70;
285     public static final int XS_ANNOTATION = XS + 71;
286     public static final int XS_ANY = XS + 72;
287     public static final int XS_ANY_ATTRIBUTE = XS + 73;
288     public static final int XS_APPINFO = XS + 74;
289     public static final int XS_ATTRIBUTE = XS + 75;
290     public static final int XS_ATTRIBUTE_GROUP = XS + 76;
291     public static final int XS_CHOICE = XS + 77;
292     public static final int XS_COMPLEX_CONTENT = XS + 80;
293     public static final int XS_COMPLEX_TYPE = XS + 81;
294     public static final int XS_DOCUMENTATION = XS + 82;
295     public static final int XS_ELEMENT = XS + 83;
296     public static final int XS_ENUMERATION = XS + 84;
297     public static final int XS_EXTENSION = XS + 85;
298     public static final int XS_FIELD = XS + 86;
299     public static final int XS_FRACTION_DIGITS = XS + 87;
300     public static final int XS_GROUP = XS + 88;
301     public static final int XS_IMPORT = XS + 90;
302     public static final int XS_INCLUDE = XS + 91;
303     public static final int XS_KEY = XS + 92;
304     public static final int XS_KEYREF = XS + 93;
305     public static final int XS_LENGTH = XS + 94;
306     public static final int XS_LIST = XS + 95;
307     public static final int XS_MAX_EXCLUSIVE = XS + 96;
308     public static final int XS_MAX_INCLUSIVE = XS + 97;
309     public static final int XS_MAX_LENGTH = XS + 100;
310     public static final int XS_MIN_EXCLUSIVE = XS + 101;
311     public static final int XS_MIN_INCLUSIVE = XS + 102;
312     public static final int XS_MIN_LENGTH = XS + 103;
313     public static final int XS_notation = XS + 104;
314     public static final int XS_PATTERN = XS + 105;
315     public static final int XS_REDEFINE = XS + 106;
316     public static final int XS_RESTRICTION = XS + 107;
317     public static final int XS_SCHEMA = XS + 108;
318     public static final int XS_SELECTOR = XS + 110;
319     public static final int XS_SEQUENCE = XS + 111;
320     public static final int XS_SIMPLE_CONTENT = XS + 112;
321     public static final int XS_SIMPLE_TYPE = XS + 113;
322     public static final int XS_TOTAL_DIGITS = XS + 114;
323     public static final int XS_UNION = XS + 115;
324     public static final int XS_UNIQUE = XS + 116;
325     public static final int XS_WHITE_SPACE = XS + 117;
326
327     public static final int XDT_UNTYPED = XDT + 1;
328     public static final int XDT_UNTYPED_ATOMIC = XDT + 2;
329     public static final int XDT_ANY_ATOMIC_TYPE = XDT + 3;
330     public static final int XDT_YEAR_MONTH_DURATION = XDT + 4;
331     public static final int XDT_DAY_TIME_DURATION = XDT + 5;
332     public static final int XDT_NUMERIC = XDT + 6;
333
334     public static final int XSI_TYPE = XSI + 1;
335     public static final int XSI_NIL = XSI + 2;
336     public static final int XSI_SCHEMA_LOCATION = XSI + 3;
337     public static final int XSI_NO_NAMESPACE_SCHEMA_LOCATION = XSI + 4;
338
339
340     private static String JavaDoc[] localNames = new String JavaDoc[1023];
341     private static HashMap JavaDoc lookup = new HashMap JavaDoc(1023);
342
343     private StandardNames() {
344         //pool = namePool;
345
}
346
347     private static void bindXSLTName(int constant, String JavaDoc localName) {
348         localNames[constant] = localName;
349         lookup.put('{' + NamespaceConstant.XSLT + '}' + localName, new Integer JavaDoc(constant));
350     }
351
352     private static void bindSaxonName(int constant, String JavaDoc localName) {
353         localNames[constant] = localName;
354         lookup.put('{' + NamespaceConstant.SAXON + '}' + localName, new Integer JavaDoc(constant));
355     }
356
357     private static void bindXMLName(int constant, String JavaDoc localName) {
358         localNames[constant] = localName;
359         lookup.put('{' + NamespaceConstant.XML + '}' + localName, new Integer JavaDoc(constant));
360     }
361
362     private static void bindXSName(int constant, String JavaDoc localName) {
363         localNames[constant] = localName;
364         lookup.put('{' + NamespaceConstant.SCHEMA + '}' + localName, new Integer JavaDoc(constant));
365     }
366
367     private static void bindXDTName(int constant, String JavaDoc localName) {
368         localNames[constant] = localName;
369         lookup.put('{' + NamespaceConstant.XDT + '}' + localName, new Integer JavaDoc(constant));
370     }
371
372     private static void bindXSIName(int constant, String JavaDoc localName) {
373         localNames[constant] = localName;
374         lookup.put('{' + NamespaceConstant.SCHEMA_INSTANCE + '}' + localName, new Integer JavaDoc(constant));
375     }
376
377     static {
378
379         bindXSLTName(XSL_ANALYZE_STRING, "analyze-string");
380         bindXSLTName(XSL_APPLY_IMPORTS, "apply-imports");
381         bindXSLTName(XSL_APPLY_TEMPLATES, "apply-templates");
382         bindXSLTName(XSL_ATTRIBUTE, "attribute");
383         bindXSLTName(XSL_ATTRIBUTE_SET, "attribute-set" );
384         bindXSLTName(XSL_CALL_TEMPLATE, "call-template");
385         bindXSLTName(XSL_CHARACTER_MAP, "character-map");
386         bindXSLTName(XSL_CHOOSE, "choose");
387         bindXSLTName(XSL_COMMENT , "comment");
388         bindXSLTName(XSL_COPY, "copy");
389         bindXSLTName(XSL_COPY_OF, "copy-of");
390         bindXSLTName(XSL_DECIMAL_FORMAT, "decimal-format");
391         bindXSLTName(XSL_DOCUMENT, "document");
392         bindXSLTName(XSL_ELEMENT, "element");
393         bindXSLTName(XSL_FALLBACK, "fallback");
394         bindXSLTName(XSL_FOR_EACH, "for-each");
395         bindXSLTName(XSL_FOR_EACH_GROUP, "for-each-group");
396         bindXSLTName(XSL_FUNCTION, "function");
397         bindXSLTName(XSL_IF, "if");
398         bindXSLTName(XSL_IMPORT, "import");
399         bindXSLTName(XSL_IMPORT_SCHEMA, "import-schema");
400         bindXSLTName(XSL_INCLUDE, "include");
401         bindXSLTName(XSL_KEY, "key");
402         bindXSLTName(XSL_MATCHING_SUBSTRING, "matching-substring");
403         bindXSLTName(XSL_MESSAGE, "message");
404         bindXSLTName(XSL_NEXT_MATCH, "next-match");
405         bindXSLTName(XSL_NUMBER, "number");
406         bindXSLTName(XSL_NAMESPACE, "namespace");
407         bindXSLTName(XSL_NAMESPACE_ALIAS, "namespace-alias");
408         bindXSLTName(XSL_NON_MATCHING_SUBSTRING, "non-matching-substring");
409         bindXSLTName(XSL_OTHERWISE, "otherwise");
410         bindXSLTName(XSL_OUTPUT, "output");
411         bindXSLTName(XSL_OUTPUT_CHARACTER, "output-character");
412         bindXSLTName(XSL_PARAM, "param");
413         bindXSLTName(XSL_PERFORM_SORT, "perform-sort");
414         bindXSLTName(XSL_PRESERVE_SPACE, "preserve-space");
415         bindXSLTName(XSL_PROCESSING_INSTRUCTION, "processing-instruction");
416         bindXSLTName(XSL_RESULT_DOCUMENT, "result-document");
417         bindXSLTName(XSL_SEQUENCE, "sequence");
418         bindXSLTName(XSL_SORT, "sort");
419         bindXSLTName(XSL_STRIP_SPACE, "strip-space");
420         bindXSLTName(XSL_STYLESHEET, "stylesheet");
421         bindXSLTName(XSL_TEMPLATE, "template");
422         bindXSLTName(XSL_TEXT, "text");
423         bindXSLTName(XSL_TRANSFORM, "transform");
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
429         bindXSLTName(XSL_DEFAULT_COLLATION, "default-collation");
430         bindXSLTName(XSL_XPATH_DEFAULT_NAMESPACE, "xpath-default-namespace");
431         bindXSLTName(XSL_EXCLUDE_RESULT_PREFIXES, "exclude-result-prefixes");
432         bindXSLTName(XSL_EXTENSION_ELEMENT_PREFIXES, "extension-element-prefixes");
433         bindXSLTName(XSL_INHERIT_NAMESPACES, "inherit-namespaces");
434         bindXSLTName(XSL_TYPE, "type");
435         bindXSLTName(XSL_USE_ATTRIBUTE_SETS, "use-attribute-sets");
436         bindXSLTName(XSL_USE_WHEN, "use-when");
437         bindXSLTName(XSL_VALIDATION, "validation");
438         bindXSLTName(XSL_VERSION, "version");
439
440         bindSaxonName(SAXON_ASSIGN, "assign");
441         bindSaxonName(SAXON_CALL_TEMPLATE, "call-template");
442         bindSaxonName(SAXON_COLLATION, "collation");
443         bindSaxonName(SAXON_DOCTYPE, "doctype");
444         bindSaxonName(SAXON_ENTITY_REF, "entity-ref");
445         bindSaxonName(SAXON_IMPORT_QUERY, "import-query");
446         bindSaxonName(SAXON_SCRIPT, "script");
447         bindSaxonName(SAXON_WHILE, "while");
448
449         bindXMLName(XML_BASE, "base");
450         bindXMLName(XML_SPACE, "space");
451         bindXMLName(XML_LANG, "lang");
452         bindXMLName(XML_ID, "id");
453
454         bindXSName(XS_STRING, "string");
455         bindXSName(XS_BOOLEAN, "boolean");
456         bindXSName(XS_DECIMAL, "decimal");
457         bindXSName(XS_FLOAT, "float");
458         bindXSName(XS_DOUBLE, "double");
459         bindXSName(XS_DURATION, "duration");
460         bindXSName(XS_DATE_TIME, "dateTime");
461         bindXSName(XS_TIME, "time");
462         bindXSName(XS_DATE, "date");
463         bindXSName(XS_G_YEAR_MONTH , "gYearMonth");
464         bindXSName(XS_G_YEAR, "gYear");
465         bindXSName(XS_G_MONTH_DAY, "gMonthDay");
466         bindXSName(XS_G_DAY, "gDay");
467         bindXSName(XS_G_MONTH, "gMonth");
468         bindXSName(XS_HEX_BINARY, "hexBinary");
469         bindXSName(XS_BASE64_BINARY, "base64Binary");
470         bindXSName(XS_ANY_URI, "anyURI");
471         bindXSName(XS_QNAME, "QName");
472         bindXSName(XS_NOTATION, "NOTATION");
473         bindXSName(XS_INTEGER, "integer");
474         bindXSName(XS_NON_POSITIVE_INTEGER, "nonPositiveInteger");
475         bindXSName(XS_NEGATIVE_INTEGER, "negativeInteger");
476         bindXSName(XS_LONG, "long");
477         bindXSName(XS_INT, "int");
478         bindXSName(XS_SHORT, "short");
479         bindXSName(XS_BYTE, "byte");
480         bindXSName(XS_NON_NEGATIVE_INTEGER, "nonNegativeInteger");
481         bindXSName(XS_POSITIVE_INTEGER, "positiveInteger");
482         bindXSName(XS_UNSIGNED_LONG, "unsignedLong");
483         bindXSName(XS_UNSIGNED_INT, "unsignedInt");
484         bindXSName(XS_UNSIGNED_SHORT, "unsignedShort");
485         bindXSName(XS_UNSIGNED_BYTE, "unsignedByte");
486         bindXSName(XS_NORMALIZED_STRING, "normalizedString");
487         bindXSName(XS_TOKEN, "token");
488         bindXSName(XS_LANGUAGE, "language");
489         bindXSName(XS_NMTOKEN, "NMTOKEN");
490         bindXSName(XS_NMTOKENS, "NMTOKENS"); // NB: list type
491
bindXSName(XS_NAME, "Name");
492         bindXSName(XS_NCNAME, "NCName");
493         bindXSName(XS_ID, "ID");
494         bindXSName(XS_IDREF, "IDREF");
495         bindXSName(XS_IDREFS, "IDREFS"); // NB: list type
496
bindXSName(XS_ENTITY, "ENTITY");
497         bindXSName(XS_ENTITIES, "ENTITIES"); // NB: list type
498

499         bindXSName(XS_ANY_TYPE, "anyType");
500         bindXSName(XS_ANY_SIMPLE_TYPE, "anySimpleType");
501         bindXSName(XS_INVALID_NAME, "invalidName");
502
503         bindXSName(XS_ALL, "all");
504         bindXSName(XS_ANNOTATION, "annotation");
505         bindXSName(XS_ANY, "any");
506         bindXSName(XS_ANY_ATTRIBUTE, "anyAttribute");
507         bindXSName(XS_APPINFO, "appinfo");
508         bindXSName(XS_ATTRIBUTE, "attribute");
509         bindXSName(XS_ATTRIBUTE_GROUP, "attributeGroup");
510         bindXSName(XS_CHOICE, "choice");
511         bindXSName(XS_COMPLEX_CONTENT, "complexContent");
512         bindXSName(XS_COMPLEX_TYPE, "complexType");
513         bindXSName(XS_DOCUMENTATION, "documentation");
514         bindXSName(XS_ELEMENT, "element");
515         bindXSName(XS_ENUMERATION, "enumeration");
516         bindXSName(XS_EXTENSION, "extension");
517         bindXSName(XS_FIELD, "field");
518         bindXSName(XS_FRACTION_DIGITS, "fractionDigits");
519         bindXSName(XS_GROUP, "group");
520         bindXSName(XS_IMPORT, "import");
521         bindXSName(XS_INCLUDE, "include");
522         bindXSName(XS_KEY, "key");
523         bindXSName(XS_KEYREF, "keyref");
524         bindXSName(XS_LENGTH, "length");
525         bindXSName(XS_LIST, "list");
526         bindXSName(XS_MAX_EXCLUSIVE, "maxExclusive");
527         bindXSName(XS_MAX_INCLUSIVE, "maxInclusive");
528         bindXSName(XS_MAX_LENGTH, "maxLength");
529         bindXSName(XS_MIN_EXCLUSIVE, "minExclusive");
530         bindXSName(XS_MIN_INCLUSIVE, "minInclusive");
531         bindXSName(XS_MIN_LENGTH, "minLength");
532         bindXSName(XS_notation, "notation");
533         bindXSName(XS_PATTERN, "pattern");
534         bindXSName(XS_REDEFINE, "redefine");
535         bindXSName(XS_RESTRICTION, "restriction");
536         bindXSName(XS_SCHEMA, "schema");
537         bindXSName(XS_SELECTOR, "selector");
538         bindXSName(XS_SEQUENCE, "sequence");
539         bindXSName(XS_SIMPLE_CONTENT, "simpleContent");
540         bindXSName(XS_SIMPLE_TYPE, "simpleType");
541         bindXSName(XS_TOTAL_DIGITS, "totalDigits");
542         bindXSName(XS_UNION, "union");
543         bindXSName(XS_UNIQUE, "unique");
544         bindXSName(XS_WHITE_SPACE, "whiteSpace");
545
546         bindXDTName(XDT_UNTYPED, "untyped");
547         bindXDTName(XDT_UNTYPED_ATOMIC, "untypedAtomic");
548         bindXDTName(XDT_ANY_ATOMIC_TYPE, "anyAtomicType");
549         bindXDTName(XDT_YEAR_MONTH_DURATION, "yearMonthDuration");
550         bindXDTName(XDT_DAY_TIME_DURATION, "dayTimeDuration");
551         bindXDTName(XDT_NUMERIC, "numeric");
552
553         bindXSIName(XSI_TYPE, "type");
554         bindXSIName(XSI_NIL, "nil");
555         bindXSIName(XSI_SCHEMA_LOCATION, "schemaLocation");
556         bindXSIName(XSI_NO_NAMESPACE_SCHEMA_LOCATION, "noNamespaceSchemaLocation");
557     }
558
559     public static int getFingerprint(String JavaDoc uri, String JavaDoc localName) {
560         Integer JavaDoc fp = (Integer JavaDoc)lookup.get('{' + uri + '}' + localName);
561         if (fp==null) {
562             return -1;
563         } else {
564             return fp.intValue();
565         }
566     }
567
568     public static String JavaDoc getLocalName(int fingerprint) {
569         return localNames[fingerprint];
570     }
571
572     public static String JavaDoc getURI(int fingerprint) {
573         int c = fingerprint >> 7;
574         switch (c) {
575             case DFLT_NS: return "";
576             case XSL_NS: return NamespaceConstant.XSLT;
577             case SAXON_NS: return NamespaceConstant.SAXON;
578             case XML_NS: return NamespaceConstant.XML;
579             case XS_NS: return NamespaceConstant.SCHEMA;
580             case XSI_NS: return NamespaceConstant.SCHEMA_INSTANCE;
581             case XDT_NS: return NamespaceConstant.XDT;
582             default: return null;
583         }
584     }
585
586     public static short getURICode(int fingerprint) {
587         int c = fingerprint >> 7;
588         switch (c) {
589             case DFLT_NS: return 0;
590             case XSL_NS: return NamespaceConstant.XSLT_CODE;
591             case SAXON_NS: return NamespaceConstant.SAXON_CODE;
592             case XML_NS: return NamespaceConstant.XML_CODE;
593             case XS_NS: return NamespaceConstant.SCHEMA_CODE;
594             case XSI_NS: return NamespaceConstant.XSI_CODE;
595             case XDT_NS: return NamespaceConstant.XDT_CODE;
596             default: return -1;
597         }
598     }
599
600     /**
601      * Get the Clark form of a name, given its name code or fingerprint
602      * @return the local name if the name is in the null namespace, or "{uri}local"
603      * otherwise. The name is always interned.
604      */

605
606     public static String JavaDoc getClarkName(int fingerprint) {
607         String JavaDoc uri = getURI(fingerprint);
608         if (uri.equals("")) {
609             return getLocalName(fingerprint);
610         } else {
611             return '{' + uri + '}' + getLocalName(fingerprint);
612         }
613     }
614
615     public static String JavaDoc getPrefix(int fingerprint) {
616         int c = fingerprint >> 7;
617         switch (c) {
618             case DFLT_NS: return "";
619             case XSL_NS: return "xsl";
620             case SAXON_NS: return "saxon";
621             case XML_NS: return "xml";
622             case XS_NS: return "xs";
623             case XSI_NS: return "xsi";
624             case XDT_NS: return "xdt";
625             default: return null;
626         }
627     }
628
629     public static String JavaDoc getDisplayName(int fingerprint) {
630         if (fingerprint==-1) {
631             return "(anonymous type)";
632         }
633         if (fingerprint > 1023) {
634             return "(" + fingerprint + ')';
635         }
636         if ((fingerprint>>7) == DFLT) {
637             return getLocalName(fingerprint);
638         }
639         return getPrefix(fingerprint) + ':' + getLocalName(fingerprint);
640     }
641
642 }
643
644
645 //
646
// The contents of this file are subject to the Mozilla Public License Version 1.0 (the "License");
647
// you may not use this file except in compliance with the License. You may obtain a copy of the
648
// License at http://www.mozilla.org/MPL/
649
//
650
// Software distributed under the License is distributed on an "AS IS" basis,
651
// WITHOUT WARRANTY OF ANY KIND, either express or implied.
652
// See the License for the specific language governing rights and limitations under the License.
653
//
654
// The Original Code is: all this file.
655
//
656
// The Initial Developer of the Original Code is Michael H. Kay
657
//
658
// Portions created by (your name) are Copyright (C) (your legal entity). All Rights Reserved.
659
//
660
// Contributor(s): none
661
//
Popular Tags