001: package net.sf.saxon.style;
002:
003: import net.sf.saxon.om.NamespaceConstant;
004:
005: import java.util.HashMap;
006:
007: public abstract class StandardNames {
008:
009: /**
010: * Well-known names used in XSLT processing. These names must all have
011: * fingerprints in the range 0-1023, to avoid clashing with codes allocated
012: * in a NamePool. We use the top three bits for the namespace, and the bottom
013: * seven bits for the local name
014: */
015:
016: private static final int DFLT_NS = 0;
017: private static final int XSL_NS = 1;
018: private static final int SAXON_NS = 2;
019: private static final int XML_NS = 3;
020: private static final int XS_NS = 4;
021: private static final int XDT_NS = 5;
022: private static final int XSI_NS = 6;
023: //private static final int FN_NS = 7;
024:
025: public static final int DFLT = 128 * 0;
026: public static final int XSL = 128 * 1;
027: public static final int SAXON = 128 * 2;
028: public static final int XML = 128 * 3;
029: public static final int XS = 128 * 4;
030: public static final int XDT = 128 * 5;
031: public static final int XSI = 128 * 6;
032:
033: public static final int XSL_ANALYZE_STRING = XSL + 0;
034: public static final int XSL_APPLY_IMPORTS = XSL + 1;
035: public static final int XSL_APPLY_TEMPLATES = XSL + 2;
036: public static final int XSL_ATTRIBUTE = XSL + 3;
037: public static final int XSL_ATTRIBUTE_SET = XSL + 4;
038: public static final int XSL_CALL_TEMPLATE = XSL + 5;
039: public static final int XSL_CHARACTER_MAP = XSL + 6;
040: public static final int XSL_CHOOSE = XSL + 7;
041: public static final int XSL_COMMENT = XSL + 10;
042: public static final int XSL_COPY = XSL + 11;
043: public static final int XSL_COPY_OF = XSL + 12;
044: public static final int XSL_DECIMAL_FORMAT = XSL + 13;
045: public static final int XSL_DOCUMENT = XSL + 14;
046: public static final int XSL_ELEMENT = XSL + 15;
047: public static final int XSL_FALLBACK = XSL + 16;
048: public static final int XSL_FOR_EACH = XSL + 17;
049: public static final int XSL_FOR_EACH_GROUP = XSL + 20;
050: public static final int XSL_FUNCTION = XSL + 21;
051: public static final int XSL_IF = XSL + 22;
052: public static final int XSL_IMPORT = XSL + 23;
053: public static final int XSL_IMPORT_SCHEMA = XSL + 24;
054: public static final int XSL_INCLUDE = XSL + 25;
055: public static final int XSL_KEY = XSL + 26;
056: public static final int XSL_MATCHING_SUBSTRING = XSL + 27;
057: public static final int XSL_MESSAGE = XSL + 30;
058: public static final int XSL_NEXT_MATCH = XSL + 31;
059: public static final int XSL_NUMBER = XSL + 32;
060: public static final int XSL_NAMESPACE = XSL + 33;
061: public static final int XSL_NAMESPACE_ALIAS = XSL + 34;
062: public static final int XSL_NON_MATCHING_SUBSTRING = XSL + 35;
063: public static final int XSL_OTHERWISE = XSL + 36;
064: public static final int XSL_OUTPUT = XSL + 37;
065: public static final int XSL_OUTPUT_CHARACTER = XSL + 41;
066: public static final int XSL_PARAM = XSL + 42;
067: public static final int XSL_PERFORM_SORT = XSL + 43;
068: public static final int XSL_PRESERVE_SPACE = XSL + 44;
069: public static final int XSL_PROCESSING_INSTRUCTION = XSL + 45;
070: public static final int XSL_RESULT_DOCUMENT = XSL + 46;
071: public static final int XSL_SEQUENCE = XSL + 47;
072: public static final int XSL_SORT = XSL + 50;
073: public static final int XSL_STRIP_SPACE = XSL + 51;
074: public static final int XSL_STYLESHEET = XSL + 52;
075: public static final int XSL_TEMPLATE = XSL + 53;
076: public static final int XSL_TEXT = XSL + 54;
077: public static final int XSL_TRANSFORM = XSL + 55;
078: public static final int XSL_VALUE_OF = XSL + 56;
079: public static final int XSL_VARIABLE = XSL + 57;
080: public static final int XSL_WITH_PARAM = XSL + 60;
081: public static final int XSL_WHEN = XSL + 61;
082:
083: public static final int XSL_DEFAULT_COLLATION = XSL + 100;
084: public static final int XSL_EXCLUDE_RESULT_PREFIXES = XSL + 101;
085: public static final int XSL_EXTENSION_ELEMENT_PREFIXES = XSL + 102;
086: public static final int XSL_INHERIT_NAMESPACES = XSL + 103;
087: public static final int XSL_TYPE = XSL + 104;
088: public static final int XSL_USE_ATTRIBUTE_SETS = XSL + 105;
089: public static final int XSL_USE_WHEN = XSL + 106;
090: public static final int XSL_VALIDATION = XSL + 107;
091: public static final int XSL_VERSION = XSL + 108;
092: public static final int XSL_XPATH_DEFAULT_NAMESPACE = XSL + 109;
093:
094: private static final String XSL_B = '{' + NamespaceConstant.XSLT + '}';
095: public static final String XSL_DEFAULT_COLLATION_CLARK = XSL_B
096: + "default-collation";
097: public static final String XSL_INHERIT_NAMESPACES_CLARK = XSL_B
098: + "inherit-namespaces";
099: public static final String XSL_VERSION_CLARK = XSL_B + "version";
100: public static final String XSL_XPATH_DEFAULT_NAMESPACE_CLARK = XSL_B
101: + "xpath-default-namespace";
102: public static final String XSL_EXTENSION_ELEMENT_PREFIXES_CLARK = XSL_B
103: + "extension-element-prefixes";
104: public static final String XSL_EXCLUDE_RESULT_PREFIXES_CLARK = XSL_B
105: + "exclude-result-prefixes";
106:
107: public static final int SAXON_ASSIGN = SAXON + 1;
108: public static final int SAXON_CALL_TEMPLATE = SAXON + 2;
109: public static final int SAXON_COLLATION = SAXON + 3;
110: public static final int SAXON_DOCTYPE = SAXON + 4;
111: public static final int SAXON_ENTITY_REF = SAXON + 5;
112: public static final int SAXON_IMPORT_QUERY = SAXON + 6;
113: public static final int SAXON_SCRIPT = SAXON + 7;
114: public static final int SAXON_VALIDATE_TYPE = SAXON + 8;
115: public static final int SAXON_WHILE = SAXON + 9;
116:
117: private static final String SAXON_B = '{' + NamespaceConstant.SAXON + '}';
118: public static final String SAXON_ASSIGNABLE = SAXON_B
119: + "assignable";
120: public static final String SAXON_CHARACTER_REPRESENTATION = SAXON_B
121: + "character-representation";
122: public static final String SAXON_EXPLAIN = SAXON_B + "explain";
123: public static final String SAXON_READ_ONCE = SAXON_B + "read-once";
124: public static final String SAXON_INDENT_SPACES = SAXON_B
125: + "indent-spaces";
126: public static final String SAXON_NEXT_IN_CHAIN = SAXON_B
127: + "next-in-chain";
128: public static final String SAXON_REQUIRE_WELL_FORMED = SAXON_B
129: + "require-well-formed";
130: public static final String SAXON_MEMO_FUNCTION = SAXON_B
131: + "memo-function";
132:
133: // Not sure about this one...
134: public static final int SAXON_JAVA_LANG_OBJECT = SAXON + 29;
135:
136: public static final int XML_BASE = XML + 1;
137: public static final int XML_SPACE = XML + 2;
138: public static final int XML_LANG = XML + 3;
139: public static final int XML_ID = XML + 4;
140:
141: public static final String ARCHIVE = "archive";
142: public static final String AS = "as";
143: public static final String BYTE_ORDER_MARK = "byte-order-mark";
144: public static final String CASE_ORDER = "case-order";
145: public static final String CDATA_SECTION_ELEMENTS = "cdata-section-elements";
146: public static final String CHARACTER = "character";
147: public static final String CLASS = "class";
148: public static final String COLLATION = "collation";
149: public static final String COPY_NAMESPACES = "copy-namespaces";
150: public static final String COUNT = "count";
151: public static final String DATA_TYPE = "data-type";
152: public static final String DECIMAL_SEPARATOR = "decimal-separator";
153: public static final String DECOMPOSITION = "decomposition";
154: public static final String DEFAULT = "default";
155: public static final String DEFAULT_COLLATION = "default-collation";
156: public static final String DEFAULT_VALIDATION = "default-validation";
157: public static final String DIGIT = "digit";
158: public static final String DISABLE_OUTPUT_ESCAPING = "disable-output-escaping";
159: public static final String DOCTYPE_PUBLIC = "doctype-public";
160: public static final String DOCTYPE_SYSTEM = "doctype-system";
161: public static final String ELEMENTS = "elements";
162: public static final String ESCAPE_URI_ATTRIBUTES = "escape-uri-attributes";
163: public static final String ENCODING = "encoding";
164: public static final String EXCLUDE_RESULT_PREFIXES = "exclude-result-prefixes";
165: public static final String EXTENSION_ELEMENT_PREFIXES = "extension-element-prefixes";
166: public static final String FLAGS = "flags";
167: public static final String FORMAT = "format";
168: public static final String FROM = "from";
169: public static final String GROUP_ADJACENT = "group-adjacent";
170: public static final String GROUP_BY = "group-by";
171: public static final String GROUP_ENDING_WITH = "group-ending-with";
172: public static final String GROUP_STARTING_WITH = "group-starting-with";
173: public static final String GROUPING_SEPARATOR = "grouping-separator";
174: public static final String GROUPING_SIZE = "grouping-size";
175: public static final String HREF = "href";
176: public static final String ID = "id";
177: public static final String IMPLEMENTS_PREFIX = "implements-prefix";
178: public static final String INCLUDE_CONTENT_TYPE = "include-content-type";
179: public static final String INDENT = "indent";
180: public static final String INFINITY = "infinity";
181: public static final String INHERIT_NAMESPACES = "inherit-namespaces";
182: public static final String INPUT_TYPE_ANNOTATIONS = "input-type-annotations";
183: public static final String LANG = "lang";
184: public static final String LANGUAGE = "language";
185: public static final String LETTER_VALUE = "letter-value";
186: public static final String LEVEL = "level";
187: public static final String MATCH = "match";
188: public static final String MEDIA_TYPE = "media-type";
189: public static final String METHOD = "method";
190: public static final String MINUS_SIGN = "minus-sign";
191: public static final String MODE = "mode";
192: public static final String NAME = "name";
193: public static final String NAMESPACE = "namespace";
194: public static final String NAN = "NaN";
195: public static final String NORMALIZATION_FORM = "normalization-form";
196: public static final String OMIT_XML_DECLARATION = "omit-xml-declaration";
197: public static final String ORDER = "order";
198: public static final String ORDINAL = "ordinal";
199: public static final String OUTPUT_VERSION = "output-version";
200: public static final String OVERRIDE = "override";
201: public static final String PATTERN_SEPARATOR = "pattern-separator";
202: public static final String PERCENT = "percent";
203: public static final String PER_MILLE = "per-mille";
204: public static final String PRIORITY = "priority";
205: public static final String REGEX = "regex";
206: public static final String REQUIRED = "required";
207: public static final String RESULT_PREFIX = "result-prefix";
208: public static final String RULES = "rules";
209: public static final String SCHEMA_LOCATION = "schema-location";
210: public static final String SELECT = "select";
211: public static final String SEPARATOR = "separator";
212: public static final String SRC = "src";
213: public static final String STANDALONE = "standalone";
214: public static final String STRENGTH = "strength";
215: public static final String STRING = "string";
216: public static final String STYLESHEET_PREFIX = "stylesheet-prefix";
217: public static final String TERMINATE = "terminate";
218: public static final String TEST = "test";
219: public static final String TUNNEL = "tunnel";
220: public static final String TYPE = "type";
221: public static final String UNDECLARE_PREFIXES = "undeclare-prefixes";
222: public static final String USE = "use";
223: public static final String USE_ATTRIBUTE_SETS = "use-attribute-sets";
224: public static final String USE_CHARACTER_MAPS = "use-character-maps";
225: public static final String USE_WHEN = "use-when";
226: public static final String VALIDATION = "validation";
227: public static final String VALUE = "value";
228: public static final String VERSION = "version";
229: public static final String XPATH_DEFAULT_NAMESPACE = "xpath-default-namespace";
230: public static final String ZERO_DIGIT = "zero-digit";
231:
232: public static final int XS_STRING = XS + 1;
233: public static final int XS_BOOLEAN = XS + 2;
234: public static final int XS_DECIMAL = XS + 3;
235: public static final int XS_FLOAT = XS + 4;
236: public static final int XS_DOUBLE = XS + 5;
237: public static final int XS_DURATION = XS + 6;
238: public static final int XS_DATE_TIME = XS + 7;
239: public static final int XS_TIME = XS + 8;
240: public static final int XS_DATE = XS + 9;
241: public static final int XS_G_YEAR_MONTH = XS + 10;
242: public static final int XS_G_YEAR = XS + 11;
243: public static final int XS_G_MONTH_DAY = XS + 12;
244: public static final int XS_G_DAY = XS + 13;
245: public static final int XS_G_MONTH = XS + 14;
246: public static final int XS_HEX_BINARY = XS + 15;
247: public static final int XS_BASE64_BINARY = XS + 16;
248: public static final int XS_ANY_URI = XS + 17;
249: public static final int XS_QNAME = XS + 18;
250: public static final int XS_NOTATION = XS + 19;
251: public static final int XS_INTEGER = XS + 20;
252:
253: // Note that any type code <= XS_INTEGER is considered to represent a
254: // primitive type: see Type.isPrimitiveType()
255:
256: public static final int XS_NON_POSITIVE_INTEGER = XS + 21;
257: public static final int XS_NEGATIVE_INTEGER = XS + 22;
258: public static final int XS_LONG = XS + 23;
259: public static final int XS_INT = XS + 24;
260: public static final int XS_SHORT = XS + 25;
261: public static final int XS_BYTE = XS + 26;
262: public static final int XS_NON_NEGATIVE_INTEGER = XS + 27;
263: public static final int XS_POSITIVE_INTEGER = XS + 28;
264: public static final int XS_UNSIGNED_LONG = XS + 29;
265: public static final int XS_UNSIGNED_INT = XS + 30;
266: public static final int XS_UNSIGNED_SHORT = XS + 31;
267: public static final int XS_UNSIGNED_BYTE = XS + 32;
268: public static final int XS_NORMALIZED_STRING = XS + 41;
269: public static final int XS_TOKEN = XS + 42;
270: public static final int XS_LANGUAGE = XS + 43;
271: public static final int XS_NMTOKEN = XS + 44;
272: public static final int XS_NMTOKENS = XS + 45; // NB: list type
273: public static final int XS_NAME = XS + 46;
274: public static final int XS_NCNAME = XS + 47;
275: public static final int XS_ID = XS + 48;
276: public static final int XS_IDREF = XS + 49;
277: public static final int XS_IDREFS = XS + 50; // NB: list type
278: public static final int XS_ENTITY = XS + 51;
279: public static final int XS_ENTITIES = XS + 52; // NB: list type
280:
281: public static final int XS_ANY_TYPE = XS + 60;
282: public static final int XS_ANY_SIMPLE_TYPE = XS + 61;
283:
284: public static final int XS_INVALID_NAME = XS + 62;
285:
286: public static final int XS_ALL = XS + 70;
287: public static final int XS_ANNOTATION = XS + 71;
288: public static final int XS_ANY = XS + 72;
289: public static final int XS_ANY_ATTRIBUTE = XS + 73;
290: public static final int XS_APPINFO = XS + 74;
291: public static final int XS_ATTRIBUTE = XS + 75;
292: public static final int XS_ATTRIBUTE_GROUP = XS + 76;
293: public static final int XS_CHOICE = XS + 77;
294: public static final int XS_COMPLEX_CONTENT = XS + 80;
295: public static final int XS_COMPLEX_TYPE = XS + 81;
296: public static final int XS_DOCUMENTATION = XS + 82;
297: public static final int XS_ELEMENT = XS + 83;
298: public static final int XS_ENUMERATION = XS + 84;
299: public static final int XS_EXTENSION = XS + 85;
300: public static final int XS_FIELD = XS + 86;
301: public static final int XS_FRACTION_DIGITS = XS + 87;
302: public static final int XS_GROUP = XS + 88;
303: public static final int XS_IMPORT = XS + 90;
304: public static final int XS_INCLUDE = XS + 91;
305: public static final int XS_KEY = XS + 92;
306: public static final int XS_KEYREF = XS + 93;
307: public static final int XS_LENGTH = XS + 94;
308: public static final int XS_LIST = XS + 95;
309: public static final int XS_MAX_EXCLUSIVE = XS + 96;
310: public static final int XS_MAX_INCLUSIVE = XS + 97;
311: public static final int XS_MAX_LENGTH = XS + 100;
312: public static final int XS_MIN_EXCLUSIVE = XS + 101;
313: public static final int XS_MIN_INCLUSIVE = XS + 102;
314: public static final int XS_MIN_LENGTH = XS + 103;
315: public static final int XS_notation = XS + 104;
316: public static final int XS_PATTERN = XS + 105;
317: public static final int XS_REDEFINE = XS + 106;
318: public static final int XS_RESTRICTION = XS + 107;
319: public static final int XS_SCHEMA = XS + 108;
320: public static final int XS_SELECTOR = XS + 110;
321: public static final int XS_SEQUENCE = XS + 111;
322: public static final int XS_SIMPLE_CONTENT = XS + 112;
323: public static final int XS_SIMPLE_TYPE = XS + 113;
324: public static final int XS_TOTAL_DIGITS = XS + 114;
325: public static final int XS_UNION = XS + 115;
326: public static final int XS_UNIQUE = XS + 116;
327: public static final int XS_WHITE_SPACE = XS + 117;
328:
329: public static final int XDT_UNTYPED = XDT + 1; // 641
330: public static final int XDT_UNTYPED_ATOMIC = XDT + 2;
331: public static final int XDT_ANY_ATOMIC_TYPE = XDT + 3;
332: public static final int XDT_YEAR_MONTH_DURATION = XDT + 4;
333: public static final int XDT_DAY_TIME_DURATION = XDT + 5;
334: public static final int XDT_NUMERIC = XDT + 6;
335:
336: public static final int XSI_TYPE = XSI + 1;
337: public static final int XSI_NIL = XSI + 2;
338: public static final int XSI_SCHEMA_LOCATION = XSI + 3;
339: public static final int XSI_NO_NAMESPACE_SCHEMA_LOCATION = XSI + 4;
340: public static final int XSI_SCHEMA_LOCATION_TYPE = XSI + 5;
341:
342: private static String[] localNames = new String[1023];
343: private static HashMap lookup = new HashMap(1023);
344:
345: private StandardNames() {
346: //pool = namePool;
347: }
348:
349: private static void bindXSLTName(int constant, String localName) {
350: localNames[constant] = localName;
351: lookup.put('{' + NamespaceConstant.XSLT + '}' + localName,
352: new Integer(constant));
353: }
354:
355: private static void bindSaxonName(int constant, String localName) {
356: localNames[constant] = localName;
357: lookup.put('{' + NamespaceConstant.SAXON + '}' + localName,
358: new Integer(constant));
359: }
360:
361: private static void bindXMLName(int constant, String localName) {
362: localNames[constant] = localName;
363: lookup.put('{' + NamespaceConstant.XML + '}' + localName,
364: new Integer(constant));
365: }
366:
367: private static void bindXSName(int constant, String localName) {
368: localNames[constant] = localName;
369: lookup.put('{' + NamespaceConstant.SCHEMA + '}' + localName,
370: new Integer(constant));
371: }
372:
373: private static void bindXDTName(int constant, String localName) {
374: localNames[constant] = localName;
375: lookup.put('{' + NamespaceConstant.XDT + '}' + localName,
376: new Integer(constant));
377: }
378:
379: private static void bindXSIName(int constant, String localName) {
380: localNames[constant] = localName;
381: lookup.put('{' + NamespaceConstant.SCHEMA_INSTANCE + '}'
382: + localName, new Integer(constant));
383: }
384:
385: static {
386:
387: bindXSLTName(XSL_ANALYZE_STRING, "analyze-string");
388: bindXSLTName(XSL_APPLY_IMPORTS, "apply-imports");
389: bindXSLTName(XSL_APPLY_TEMPLATES, "apply-templates");
390: bindXSLTName(XSL_ATTRIBUTE, "attribute");
391: bindXSLTName(XSL_ATTRIBUTE_SET, "attribute-set");
392: bindXSLTName(XSL_CALL_TEMPLATE, "call-template");
393: bindXSLTName(XSL_CHARACTER_MAP, "character-map");
394: bindXSLTName(XSL_CHOOSE, "choose");
395: bindXSLTName(XSL_COMMENT, "comment");
396: bindXSLTName(XSL_COPY, "copy");
397: bindXSLTName(XSL_COPY_OF, "copy-of");
398: bindXSLTName(XSL_DECIMAL_FORMAT, "decimal-format");
399: bindXSLTName(XSL_DOCUMENT, "document");
400: bindXSLTName(XSL_ELEMENT, "element");
401: bindXSLTName(XSL_FALLBACK, "fallback");
402: bindXSLTName(XSL_FOR_EACH, "for-each");
403: bindXSLTName(XSL_FOR_EACH_GROUP, "for-each-group");
404: bindXSLTName(XSL_FUNCTION, "function");
405: bindXSLTName(XSL_IF, "if");
406: bindXSLTName(XSL_IMPORT, "import");
407: bindXSLTName(XSL_IMPORT_SCHEMA, "import-schema");
408: bindXSLTName(XSL_INCLUDE, "include");
409: bindXSLTName(XSL_KEY, "key");
410: bindXSLTName(XSL_MATCHING_SUBSTRING, "matching-substring");
411: bindXSLTName(XSL_MESSAGE, "message");
412: bindXSLTName(XSL_NEXT_MATCH, "next-match");
413: bindXSLTName(XSL_NUMBER, "number");
414: bindXSLTName(XSL_NAMESPACE, "namespace");
415: bindXSLTName(XSL_NAMESPACE_ALIAS, "namespace-alias");
416: bindXSLTName(XSL_NON_MATCHING_SUBSTRING,
417: "non-matching-substring");
418: bindXSLTName(XSL_OTHERWISE, "otherwise");
419: bindXSLTName(XSL_OUTPUT, "output");
420: bindXSLTName(XSL_OUTPUT_CHARACTER, "output-character");
421: bindXSLTName(XSL_PARAM, "param");
422: bindXSLTName(XSL_PERFORM_SORT, "perform-sort");
423: bindXSLTName(XSL_PRESERVE_SPACE, "preserve-space");
424: bindXSLTName(XSL_PROCESSING_INSTRUCTION,
425: "processing-instruction");
426: bindXSLTName(XSL_RESULT_DOCUMENT, "result-document");
427: bindXSLTName(XSL_SEQUENCE, "sequence");
428: bindXSLTName(XSL_SORT, "sort");
429: bindXSLTName(XSL_STRIP_SPACE, "strip-space");
430: bindXSLTName(XSL_STYLESHEET, "stylesheet");
431: bindXSLTName(XSL_TEMPLATE, "template");
432: bindXSLTName(XSL_TEXT, "text");
433: bindXSLTName(XSL_TRANSFORM, "transform");
434: bindXSLTName(XSL_VALUE_OF, "value-of");
435: bindXSLTName(XSL_VARIABLE, "variable");
436: bindXSLTName(XSL_WITH_PARAM, "with-param");
437: bindXSLTName(XSL_WHEN, "when");
438:
439: bindXSLTName(XSL_DEFAULT_COLLATION, "default-collation");
440: bindXSLTName(XSL_XPATH_DEFAULT_NAMESPACE,
441: "xpath-default-namespace");
442: bindXSLTName(XSL_EXCLUDE_RESULT_PREFIXES,
443: "exclude-result-prefixes");
444: bindXSLTName(XSL_EXTENSION_ELEMENT_PREFIXES,
445: "extension-element-prefixes");
446: bindXSLTName(XSL_INHERIT_NAMESPACES, "inherit-namespaces");
447: bindXSLTName(XSL_TYPE, "type");
448: bindXSLTName(XSL_USE_ATTRIBUTE_SETS, "use-attribute-sets");
449: bindXSLTName(XSL_USE_WHEN, "use-when");
450: bindXSLTName(XSL_VALIDATION, "validation");
451: bindXSLTName(XSL_VERSION, "version");
452:
453: bindSaxonName(SAXON_ASSIGN, "assign");
454: bindSaxonName(SAXON_CALL_TEMPLATE, "call-template");
455: bindSaxonName(SAXON_COLLATION, "collation");
456: bindSaxonName(SAXON_DOCTYPE, "doctype");
457: bindSaxonName(SAXON_ENTITY_REF, "entity-ref");
458: bindSaxonName(SAXON_IMPORT_QUERY, "import-query");
459: bindSaxonName(SAXON_SCRIPT, "script");
460: bindSaxonName(SAXON_VALIDATE_TYPE, "validate-type");
461: bindSaxonName(SAXON_WHILE, "while");
462:
463: bindXMLName(XML_BASE, "base");
464: bindXMLName(XML_SPACE, "space");
465: bindXMLName(XML_LANG, "lang");
466: bindXMLName(XML_ID, "id");
467:
468: bindXSName(XS_STRING, "string");
469: bindXSName(XS_BOOLEAN, "boolean");
470: bindXSName(XS_DECIMAL, "decimal");
471: bindXSName(XS_FLOAT, "float");
472: bindXSName(XS_DOUBLE, "double");
473: bindXSName(XS_DURATION, "duration");
474: bindXSName(XS_DATE_TIME, "dateTime");
475: bindXSName(XS_TIME, "time");
476: bindXSName(XS_DATE, "date");
477: bindXSName(XS_G_YEAR_MONTH, "gYearMonth");
478: bindXSName(XS_G_YEAR, "gYear");
479: bindXSName(XS_G_MONTH_DAY, "gMonthDay");
480: bindXSName(XS_G_DAY, "gDay");
481: bindXSName(XS_G_MONTH, "gMonth");
482: bindXSName(XS_HEX_BINARY, "hexBinary");
483: bindXSName(XS_BASE64_BINARY, "base64Binary");
484: bindXSName(XS_ANY_URI, "anyURI");
485: bindXSName(XS_QNAME, "QName");
486: bindXSName(XS_NOTATION, "NOTATION");
487: bindXSName(XS_INTEGER, "integer");
488: bindXSName(XS_NON_POSITIVE_INTEGER, "nonPositiveInteger");
489: bindXSName(XS_NEGATIVE_INTEGER, "negativeInteger");
490: bindXSName(XS_LONG, "long");
491: bindXSName(XS_INT, "int");
492: bindXSName(XS_SHORT, "short");
493: bindXSName(XS_BYTE, "byte");
494: bindXSName(XS_NON_NEGATIVE_INTEGER, "nonNegativeInteger");
495: bindXSName(XS_POSITIVE_INTEGER, "positiveInteger");
496: bindXSName(XS_UNSIGNED_LONG, "unsignedLong");
497: bindXSName(XS_UNSIGNED_INT, "unsignedInt");
498: bindXSName(XS_UNSIGNED_SHORT, "unsignedShort");
499: bindXSName(XS_UNSIGNED_BYTE, "unsignedByte");
500: bindXSName(XS_NORMALIZED_STRING, "normalizedString");
501: bindXSName(XS_TOKEN, "token");
502: bindXSName(XS_LANGUAGE, "language");
503: bindXSName(XS_NMTOKEN, "NMTOKEN");
504: bindXSName(XS_NMTOKENS, "NMTOKENS"); // NB: list type
505: bindXSName(XS_NAME, "Name");
506: bindXSName(XS_NCNAME, "NCName");
507: bindXSName(XS_ID, "ID");
508: bindXSName(XS_IDREF, "IDREF");
509: bindXSName(XS_IDREFS, "IDREFS"); // NB: list type
510: bindXSName(XS_ENTITY, "ENTITY");
511: bindXSName(XS_ENTITIES, "ENTITIES"); // NB: list type
512:
513: bindXSName(XS_ANY_TYPE, "anyType");
514: bindXSName(XS_ANY_SIMPLE_TYPE, "anySimpleType");
515: bindXSName(XS_INVALID_NAME, "invalidName");
516:
517: bindXSName(XS_ALL, "all");
518: bindXSName(XS_ANNOTATION, "annotation");
519: bindXSName(XS_ANY, "any");
520: bindXSName(XS_ANY_ATTRIBUTE, "anyAttribute");
521: bindXSName(XS_APPINFO, "appinfo");
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_DOCUMENTATION, "documentation");
528: bindXSName(XS_ELEMENT, "element");
529: bindXSName(XS_ENUMERATION, "enumeration");
530: bindXSName(XS_EXTENSION, "extension");
531: bindXSName(XS_FIELD, "field");
532: bindXSName(XS_FRACTION_DIGITS, "fractionDigits");
533: bindXSName(XS_GROUP, "group");
534: bindXSName(XS_IMPORT, "import");
535: bindXSName(XS_INCLUDE, "include");
536: bindXSName(XS_KEY, "key");
537: bindXSName(XS_KEYREF, "keyref");
538: bindXSName(XS_LENGTH, "length");
539: bindXSName(XS_LIST, "list");
540: bindXSName(XS_MAX_EXCLUSIVE, "maxExclusive");
541: bindXSName(XS_MAX_INCLUSIVE, "maxInclusive");
542: bindXSName(XS_MAX_LENGTH, "maxLength");
543: bindXSName(XS_MIN_EXCLUSIVE, "minExclusive");
544: bindXSName(XS_MIN_INCLUSIVE, "minInclusive");
545: bindXSName(XS_MIN_LENGTH, "minLength");
546: bindXSName(XS_notation, "notation");
547: bindXSName(XS_PATTERN, "pattern");
548: bindXSName(XS_REDEFINE, "redefine");
549: bindXSName(XS_RESTRICTION, "restriction");
550: bindXSName(XS_SCHEMA, "schema");
551: bindXSName(XS_SELECTOR, "selector");
552: bindXSName(XS_SEQUENCE, "sequence");
553: bindXSName(XS_SIMPLE_CONTENT, "simpleContent");
554: bindXSName(XS_SIMPLE_TYPE, "simpleType");
555: bindXSName(XS_TOTAL_DIGITS, "totalDigits");
556: bindXSName(XS_UNION, "union");
557: bindXSName(XS_UNIQUE, "unique");
558: bindXSName(XS_WHITE_SPACE, "whiteSpace");
559:
560: bindXDTName(XDT_UNTYPED, "untyped");
561: bindXDTName(XDT_UNTYPED_ATOMIC, "untypedAtomic");
562: bindXDTName(XDT_ANY_ATOMIC_TYPE, "anyAtomicType");
563: bindXDTName(XDT_YEAR_MONTH_DURATION, "yearMonthDuration");
564: bindXDTName(XDT_DAY_TIME_DURATION, "dayTimeDuration");
565: bindXDTName(XDT_NUMERIC, "_numeric_");
566:
567: bindXSIName(XSI_TYPE, "type");
568: bindXSIName(XSI_NIL, "nil");
569: bindXSIName(XSI_SCHEMA_LOCATION, "schemaLocation");
570: bindXSIName(XSI_NO_NAMESPACE_SCHEMA_LOCATION,
571: "noNamespaceSchemaLocation");
572: bindXSIName(XSI_SCHEMA_LOCATION_TYPE,
573: "anonymous_schemaLocationType");
574: }
575:
576: public static int getFingerprint(String uri, String localName) {
577: Integer fp = (Integer) lookup.get('{' + uri + '}' + localName);
578: if (fp == null) {
579: return -1;
580: } else {
581: return fp.intValue();
582: }
583: }
584:
585: public static String getLocalName(int fingerprint) {
586: return localNames[fingerprint];
587: }
588:
589: public static String getURI(int fingerprint) {
590: int c = fingerprint >> 7;
591: switch (c) {
592: case DFLT_NS:
593: return "";
594: case XSL_NS:
595: return NamespaceConstant.XSLT;
596: case SAXON_NS:
597: return NamespaceConstant.SAXON;
598: case XML_NS:
599: return NamespaceConstant.XML;
600: case XS_NS:
601: return NamespaceConstant.SCHEMA;
602: case XSI_NS:
603: return NamespaceConstant.SCHEMA_INSTANCE;
604: case XDT_NS:
605: return NamespaceConstant.XDT;
606: default:
607: return null;
608: }
609: }
610:
611: public static short getURICode(int fingerprint) {
612: int c = fingerprint >> 7;
613: switch (c) {
614: case DFLT_NS:
615: return 0;
616: case XSL_NS:
617: return NamespaceConstant.XSLT_CODE;
618: case SAXON_NS:
619: return NamespaceConstant.SAXON_CODE;
620: case XML_NS:
621: return NamespaceConstant.XML_CODE;
622: case XS_NS:
623: return NamespaceConstant.SCHEMA_CODE;
624: case XSI_NS:
625: return NamespaceConstant.XSI_CODE;
626: case XDT_NS:
627: return NamespaceConstant.XDT_CODE;
628: default:
629: return -1;
630: }
631: }
632:
633: /**
634: * Get the Clark form of a name, given its name code or fingerprint
635: * @return the local name if the name is in the null namespace, or "{uri}local"
636: * otherwise. The name is always interned.
637: */
638:
639: public static String getClarkName(int fingerprint) {
640: String uri = getURI(fingerprint);
641: if (uri.equals("")) {
642: return getLocalName(fingerprint);
643: } else {
644: return '{' + uri + '}' + getLocalName(fingerprint);
645: }
646: }
647:
648: public static String getPrefix(int fingerprint) {
649: int c = fingerprint >> 7;
650: switch (c) {
651: case DFLT_NS:
652: return "";
653: case XSL_NS:
654: return "xsl";
655: case SAXON_NS:
656: return "saxon";
657: case XML_NS:
658: return "xml";
659: case XS_NS:
660: return "xs";
661: case XSI_NS:
662: return "xsi";
663: case XDT_NS:
664: return "xdt";
665: default:
666: return null;
667: }
668: }
669:
670: public static String getDisplayName(int fingerprint) {
671: if (fingerprint == -1) {
672: return "(anonymous type)";
673: }
674: if (fingerprint > 1023) {
675: return "(" + fingerprint + ')';
676: }
677: if ((fingerprint >> 7) == DFLT) {
678: return getLocalName(fingerprint);
679: }
680: return getPrefix(fingerprint) + ':' + getLocalName(fingerprint);
681: }
682:
683: }
684:
685: //
686: // The contents of this file are subject to the Mozilla Public License Version 1.0 (the "License");
687: // you may not use this file except in compliance with the License. You may obtain a copy of the
688: // License at http://www.mozilla.org/MPL/
689: //
690: // Software distributed under the License is distributed on an "AS IS" basis,
691: // WITHOUT WARRANTY OF ANY KIND, either express or implied.
692: // See the License for the specific language governing rights and limitations under the License.
693: //
694: // The Original Code is: all this file.
695: //
696: // The Initial Developer of the Original Code is Michael H. Kay
697: //
698: // Portions created by (your name) are Copyright (C) (your legal entity). All Rights Reserved.
699: //
700: // Contributor(s): none
701: //
|