KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > xerces > impl > Constants


1 /*
2  * Copyright 2000-2005 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16
17 package org.apache.xerces.impl;
18
19 import java.util.Enumeration JavaDoc;
20 import java.util.NoSuchElementException JavaDoc;
21
22 /**
23  * Commonly used constants.
24  *
25  * @xerces.internal
26  *
27  * @author Andy Clark, IBM
28  *
29  * @version $Id: Constants.java,v 1.52 2005/06/17 22:00:20 nddelima Exp $
30  */

31 public final class Constants {
32     
33     //
34
// Constants
35
//
36
// Schema Types:
37
public static final String JavaDoc NS_XMLSCHEMA = "http://www.w3.org/2001/XMLSchema".intern();
38     public static final String JavaDoc NS_DTD = "http://www.w3.org/TR/REC-xml".intern();
39     
40     // sax features
41

42     /** SAX feature prefix ("http://xml.org/sax/features/"). */
43     public static final String JavaDoc SAX_FEATURE_PREFIX = "http://xml.org/sax/features/";
44     
45     /** Namespaces feature ("namespaces"). */
46     public static final String JavaDoc NAMESPACES_FEATURE = "namespaces";
47     
48     /** Namespace prefixes feature ("namespace-prefixes"). */
49     public static final String JavaDoc NAMESPACE_PREFIXES_FEATURE = "namespace-prefixes";
50     
51     /** String interning feature ("string-interning"). */
52     public static final String JavaDoc STRING_INTERNING_FEATURE = "string-interning";
53     
54     /** Validation feature ("validation"). */
55     public static final String JavaDoc VALIDATION_FEATURE = "validation";
56     
57     /** External general entities feature ("external-general-entities "). */
58     public static final String JavaDoc EXTERNAL_GENERAL_ENTITIES_FEATURE = "external-general-entities";
59     
60     /** External parameter entities feature ("external-parameter-entities "). */
61     public static final String JavaDoc EXTERNAL_PARAMETER_ENTITIES_FEATURE = "external-parameter-entities";
62     
63     /** Lexical handler parameter entities feature ("lexical-handler/parameter-entities"). */
64     public static final String JavaDoc LEXICAL_HANDLER_PARAMETER_ENTITIES_FEATURE = "lexical-handler/parameter-entities";
65     
66     /** Is standalone feature ("is-standalone"). */
67     public static final String JavaDoc IS_STANDALONE_FEATURE = "is-standalone";
68     
69     /** Resolve DTD URIs feature ("resolve-dtd-uris"). */
70     public static final String JavaDoc RESOLVE_DTD_URIS_FEATURE = "resolve-dtd-uris";
71     
72     /** Use Attributes2 feature ("use-attributes2"). */
73     public static final String JavaDoc USE_ATTRIBUTES2_FEATURE = "use-attributes2";
74     
75     /** Use Locator2 feature ("use-locator2"). */
76     public static final String JavaDoc USE_LOCATOR2_FEATURE = "use-locator2";
77     
78     /** Use EntityResolver2 feature ("use-entity-resolver2"). */
79     public static final String JavaDoc USE_ENTITY_RESOLVER2_FEATURE = "use-entity-resolver2";
80     
81     /** Unicode normalization checking feature ("unicode-normalization-checking"). */
82     public static final String JavaDoc UNICODE_NORMALIZATION_CHECKING_FEATURE = "unicode-normalization-checking";
83     
84     /** xmlns URIs feature ("xmlns-uris"). */
85     public static final String JavaDoc XMLNS_URIS_FEATURE = "xmlns-uris";
86     
87     /** XML 1.1 feature ("xml-1.1"). */
88     public static final String JavaDoc XML_11_FEATURE = "xml-1.1";
89     
90     /** Allow unparsed entity and notation declaration events to be sent after the end DTD event ("allow-dtd-events-after-endDTD") */
91     public static final String JavaDoc ALLOW_DTD_EVENTS_AFTER_ENDDTD_FEATURE = "allow-dtd-events-after-endDTD";
92     
93     // sax properties
94

95     /** SAX property prefix ("http://xml.org/sax/properties/"). */
96     public static final String JavaDoc SAX_PROPERTY_PREFIX = "http://xml.org/sax/properties/";
97     
98     /** Declaration handler property ("declaration-handler"). */
99     public static final String JavaDoc DECLARATION_HANDLER_PROPERTY = "declaration-handler";
100     
101     /** Lexical handler property ("lexical-handler"). */
102     public static final String JavaDoc LEXICAL_HANDLER_PROPERTY = "lexical-handler";
103     
104     /** DOM node property ("dom-node"). */
105     public static final String JavaDoc DOM_NODE_PROPERTY = "dom-node";
106     
107     /** XML string property ("xml-string"). */
108     public static final String JavaDoc XML_STRING_PROPERTY = "xml-string";
109     
110     /** Document XML version property ("document-xml-version"). */
111     public static final String JavaDoc DOCUMENT_XML_VERSION_PROPERTY = "document-xml-version";
112     
113     
114     //
115
// JAXP properties
116
//
117

118     /** JAXP property prefix ("http://java.sun.com/xml/jaxp/properties/"). */
119     public static final String JavaDoc JAXP_PROPERTY_PREFIX =
120         "http://java.sun.com/xml/jaxp/properties/";
121     
122     /** JAXP schemaSource property: when used internally may include DTD sources (DOM) */
123     public static final String JavaDoc SCHEMA_SOURCE = "schemaSource";
124     
125     /** JAXP schemaSource language: when used internally may include DTD namespace (DOM) */
126     public static final String JavaDoc SCHEMA_LANGUAGE = "schemaLanguage";
127     
128     
129     //
130
// DOM features
131
//
132

133     /** Comments feature ("include-comments"). */
134     public static final String JavaDoc INCLUDE_COMMENTS_FEATURE = "include-comments";
135     
136     /** Create cdata nodes feature ("create-cdata-nodes"). */
137     public static final String JavaDoc CREATE_CDATA_NODES_FEATURE = "create-cdata-nodes";
138     
139     /** Feature id: load as infoset. */
140     public static final String JavaDoc LOAD_AS_INFOSET = "load-as-infoset";
141     
142     
143     //
144
// Constants: DOM Level 3 feature ids
145
//
146

147     public static final String JavaDoc DOM_CANONICAL_FORM = "canonical-form";
148     public static final String JavaDoc DOM_CDATA_SECTIONS ="cdata-sections";
149     public static final String JavaDoc DOM_COMMENTS = "comments";
150     
151     // REVISIT: this feature seems to have no effect for Xerces
152
public static final String JavaDoc DOM_CHARSET_OVERRIDES_XML_ENCODING =
153         "charset-overrides-xml-encoding";
154     
155     public static final String JavaDoc DOM_DATATYPE_NORMALIZATION = "datatype-normalization";
156     public static final String JavaDoc DOM_ENTITIES = "entities";
157     public static final String JavaDoc DOM_INFOSET = "infoset";
158     public static final String JavaDoc DOM_NAMESPACES = "namespaces";
159     public static final String JavaDoc DOM_NAMESPACE_DECLARATIONS = "namespace-declarations";
160     public static final String JavaDoc DOM_SUPPORTED_MEDIATYPES_ONLY =
161         "supported-media-types-only";
162     
163     public static final String JavaDoc DOM_VALIDATE_IF_SCHEMA = "validate-if-schema";
164     public static final String JavaDoc DOM_VALIDATE = "validate";
165     public static final String JavaDoc DOM_ELEMENT_CONTENT_WHITESPACE =
166         "element-content-whitespace";
167     
168     // DOM Level 3 features defined in Core:
169
public static final String JavaDoc DOM_DISCARD_DEFAULT_CONTENT = "discard-default-content";
170     public static final String JavaDoc DOM_NORMALIZE_CHARACTERS = "normalize-characters";
171     public static final String JavaDoc DOM_CHECK_CHAR_NORMALIZATION = "check-character-normalization";
172     public static final String JavaDoc DOM_WELLFORMED = "well-formed";
173     public static final String JavaDoc DOM_SPLIT_CDATA = "split-cdata-sections";
174     
175     // Load and Save
176
public static final String JavaDoc DOM_FORMAT_PRETTY_PRINT = "format-pretty-print";
177     public static final String JavaDoc DOM_XMLDECL = "xml-declaration";
178     public static final String JavaDoc DOM_UNKNOWNCHARS = "unknown-characters";
179     public static final String JavaDoc DOM_CERTIFIED = "certified";
180     public static final String JavaDoc DOM_DISALLOW_DOCTYPE = "disallow-doctype";
181     public static final String JavaDoc DOM_IGNORE_UNKNOWN_CHARACTER_DENORMALIZATIONS = "ignore-unknown-character-denormalizations";
182     
183     // DOM Properties
184
public static final String JavaDoc DOM_RESOURCE_RESOLVER = "resource-resolver";
185     public static final String JavaDoc DOM_ERROR_HANDLER = "error-handler";
186     public static final String JavaDoc DOM_SCHEMA_TYPE = "schema-type";
187     public static final String JavaDoc DOM_SCHEMA_LOCATION = "schema-location";
188     
189     // XSModel
190
public static final String JavaDoc DOM_PSVI = "psvi";
191     
192     
193     // xerces features
194

195     /** Xerces features prefix ("http://apache.org/xml/features/"). */
196     public static final String JavaDoc XERCES_FEATURE_PREFIX = "http://apache.org/xml/features/";
197     
198     /** Schema validation feature ("validation/schema"). */
199     public static final String JavaDoc SCHEMA_VALIDATION_FEATURE = "validation/schema";
200     
201     /** Expose schema normalized values */
202     public static final String JavaDoc SCHEMA_NORMALIZED_VALUE = "validation/schema/normalized-value";
203     
204     /** Send schema default value via characters() */
205     public static final String JavaDoc SCHEMA_ELEMENT_DEFAULT = "validation/schema/element-default";
206     
207     /** Schema full constraint checking ("validation/schema-full-checking"). */
208     public static final String JavaDoc SCHEMA_FULL_CHECKING = "validation/schema-full-checking";
209     
210     /** Augment Post-Schema-Validation-Infoset */
211     public static final String JavaDoc SCHEMA_AUGMENT_PSVI = "validation/schema/augment-psvi";
212     
213     /** Dynamic validation feature ("validation/dynamic"). */
214     public static final String JavaDoc DYNAMIC_VALIDATION_FEATURE = "validation/dynamic";
215     
216     /** Warn on duplicate attribute declaration feature ("validation/warn-on-duplicate-attdef"). */
217     public static final String JavaDoc WARN_ON_DUPLICATE_ATTDEF_FEATURE = "validation/warn-on-duplicate-attdef";
218     
219     /** Warn on undeclared element feature ("validation/warn-on-undeclared-elemdef"). */
220     public static final String JavaDoc WARN_ON_UNDECLARED_ELEMDEF_FEATURE = "validation/warn-on-undeclared-elemdef";
221     
222     /** Warn on duplicate entity declaration feature ("warn-on-duplicate-entitydef"). */
223     public static final String JavaDoc WARN_ON_DUPLICATE_ENTITYDEF_FEATURE = "warn-on-duplicate-entitydef";
224     
225     /** Allow Java encoding names feature ("allow-java-encodings"). */
226     public static final String JavaDoc ALLOW_JAVA_ENCODINGS_FEATURE = "allow-java-encodings";
227     
228     /** Disallow DOCTYPE declaration feature ("disallow-doctype-decl"). */
229     public static final String JavaDoc DISALLOW_DOCTYPE_DECL_FEATURE = "disallow-doctype-decl";
230     
231     /** Continue after fatal error feature ("continue-after-fatal-error"). */
232     public static final String JavaDoc CONTINUE_AFTER_FATAL_ERROR_FEATURE = "continue-after-fatal-error";
233     
234     /** Load dtd grammar when nonvalidating feature ("nonvalidating/load-dtd-grammar"). */
235     public static final String JavaDoc LOAD_DTD_GRAMMAR_FEATURE = "nonvalidating/load-dtd-grammar";
236     
237     /** Load external dtd when nonvalidating feature ("nonvalidating/load-external-dtd"). */
238     public static final String JavaDoc LOAD_EXTERNAL_DTD_FEATURE = "nonvalidating/load-external-dtd";
239     
240     /** Defer node expansion feature ("dom/defer-node-expansion"). */
241     public static final String JavaDoc DEFER_NODE_EXPANSION_FEATURE = "dom/defer-node-expansion";
242     
243     /** Create entity reference nodes feature ("dom/create-entity-ref-nodes"). */
244     public static final String JavaDoc CREATE_ENTITY_REF_NODES_FEATURE = "dom/create-entity-ref-nodes";
245     
246     /** Include ignorable whitespace feature ("dom/include-ignorable-whitespace"). */
247     public static final String JavaDoc INCLUDE_IGNORABLE_WHITESPACE = "dom/include-ignorable-whitespace";
248     
249     /** Default attribute values feature ("validation/default-attribute-values"). */
250     public static final String JavaDoc DEFAULT_ATTRIBUTE_VALUES_FEATURE = "validation/default-attribute-values";
251     
252     /** Validate content models feature ("validation/validate-content-models"). */
253     public static final String JavaDoc VALIDATE_CONTENT_MODELS_FEATURE = "validation/validate-content-models";
254     
255     /** Validate datatypes feature ("validation/validate-datatypes"). */
256     public static final String JavaDoc VALIDATE_DATATYPES_FEATURE = "validation/validate-datatypes";
257     
258     /** Notify character references feature (scanner/notify-char-refs"). */
259     public static final String JavaDoc NOTIFY_CHAR_REFS_FEATURE = "scanner/notify-char-refs";
260     
261     /** Notify built-in (&, etc.) references feature (scanner/notify-builtin-refs"). */
262     public static final String JavaDoc NOTIFY_BUILTIN_REFS_FEATURE = "scanner/notify-builtin-refs";
263     
264     /** Standard URI conformant feature ("standard-uri-conformant"). */
265     public static final String JavaDoc STANDARD_URI_CONFORMANT_FEATURE = "standard-uri-conformant";
266     
267     /** Generate synthetic annotations feature ("generate-synthetic-annotations"). */
268     public static final String JavaDoc GENERATE_SYNTHETIC_ANNOTATIONS_FEATURE = "generate-synthetic-annotations";
269     
270     /** Validate annotations feature ("validate-annotations"). */
271     public static final String JavaDoc VALIDATE_ANNOTATIONS_FEATURE = "validate-annotations";
272     
273     /** Honour all schemaLocations feature ("honour-all-schemaLocations"). */
274     public static final String JavaDoc HONOUR_ALL_SCHEMALOCATIONS_FEATURE = "honour-all-schemaLocations";
275     
276     /** XInclude processing feature ("xinclude"). */
277     public static final String JavaDoc XINCLUDE_FEATURE = "xinclude";
278     
279     /** XInclude fixup base URIs feature ("xinclude/fixup-base-uris"). */
280     public static final String JavaDoc XINCLUDE_FIXUP_BASE_URIS_FEATURE = "xinclude/fixup-base-uris";
281     
282     /** XInclude fixup language feature ("xinclude/fixup-language"). */
283     public static final String JavaDoc XINCLUDE_FIXUP_LANGUAGE_FEATURE = "xinclude/fixup-language";
284     
285     /**
286      * Internal feature. When set to true the schema validator will only use
287      * schema components from the grammar pool provided.
288      */

289     public static final String JavaDoc USE_GRAMMAR_POOL_ONLY_FEATURE = "internal/validation/schema/use-grammar-pool-only";
290     
291     /** Internal performance related feature:
292      * false - the parser settings (features/properties) have not changed between 2 parses
293      * true - the parser settings have changed between 2 parses
294      * NOTE: this feature should only be set by the parser configuration.
295      */

296     public static final String JavaDoc PARSER_SETTINGS = "internal/parser-settings";
297     
298     // xerces properties
299

300     /** Xerces properties prefix ("http://apache.org/xml/properties/"). */
301     public static final String JavaDoc XERCES_PROPERTY_PREFIX = "http://apache.org/xml/properties/";
302     
303     /** Current element node property ("dom/current-element-node"). */
304     public static final String JavaDoc CURRENT_ELEMENT_NODE_PROPERTY = "dom/current-element-node";
305     
306     /** Document class name property ("dom/document-class-name"). */
307     public static final String JavaDoc DOCUMENT_CLASS_NAME_PROPERTY = "dom/document-class-name";
308     
309     /** Symbol table property ("internal/symbol-table"). */
310     public static final String JavaDoc SYMBOL_TABLE_PROPERTY = "internal/symbol-table";
311     
312     /** Error reporter property ("internal/error-reporter"). */
313     public static final String JavaDoc ERROR_REPORTER_PROPERTY = "internal/error-reporter";
314     
315     /** Error handler property ("internal/error-handler"). */
316     public static final String JavaDoc ERROR_HANDLER_PROPERTY = "internal/error-handler";
317     
318     /** XInclude handler property ("internal/xinclude-handler"). */
319     public static final String JavaDoc XINCLUDE_HANDLER_PROPERTY = "internal/xinclude-handler";
320     
321     /** XPointer handler property ("internal/xpointer-handler"). */
322     public static final String JavaDoc XPOINTER_HANDLER_PROPERTY = "internal/xpointer-handler";
323     
324     /** Entity manager property ("internal/entity-manager"). */
325     public static final String JavaDoc ENTITY_MANAGER_PROPERTY = "internal/entity-manager";
326     
327     
328     /** Input buffer size property ("input-buffer-size"). */
329     public static final String JavaDoc BUFFER_SIZE_PROPERTY = "input-buffer-size";
330     
331     /** Security manager property ("security-manager"). */
332     public static final String JavaDoc SECURITY_MANAGER_PROPERTY = "security-manager";
333     
334     /** Entity resolver property ("internal/entity-resolver"). */
335     public static final String JavaDoc ENTITY_RESOLVER_PROPERTY = "internal/entity-resolver";
336     
337     /** Grammar pool property ("internal/grammar-pool"). */
338     public static final String JavaDoc XMLGRAMMAR_POOL_PROPERTY = "internal/grammar-pool";
339     
340     /** Datatype validator factory ("internal/datatype-validator-factory"). */
341     public static final String JavaDoc DATATYPE_VALIDATOR_FACTORY_PROPERTY = "internal/datatype-validator-factory";
342     
343     /** Document scanner property ("internal/document-scanner"). */
344     public static final String JavaDoc DOCUMENT_SCANNER_PROPERTY = "internal/document-scanner";
345     
346     /** DTD scanner property ("internal/dtd-scanner"). */
347     public static final String JavaDoc DTD_SCANNER_PROPERTY = "internal/dtd-scanner";
348     
349     /** DTD processor property ("internal/dtd-processor"). */
350     public static final String JavaDoc DTD_PROCESSOR_PROPERTY = "internal/dtd-processor";
351     
352     /** Validator property ("internal/validator"). */
353     public static final String JavaDoc VALIDATOR_PROPERTY = "internal/validator";
354     
355     /** Validator property ("internal/validator/dtd"). */
356     public static final String JavaDoc DTD_VALIDATOR_PROPERTY = "internal/validator/dtd";
357     
358     /** Validator property ("internal/validator/schema"). */
359     public static final String JavaDoc SCHEMA_VALIDATOR_PROPERTY = "internal/validator/schema";
360     
361     /** No namespace schema location property ("schema/external-schemaLocation"). */
362     public static final String JavaDoc SCHEMA_LOCATION = "schema/external-schemaLocation";
363     
364     /** Schema location property ("schema/external-noNamespaceSchemaLocation"). */
365     public static final String JavaDoc SCHEMA_NONS_LOCATION = "schema/external-noNamespaceSchemaLocation";
366     
367     /** Namespace binder property ("internal/namespace-binder"). */
368     public static final String JavaDoc NAMESPACE_BINDER_PROPERTY = "internal/namespace-binder";
369     
370     /** Namespace context property ("internal/namespace-context"). */
371     public static final String JavaDoc NAMESPACE_CONTEXT_PROPERTY = "internal/namespace-context";
372     
373     /** Validation manager property ("internal/validation-manager"). */
374     public static final String JavaDoc VALIDATION_MANAGER_PROPERTY = "internal/validation-manager";
375     
376     // general constants
377

378     /** Element PSVI is stored in augmentations using string "ELEMENT_PSVI" */
379     public final static String JavaDoc ELEMENT_PSVI = "ELEMENT_PSVI";
380     
381     /* Attribute PSVI is stored in augmentations using string "ATTRIBUTE_PSVI" */
382     public final static String JavaDoc ATTRIBUTE_PSVI = "ATTRIBUTE_PSVI";
383     
384     /**
385      * Boolean indicating whether an attribute is declared in the DTD is stored
386      * in augmentations using the string "ATTRIBUTE_DECLARED". The absence of this
387      * augmentation indicates that the attribute was not declared in the DTD.
388      */

389     public final static String JavaDoc ATTRIBUTE_DECLARED = "ATTRIBUTE_DECLARED";
390     
391     /**
392      * Boolean indicating whether an entity referenced in the document has
393      * not been read is stored in augmentations using the string "ENTITY_SKIPPED".
394      * The absence of this augmentation indicates that the entity had a
395      * declaration and was expanded.
396      */

397     public final static String JavaDoc ENTITY_SKIPPED = "ENTITY_SKIPPED";
398     
399     /**
400      * Boolean indicating whether a character is a probable white space
401      * character (ch <= 0x20) that was the replacement text of a character
402      * reference is stored in augmentations using the string "CHAR_REF_PROBABLE_WS".
403      * The absence of this augmentation indicates that the character is not
404      * probable white space and/or was not included from a character reference.
405      */

406     public final static String JavaDoc CHAR_REF_PROBABLE_WS = "CHAR_REF_PROBABLE_WS";
407     
408     // XML version constants
409
public final static short XML_VERSION_1_0 = 1;
410     public final static short XML_VERSION_1_1 = 2;
411     
412     // Constant to enable Schema 1.1 support
413
public final static boolean SCHEMA_1_1_SUPPORT = false;
414     
415     // private
416

417     /** SAX features. */
418     private static final String JavaDoc[] fgSAXFeatures = {
419             NAMESPACES_FEATURE,
420             NAMESPACE_PREFIXES_FEATURE,
421             STRING_INTERNING_FEATURE,
422             VALIDATION_FEATURE,
423             EXTERNAL_GENERAL_ENTITIES_FEATURE,
424             EXTERNAL_PARAMETER_ENTITIES_FEATURE,
425     };
426     
427     /** SAX properties. */
428     private static final String JavaDoc[] fgSAXProperties = {
429             DECLARATION_HANDLER_PROPERTY,
430             LEXICAL_HANDLER_PROPERTY,
431             DOM_NODE_PROPERTY,
432             XML_STRING_PROPERTY,
433     };
434     
435     /** Xerces features. */
436     private static final String JavaDoc[] fgXercesFeatures = {
437             SCHEMA_VALIDATION_FEATURE,
438             SCHEMA_FULL_CHECKING,
439             DYNAMIC_VALIDATION_FEATURE,
440             WARN_ON_DUPLICATE_ATTDEF_FEATURE,
441             WARN_ON_UNDECLARED_ELEMDEF_FEATURE,
442             ALLOW_JAVA_ENCODINGS_FEATURE,
443             CONTINUE_AFTER_FATAL_ERROR_FEATURE,
444             LOAD_DTD_GRAMMAR_FEATURE,
445             LOAD_EXTERNAL_DTD_FEATURE,
446             //DEFER_NODE_EXPANSION_FEATURE,
447
CREATE_ENTITY_REF_NODES_FEATURE,
448             INCLUDE_IGNORABLE_WHITESPACE,
449             //GRAMMAR_ACCESS_FEATURE,
450
DEFAULT_ATTRIBUTE_VALUES_FEATURE,
451             VALIDATE_CONTENT_MODELS_FEATURE,
452             VALIDATE_DATATYPES_FEATURE,
453             NOTIFY_CHAR_REFS_FEATURE,
454             NOTIFY_BUILTIN_REFS_FEATURE,
455             DISALLOW_DOCTYPE_DECL_FEATURE,
456             STANDARD_URI_CONFORMANT_FEATURE,
457             GENERATE_SYNTHETIC_ANNOTATIONS_FEATURE,
458             VALIDATE_ANNOTATIONS_FEATURE,
459             HONOUR_ALL_SCHEMALOCATIONS_FEATURE,
460             XINCLUDE_FEATURE,
461             XINCLUDE_FIXUP_BASE_URIS_FEATURE,
462             XINCLUDE_FIXUP_LANGUAGE_FEATURE
463     };
464     
465     /** Xerces properties. */
466     private static final String JavaDoc[] fgXercesProperties = {
467             CURRENT_ELEMENT_NODE_PROPERTY,
468             DOCUMENT_CLASS_NAME_PROPERTY,
469             SYMBOL_TABLE_PROPERTY,
470             ERROR_HANDLER_PROPERTY,
471             ERROR_REPORTER_PROPERTY,
472             ENTITY_MANAGER_PROPERTY,
473             ENTITY_RESOLVER_PROPERTY,
474             XMLGRAMMAR_POOL_PROPERTY,
475             DATATYPE_VALIDATOR_FACTORY_PROPERTY,
476             DOCUMENT_SCANNER_PROPERTY,
477             DTD_SCANNER_PROPERTY,
478             VALIDATOR_PROPERTY,
479             SCHEMA_LOCATION,
480             SCHEMA_NONS_LOCATION,
481             VALIDATION_MANAGER_PROPERTY,
482             BUFFER_SIZE_PROPERTY,
483             SECURITY_MANAGER_PROPERTY
484     };
485     
486     /** Empty enumeration. */
487     private static final Enumeration JavaDoc fgEmptyEnumeration = new ArrayEnumeration(new Object JavaDoc[] {});
488     
489     //
490
// Constructors
491
//
492

493     /** This class cannot be instantiated. */
494     private Constants() {}
495     
496     //
497
// Public methods
498
//
499

500     // sax
501

502     /** Returns an enumeration of the SAX features. */
503     public static Enumeration JavaDoc getSAXFeatures() {
504         return fgSAXFeatures.length > 0
505         ? new ArrayEnumeration(fgSAXFeatures) : fgEmptyEnumeration;
506     } // getSAXFeatures():Enumeration
507

508     /** Returns an enumeration of the SAX properties. */
509     public static Enumeration JavaDoc getSAXProperties() {
510         return fgSAXProperties.length > 0
511         ? new ArrayEnumeration(fgSAXProperties) : fgEmptyEnumeration;
512     } // getSAXProperties():Enumeration
513

514     // xerces
515

516     /** Returns an enumeration of the Xerces features. */
517     public static Enumeration JavaDoc getXercesFeatures() {
518         return fgXercesFeatures.length > 0
519         ? new ArrayEnumeration(fgXercesFeatures) : fgEmptyEnumeration;
520     } // getXercesFeatures():Enumeration
521

522     /** Returns an enumeration of the Xerces properties. */
523     public static Enumeration JavaDoc getXercesProperties() {
524         return fgXercesProperties.length > 0
525         ? new ArrayEnumeration(fgXercesProperties) : fgEmptyEnumeration;
526     } // getXercesProperties():Enumeration
527

528     //
529
// Classes
530
//
531

532     /**
533      * An array enumeration.
534      *
535      * @author Andy Clark, IBM
536      */

537     static class ArrayEnumeration
538     implements Enumeration JavaDoc {
539         
540         //
541
// Data
542
//
543

544         /** Array. */
545         private Object JavaDoc[] array;
546         
547         /** Index. */
548         private int index;
549         
550         //
551
// Constructors
552
//
553

554         /** Constructs an array enumeration. */
555         public ArrayEnumeration(Object JavaDoc[] array) {
556             this.array = array;
557         } // <init>(Object[])
558

559         //
560
// Enumeration methods
561
//
562

563         /**
564          * Tests if this enumeration contains more elements.
565          *
566          * @return <code>true</code> if this enumeration contains more elements;
567          * <code>false</code> otherwise.
568          * @since JDK1.0
569          */

570         public boolean hasMoreElements() {
571             return index < array.length;
572         } // hasMoreElement():boolean
573

574         /**
575          * Returns the next element of this enumeration.
576          *
577          * @return the next element of this enumeration.
578          * @exception NoSuchElementException if no more elements exist.
579          * @since JDK1.0
580          */

581         public Object JavaDoc nextElement() {
582             if (index < array.length) {
583                 return array[index++];
584             }
585             throw new NoSuchElementException JavaDoc();
586         } // nextElement():Object
587

588     } // class ArrayEnumeration
589

590     //
591
// MAIN
592
//
593

594     /** Prints all of the constants to standard output. */
595     public static void main(String JavaDoc[] argv) {
596         
597         print("SAX features:", SAX_FEATURE_PREFIX, fgSAXFeatures);
598         print("SAX properties:", SAX_PROPERTY_PREFIX, fgSAXProperties);
599         print("Xerces features:", XERCES_FEATURE_PREFIX, fgXercesFeatures);
600         print("Xerces properties:", XERCES_PROPERTY_PREFIX, fgXercesProperties);
601         
602     } // main(String[])
603

604     /** Prints a list of features/properties. */
605     private static void print(String JavaDoc header, String JavaDoc prefix, Object JavaDoc[] array) {
606         System.out.print(header);
607         if (array.length > 0) {
608             System.out.println();
609             for (int i = 0; i < array.length; i++) {
610                 System.out.print(" ");
611                 System.out.print(prefix);
612                 System.out.println(array[i]);
613             }
614         }
615         else {
616             System.out.println(" none.");
617         }
618     } // print(String,String,Object[])
619

620 } // class Constants
621
Popular Tags