1 /*
   2  * Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved.
   3  */
   4 
   5 /*
   6  * Copyright 2005 The Apache Software Foundation.
   7  *
   8  * Licensed under the Apache License, Version 2.0 (the "License");
   9  * you may not use this file except in compliance with the License.
  10  * You may obtain a copy of the License at
  11  *
  12  *      http://www.apache.org/licenses/LICENSE-2.0
  13  *
  14  * Unless required by applicable law or agreed to in writing, software
  15  * distributed under the License is distributed on an "AS IS" BASIS,
  16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  17  * See the License for the specific language governing permissions and
  18  * limitations under the License.
  19  */
  20 
  21 package com.sun.org.apache.xerces.internal.impl;
  22 
  23 import java.util.Enumeration;
  24 import java.util.NoSuchElementException;
  25 
  26 /**
  27  * Commonly used constants.
  28  *
  29  * @xerces.internal
  30  *
  31  * @author Andy Clark, IBM
  32  *
  33  * @version $Id: Constants.java,v 1.14 2010-11-01 04:39:40 joehw Exp $
  34  */
  35 public final class Constants {
  36 
  37     //
  38     // Constants
  39     //
  40     // Schema Types:
  41     public static final String NS_XMLSCHEMA = "http://www.w3.org/2001/XMLSchema".intern();
  42     public static final String NS_DTD = "http://www.w3.org/TR/REC-xml".intern();
  43 
  44     // Schema features
  45     public static final String SUN_SCHEMA_FEATURE_PREFIX = "http://java.sun.com/xml/schema/features/";
  46     public static final String SUN_REPORT_IGNORED_ELEMENT_CONTENT_WHITESPACE = "report-ignored-element-content-whitespace";
  47 
  48     //stax properties
  49 
  50     public static final String ZEPHYR_PROPERTY_PREFIX = "http://java.sun.com/xml/stream/properties/" ;
  51     public static final String STAX_PROPERTIES = "stax-properties" ;
  52     public static final String STAX_ENTITY_RESOLVER_PROPERTY = "internal/stax-entity-resolver";
  53     public static final String STAX_REPORT_CDATA_EVENT = "report-cdata-event";
  54     public static final String READER_IN_DEFINED_STATE = ZEPHYR_PROPERTY_PREFIX + "reader-in-defined-state" ;
  55     public static final String ADD_NAMESPACE_DECL_AS_ATTRIBUTE = "add-namespacedecl-as-attrbiute";
  56     public static final String ESCAPE_CHARACTERS = "escapeCharacters";
  57     public static final String REUSE_INSTANCE = "reuse-instance" ;
  58 
  59     //DOM properties
  60     public static final String SUN_DOM_PROPERTY_PREFIX = "http://java.sun.com/xml/dom/properties/" ;
  61     public static final String SUN_DOM_ANCESTOR_CHECCK = "ancestor-check";
  62 
  63     /**
  64      * If true, ignore DOCTYPE declaration as if it wasn't present at all.
  65      * Note that this is a violation of the XML recommendation.
  66      * The full property name is prefixed by {@link #ZEPHYR_PROPERTY_PREFIX}.
  67      */
  68     public static final String IGNORE_EXTERNAL_DTD = "ignore-external-dtd";
  69 
  70     // sax features
  71 
  72     /** SAX feature prefix ("http://xml.org/sax/features/"). */
  73     public static final String SAX_FEATURE_PREFIX = "http://xml.org/sax/features/";
  74 
  75     public static final String NAMESPACES_FEATURE = "namespaces";
  76 
  77     /** Namespace prefixes feature ("namespace-prefixes"). */
  78     public static final String NAMESPACE_PREFIXES_FEATURE = "namespace-prefixes";
  79 
  80     /** String interning feature ("string-interning"). */
  81     public static final String STRING_INTERNING_FEATURE = "string-interning";
  82 
  83     /** Validation feature ("validation"). */
  84     public static final String VALIDATION_FEATURE = "validation";
  85 
  86     /** External general entities feature ("external-general-entities "). */
  87     public static final String EXTERNAL_GENERAL_ENTITIES_FEATURE = "external-general-entities";
  88 
  89     /** External parameter entities feature ("external-parameter-entities "). */
  90     public static final String EXTERNAL_PARAMETER_ENTITIES_FEATURE = "external-parameter-entities";
  91 
  92     /** Lexical handler parameter entities feature ("lexical-handler/parameter-entities"). */
  93     public static final String LEXICAL_HANDLER_PARAMETER_ENTITIES_FEATURE = "lexical-handler/parameter-entities";
  94 
  95     /** Is standalone feature ("is-standalone"). */
  96     public static final String IS_STANDALONE_FEATURE = "is-standalone";
  97 
  98     /** Resolve DTD URIs feature ("resolve-dtd-uris"). */
  99     public static final String RESOLVE_DTD_URIS_FEATURE = "resolve-dtd-uris";
 100 
 101     /** Use Attributes2 feature ("use-attributes2"). */
 102     public static final String USE_ATTRIBUTES2_FEATURE = "use-attributes2";
 103 
 104     /** Use Locator2 feature ("use-locator2"). */
 105     public static final String USE_LOCATOR2_FEATURE = "use-locator2";
 106 
 107     /** Use EntityResolver2 feature ("use-entity-resolver2"). */
 108     public static final String USE_ENTITY_RESOLVER2_FEATURE = "use-entity-resolver2";
 109 
 110     /** Unicode normalization checking feature ("unicode-normalization-checking"). */
 111     public static final String UNICODE_NORMALIZATION_CHECKING_FEATURE = "unicode-normalization-checking";
 112 
 113     /** xmlns URIs feature ("xmlns-uris"). */
 114     public static final String XMLNS_URIS_FEATURE = "xmlns-uris";
 115 
 116     /** XML 1.1 feature ("xml-1.1"). */
 117     public static final String XML_11_FEATURE = "xml-1.1";
 118 
 119     /** Allow unparsed entity and notation declaration events to be sent after the end DTD event ("allow-dtd-events-after-endDTD") */
 120     public static final String ALLOW_DTD_EVENTS_AFTER_ENDDTD_FEATURE = "allow-dtd-events-after-endDTD";
 121 
 122     // sax properties
 123 
 124     /** SAX property prefix ("http://xml.org/sax/properties/"). */
 125     public static final String SAX_PROPERTY_PREFIX = "http://xml.org/sax/properties/";
 126 
 127     /** Declaration handler property ("declaration-handler"). */
 128     public static final String DECLARATION_HANDLER_PROPERTY = "declaration-handler";
 129 
 130     /** Lexical handler property ("lexical-handler"). */
 131     public static final String LEXICAL_HANDLER_PROPERTY = "lexical-handler";
 132 
 133     /** DOM node property ("dom-node"). */
 134     public static final String DOM_NODE_PROPERTY = "dom-node";
 135 
 136     /** XML string property ("xml-string"). */
 137     public static final String XML_STRING_PROPERTY = "xml-string";
 138 
 139     public static final String FEATURE_SECURE_PROCESSING = "http://javax.xml.XMLConstants/feature/secure-processing";
 140 
 141     public static final String ORACLE_FEATURE_SERVICE_MECHANISM = "http://www.oracle.com/feature/use-service-mechanism";
 142 
 143     /** Document XML version property ("document-xml-version"). */
 144     public static final String DOCUMENT_XML_VERSION_PROPERTY = "document-xml-version";
 145 
 146 
 147     //
 148     // JAXP properties
 149     //
 150 
 151     /** JAXP property prefix ("http://java.sun.com/xml/jaxp/properties/"). */
 152     public static final String JAXP_PROPERTY_PREFIX =
 153         "http://java.sun.com/xml/jaxp/properties/";
 154 
 155     /** JAXP schemaSource property: when used internally may include DTD sources (DOM) */
 156     public static final String SCHEMA_SOURCE = "schemaSource";
 157 
 158     /** JAXP schemaSource language: when used internally may include DTD namespace (DOM) */
 159     public static final String SCHEMA_LANGUAGE = "schemaLanguage";
 160 
 161     public static final String SYSTEM_PROPERTY_ELEMENT_ATTRIBUTE_LIMIT = "elementAttributeLimit" ;
 162 
 163     //
 164     // DOM features
 165     //
 166 
 167     /** Comments feature ("include-comments"). */
 168     public static final String INCLUDE_COMMENTS_FEATURE = "include-comments";
 169 
 170     /** Create cdata nodes feature ("create-cdata-nodes"). */
 171     public static final String CREATE_CDATA_NODES_FEATURE = "create-cdata-nodes";
 172 
 173     /** Feature id: load as infoset. */
 174     public static final String LOAD_AS_INFOSET = "load-as-infoset";
 175 
 176 
 177     //
 178     // Constants: DOM Level 3 feature ids
 179     //
 180 
 181     public static final String DOM_CANONICAL_FORM = "canonical-form";
 182     public static final String DOM_CDATA_SECTIONS ="cdata-sections";
 183 
 184     public static final String DOM_COMMENTS = "comments";
 185 
 186     // REVISIT: this feature seems to have no effect for Xerces
 187 
 188     public static final String DOM_CHARSET_OVERRIDES_XML_ENCODING =
 189     "charset-overrides-xml-encoding";
 190 
 191     public static final String DOM_DATATYPE_NORMALIZATION = "datatype-normalization";
 192 
 193     public static final String DOM_ENTITIES = "entities";
 194     public static final String DOM_INFOSET = "infoset";
 195     public static final String DOM_NAMESPACES = "namespaces";
 196     public static final String DOM_NAMESPACE_DECLARATIONS = "namespace-declarations";
 197     public static final String DOM_SUPPORTED_MEDIATYPES_ONLY =
 198         "supported-media-types-only";
 199 
 200     public static final String DOM_VALIDATE_IF_SCHEMA = "validate-if-schema";
 201     public static final String DOM_VALIDATE = "validate";
 202     public static final String DOM_ELEMENT_CONTENT_WHITESPACE =
 203         "element-content-whitespace";
 204 
 205     // DOM Level 3 features defined in Core:
 206     public static final String DOM_DISCARD_DEFAULT_CONTENT = "discard-default-content";
 207     public static final String DOM_NORMALIZE_CHARACTERS    = "normalize-characters";
 208     public static final String DOM_CHECK_CHAR_NORMALIZATION  = "check-character-normalization";
 209     public static final String DOM_WELLFORMED  = "well-formed";
 210     public static final String DOM_SPLIT_CDATA = "split-cdata-sections";
 211 
 212     // Load and Save
 213     public static final String DOM_FORMAT_PRETTY_PRINT = "format-pretty-print";
 214     public static final String DOM_XMLDECL = "xml-declaration";
 215     public static final String DOM_UNKNOWNCHARS = "unknown-characters";
 216     public static final String DOM_CERTIFIED =  "certified";
 217     public static final String DOM_DISALLOW_DOCTYPE =  "disallow-doctype";
 218     public static final String DOM_IGNORE_UNKNOWN_CHARACTER_DENORMALIZATIONS =  "ignore-unknown-character-denormalizations";
 219 
 220     // DOM Properties
 221     public static final String DOM_RESOURCE_RESOLVER = "resource-resolver";
 222     public static final String DOM_ERROR_HANDLER = "error-handler";
 223     public static final String DOM_SCHEMA_TYPE = "schema-type";
 224     public static final String DOM_SCHEMA_LOCATION = "schema-location";
 225     public static final String DOM_ANCESTOR_CHECCK = "ancestor-check";
 226     // XSModel
 227     public static final String DOM_PSVI = "psvi";
 228 
 229 
 230     // xerces features
 231 
 232     /** Xerces features prefix ("http://apache.org/xml/features/"). */
 233     public static final String XERCES_FEATURE_PREFIX = "http://apache.org/xml/features/";
 234 
 235     /** Schema validation feature ("validation/schema"). */
 236     public static final String SCHEMA_VALIDATION_FEATURE = "validation/schema";
 237 
 238     /** Expose schema normalized values */
 239     public static final String SCHEMA_NORMALIZED_VALUE = "validation/schema/normalized-value";
 240 
 241     /** Send schema default value via characters() */
 242     public static final String SCHEMA_ELEMENT_DEFAULT = "validation/schema/element-default";
 243 
 244     /** Schema full constraint checking ("validation/schema-full-checking"). */
 245     public static final String SCHEMA_FULL_CHECKING = "validation/schema-full-checking";
 246 
 247     /** Augment Post-Schema-Validation-Infoset */
 248     public static final String SCHEMA_AUGMENT_PSVI = "validation/schema/augment-psvi";
 249 
 250     /** Dynamic validation feature ("validation/dynamic"). */
 251     public static final String DYNAMIC_VALIDATION_FEATURE = "validation/dynamic";
 252 
 253     /** Warn on duplicate attribute declaration feature ("validation/warn-on-duplicate-attdef"). */
 254     public static final String WARN_ON_DUPLICATE_ATTDEF_FEATURE = "validation/warn-on-duplicate-attdef";
 255 
 256     /** Warn on undeclared element feature ("validation/warn-on-undeclared-elemdef"). */
 257     public static final String WARN_ON_UNDECLARED_ELEMDEF_FEATURE = "validation/warn-on-undeclared-elemdef";
 258 
 259     /** Warn on duplicate entity declaration feature ("warn-on-duplicate-entitydef"). */
 260     public static final String WARN_ON_DUPLICATE_ENTITYDEF_FEATURE = "warn-on-duplicate-entitydef";
 261 
 262     /** Allow Java encoding names feature ("allow-java-encodings"). */
 263     public static final String ALLOW_JAVA_ENCODINGS_FEATURE = "allow-java-encodings";
 264 
 265     /** Disallow DOCTYPE declaration feature ("disallow-doctype-decl"). */
 266     public static final String DISALLOW_DOCTYPE_DECL_FEATURE = "disallow-doctype-decl";
 267 
 268     /** Continue after fatal error feature ("continue-after-fatal-error"). */
 269     public static final String CONTINUE_AFTER_FATAL_ERROR_FEATURE = "continue-after-fatal-error";
 270 
 271     /** Load dtd grammar when nonvalidating feature ("nonvalidating/load-dtd-grammar"). */
 272     public static final String LOAD_DTD_GRAMMAR_FEATURE = "nonvalidating/load-dtd-grammar";
 273 
 274     /** Load external dtd when nonvalidating feature ("nonvalidating/load-external-dtd"). */
 275     public static final String LOAD_EXTERNAL_DTD_FEATURE = "nonvalidating/load-external-dtd";
 276 
 277     /** Defer node expansion feature ("dom/defer-node-expansion"). */
 278     public static final String DEFER_NODE_EXPANSION_FEATURE = "dom/defer-node-expansion";
 279 
 280     /** Create entity reference nodes feature ("dom/create-entity-ref-nodes"). */
 281     public static final String CREATE_ENTITY_REF_NODES_FEATURE = "dom/create-entity-ref-nodes";
 282 
 283     /** Include ignorable whitespace feature ("dom/include-ignorable-whitespace"). */
 284     public static final String INCLUDE_IGNORABLE_WHITESPACE = "dom/include-ignorable-whitespace";
 285 
 286     /** Default attribute values feature ("validation/default-attribute-values"). */
 287     public static final String DEFAULT_ATTRIBUTE_VALUES_FEATURE = "validation/default-attribute-values";
 288 
 289     /** Validate content models feature ("validation/validate-content-models"). */
 290     public static final String VALIDATE_CONTENT_MODELS_FEATURE = "validation/validate-content-models";
 291 
 292     /** Validate datatypes feature ("validation/validate-datatypes"). */
 293     public static final String VALIDATE_DATATYPES_FEATURE = "validation/validate-datatypes";
 294 
 295     /** Balance syntax trees feature ("validation/balance-syntax-trees"). */
 296     public static final String BALANCE_SYNTAX_TREES = "validation/balance-syntax-trees";
 297 
 298     /** Notify character references feature (scanner/notify-char-refs"). */
 299     public static final String NOTIFY_CHAR_REFS_FEATURE = "scanner/notify-char-refs";
 300 
 301     /** Notify built-in (&, etc.) references feature (scanner/notify-builtin-refs"). */
 302     public static final String NOTIFY_BUILTIN_REFS_FEATURE = "scanner/notify-builtin-refs";
 303 
 304     /** Standard URI conformant feature ("standard-uri-conformant"). */
 305     public static final String STANDARD_URI_CONFORMANT_FEATURE = "standard-uri-conformant";
 306 
 307     /** Generate synthetic annotations feature ("generate-synthetic-annotations"). */
 308     public static final String GENERATE_SYNTHETIC_ANNOTATIONS_FEATURE = "generate-synthetic-annotations";
 309 
 310     /** Validate annotations feature ("validate-annotations"). */
 311     public static final String VALIDATE_ANNOTATIONS_FEATURE = "validate-annotations";
 312 
 313 
 314         /** Honour all schemaLocations feature ("honour-all-schemaLocations"). */
 315     public static final String HONOUR_ALL_SCHEMALOCATIONS_FEATURE = "honour-all-schemaLocations";
 316 
 317     /** Namespace growth feature ("namespace-growth"). */
 318     public static final String NAMESPACE_GROWTH_FEATURE = "namespace-growth";
 319 
 320     /** Tolerate duplicates feature ("internal/tolerate-duplicates"). */
 321     public static final String TOLERATE_DUPLICATES_FEATURE = "internal/tolerate-duplicates";
 322 
 323     /** XInclude processing feature ("xinclude"). */
 324     public static final String XINCLUDE_FEATURE = "xinclude";
 325 
 326     /** XInclude fixup base URIs feature ("xinclude/fixup-base-uris"). */
 327     public static final String XINCLUDE_FIXUP_BASE_URIS_FEATURE = "xinclude/fixup-base-uris";
 328 
 329     /** XInclude fixup language feature ("xinclude/fixup-language"). */
 330     public static final String XINCLUDE_FIXUP_LANGUAGE_FEATURE = "xinclude/fixup-language";
 331 
 332     /**
 333      * Internal feature. When set to true the schema validator will only use
 334      * schema components from the grammar pool provided.
 335      */
 336     public static final String USE_GRAMMAR_POOL_ONLY_FEATURE = "internal/validation/schema/use-grammar-pool-only";
 337 
 338     /** Internal performance related feature:
 339      * false - the parser settings (features/properties) have not changed between 2 parses
 340      * true - the parser settings have changed between 2 parses
 341      * NOTE: this feature should only be set by the parser configuration.
 342      */
 343     public static final String PARSER_SETTINGS = "internal/parser-settings";
 344 
 345 
 346     /** Feature to make XML Processor XInclude Aware */
 347     public static final String XINCLUDE_AWARE = "xinclude-aware";
 348 
 349     /** Ignore xsi:schemaLocation and xsi:noNamespaceSchemaLocation. */
 350     public static final String IGNORE_SCHEMA_LOCATION_HINTS = "validation/schema/ignore-schema-location-hints";
 351 
 352     /**
 353      * When true, the schema processor will change characters events
 354      * to ignorableWhitespaces events, when characters are expected to
 355      * only contain ignorable whitespaces.
 356      */
 357     public static final String CHANGE_IGNORABLE_CHARACTERS_INTO_IGNORABLE_WHITESPACES =
 358         "validation/change-ignorable-characters-into-ignorable-whitespaces";
 359 
 360     // xerces properties
 361 
 362     /** Xerces properties prefix ("http://apache.org/xml/properties/"). */
 363     public static final String XERCES_PROPERTY_PREFIX = "http://apache.org/xml/properties/";
 364 
 365     /** Current element node property ("dom/current-element-node"). */
 366     public static final String CURRENT_ELEMENT_NODE_PROPERTY = "dom/current-element-node";
 367 
 368     /** Document class name property ("dom/document-class-name"). */
 369     public static final String DOCUMENT_CLASS_NAME_PROPERTY = "dom/document-class-name";
 370 
 371     /** Symbol table property ("internal/symbol-table"). */
 372     public static final String SYMBOL_TABLE_PROPERTY = "internal/symbol-table";
 373 
 374     /** Error reporter property ("internal/error-reporter"). */
 375     public static final String ERROR_REPORTER_PROPERTY = "internal/error-reporter";
 376 
 377     /** Error handler property ("internal/error-handler"). */
 378     public static final String ERROR_HANDLER_PROPERTY = "internal/error-handler";
 379 
 380     /** XInclude handler property ("internal/xinclude-handler"). */
 381     public static final String XINCLUDE_HANDLER_PROPERTY = "internal/xinclude-handler";
 382 
 383     /** XPointer handler property ("internal/xpointer-handler"). */
 384     public static final String XPOINTER_HANDLER_PROPERTY = "internal/xpointer-handler";
 385 
 386     /** Entity manager property ("internal/entity-manager"). */
 387     public static final String ENTITY_MANAGER_PROPERTY = "internal/entity-manager";
 388     /** Input buffer size property ("input-buffer-size"). */
 389     public static final String BUFFER_SIZE_PROPERTY = "input-buffer-size";
 390 
 391     /** Security manager property ("security-manager"). */
 392     public static final String SECURITY_MANAGER_PROPERTY = "security-manager";
 393 
 394     /** Locale property ("locale"). */
 395     public static final String LOCALE_PROPERTY = "locale";
 396 
 397     /** property identifier: security manager. */
 398     protected static final String SECURITY_MANAGER =
 399         Constants.XERCES_PROPERTY_PREFIX + Constants.SECURITY_MANAGER_PROPERTY;
 400 
 401 
 402     public static final String ENTITY_RESOLVER_PROPERTY = "internal/entity-resolver";
 403 
 404     /** Grammar pool property ("internal/grammar-pool"). */
 405     public static final String XMLGRAMMAR_POOL_PROPERTY = "internal/grammar-pool";
 406 
 407     /** Datatype validator factory ("internal/datatype-validator-factory"). */
 408     public static final String DATATYPE_VALIDATOR_FACTORY_PROPERTY = "internal/datatype-validator-factory";
 409 
 410     /** Document scanner property ("internal/document-scanner"). */
 411     public static final String DOCUMENT_SCANNER_PROPERTY = "internal/document-scanner";
 412 
 413     /** DTD scanner property ("internal/dtd-scanner"). */
 414     public static final String DTD_SCANNER_PROPERTY = "internal/dtd-scanner";
 415 
 416     /** DTD processor property ("internal/dtd-processor"). */
 417     public static final String DTD_PROCESSOR_PROPERTY = "internal/dtd-processor";
 418 
 419     /** Validator property ("internal/validator"). */
 420     public static final String VALIDATOR_PROPERTY = "internal/validator";
 421 
 422     /** Validator property ("internal/validator/dtd"). */
 423     public static final String DTD_VALIDATOR_PROPERTY = "internal/validator/dtd";
 424 
 425     /** Validator property ("internal/validator/schema"). */
 426     public static final String SCHEMA_VALIDATOR_PROPERTY = "internal/validator/schema";
 427 
 428     /** No namespace schema location property ("schema/external-schemaLocation"). */
 429     public static final String SCHEMA_LOCATION = "schema/external-schemaLocation";
 430 
 431     /** Schema location property ("schema/external-noNamespaceSchemaLocation"). */
 432     public static final String SCHEMA_NONS_LOCATION = "schema/external-noNamespaceSchemaLocation";
 433 
 434     /** Namespace binder property ("internal/namespace-binder"). */
 435     public static final String NAMESPACE_BINDER_PROPERTY = "internal/namespace-binder";
 436 
 437     /** Namespace context property ("internal/namespace-context"). */
 438     public static final String NAMESPACE_CONTEXT_PROPERTY = "internal/namespace-context";
 439 
 440     /** Validation manager property ("internal/validation-manager"). */
 441     public static final String VALIDATION_MANAGER_PROPERTY = "internal/validation-manager";
 442 
 443 
 444     /** XPointer Schema property ("xpointer-schema"). */
 445     public static final String XPOINTER_SCHEMA_PROPERTY = "xpointer-schema";
 446 
 447     /** Schema element declaration for the root element in a document ("internal/validation/schema/dv-factory"). */
 448     public static final String SCHEMA_DV_FACTORY_PROPERTY = "internal/validation/schema/dv-factory";
 449 
 450 
 451     // general constants
 452 
 453     /** Element PSVI is stored in augmentations using string "ELEMENT_PSVI" */
 454     public final static String ELEMENT_PSVI = "ELEMENT_PSVI";
 455 
 456     /** Attribute PSVI is stored in augmentations using string "ATTRIBUTE_PSVI" */
 457     public final static String ATTRIBUTE_PSVI = "ATTRIBUTE_PSVI";
 458 
 459     /**
 460      * Boolean indicating whether an attribute is declared in the DTD is stored
 461      * in augmentations using the string "ATTRIBUTE_DECLARED". The absence of this
 462      * augmentation indicates that the attribute was not declared in the DTD.
 463      */
 464     public final static String ATTRIBUTE_DECLARED = "ATTRIBUTE_DECLARED";
 465 
 466         public final static String ENTITY_EXPANSION_LIMIT = "entityExpansionLimit";
 467 
 468         public final static String MAX_OCCUR_LIMIT = "maxOccurLimit";
 469 
 470     /**
 471      * {@link org.w3c.dom.TypeInfo} associated with current element/attribute
 472      * is stored in augmentations using this string as the key.
 473      *
 474      * This will ultimately controls {@link com.sun.org.apache.xerces.internal.parsers.AbstractDOMParser}
 475      * regarding what object the DOM will return from
 476      * {@link org.w3c.dom.Attr#getSchemaTypeInfo()} and
 477      * {@link org.w3c.dom.Element#getSchemaTypeInfo()} and
 478      */
 479     public final static String TYPEINFO = "org.w3c.dom.TypeInfo";
 480 
 481     /**
 482      * Whether an attribute is an id or not is stored in augmentations
 483      * using this string as the key. The value is {@link Boolean#TRUE}
 484      * or {@link Boolean#FALSE}.
 485      *
 486      * This will ultimately controls {@link com.sun.org.apache.xerces.internal.parsers.AbstractDOMParser}
 487      * about whether it will mark an attribute as ID or not.
 488      */
 489     public final static String ID_ATTRIBUTE = "ID_ATTRIBUTE";
 490 
 491     // XML version constants
 492 
 493     /**
 494      * Boolean indicating whether an entity referenced in the document has
 495      * not been read is stored in augmentations using the string "ENTITY_SKIPPED".
 496      * The absence of this augmentation indicates that the entity had a
 497      * declaration and was expanded.
 498      */
 499     public final static String ENTITY_SKIPPED = "ENTITY_SKIPPED";
 500 
 501     /**
 502      * Boolean indicating whether a character is a probable white space
 503      * character (ch <= 0x20) that was the replacement text of a character
 504      * reference is stored in augmentations using the string "CHAR_REF_PROBABLE_WS".
 505      * The absence of this augmentation indicates that the character is not
 506      * probable white space and/or was not included from a character reference.
 507      */
 508     public final static String CHAR_REF_PROBABLE_WS = "CHAR_REF_PROBABLE_WS";
 509 
 510     /** Boolean indicating if this entity is the last opened entity.
 511      *
 512      *@see com.sun.org.apache.xerces.internal.impl.XMLEntityManager#endEntity()
 513      *@see com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl#endEntity()
 514      *@see com.sun.org.apache.xerces.internal.impl.XMLDTDScannerImpl#endEntity()
 515      */
 516     public final static String LAST_ENTITY = "LAST_ENTITY";
 517 
 518     // XML version constants
 519     public final static short XML_VERSION_ERROR = -1;
 520     public final static short XML_VERSION_1_0 = 1;
 521     public final static short XML_VERSION_1_1 = 2;
 522 
 523 
 524 
 525     // DOM related constants
 526     public final static String ANONYMOUS_TYPE_NAMESPACE =
 527         "http://apache.org/xml/xmlschema/1.0/anonymousTypes";
 528 
 529 
 530 
 531     // Constant to enable Schema 1.1 support
 532     public final static boolean SCHEMA_1_1_SUPPORT = false;
 533     public final static short SCHEMA_VERSION_1_0          = 1;
 534     public final static short SCHEMA_VERSION_1_0_EXTENDED = 2;
 535 
 536     // private
 537 
 538     /** SAX features. */
 539     private static final String[] fgSAXFeatures = {
 540             NAMESPACES_FEATURE,
 541             NAMESPACE_PREFIXES_FEATURE,
 542             STRING_INTERNING_FEATURE,
 543             VALIDATION_FEATURE,
 544             EXTERNAL_GENERAL_ENTITIES_FEATURE,
 545             EXTERNAL_PARAMETER_ENTITIES_FEATURE,
 546     };
 547 
 548     /** SAX properties. */
 549     private static final String[] fgSAXProperties = {
 550             DECLARATION_HANDLER_PROPERTY,
 551             LEXICAL_HANDLER_PROPERTY,
 552             DOM_NODE_PROPERTY,
 553             XML_STRING_PROPERTY,
 554     };
 555 
 556     /** Xerces features. */
 557     private static final String[] fgXercesFeatures = {
 558 
 559         SCHEMA_VALIDATION_FEATURE,
 560         SCHEMA_FULL_CHECKING,
 561         DYNAMIC_VALIDATION_FEATURE,
 562         WARN_ON_DUPLICATE_ATTDEF_FEATURE,
 563         WARN_ON_UNDECLARED_ELEMDEF_FEATURE,
 564         ALLOW_JAVA_ENCODINGS_FEATURE,
 565         CONTINUE_AFTER_FATAL_ERROR_FEATURE,
 566         LOAD_DTD_GRAMMAR_FEATURE,
 567         LOAD_EXTERNAL_DTD_FEATURE,
 568         //DEFER_NODE_EXPANSION_FEATURE,
 569         CREATE_ENTITY_REF_NODES_FEATURE,
 570         XINCLUDE_AWARE,
 571         INCLUDE_IGNORABLE_WHITESPACE,
 572         //GRAMMAR_ACCESS_FEATURE,
 573         DEFAULT_ATTRIBUTE_VALUES_FEATURE,
 574         VALIDATE_CONTENT_MODELS_FEATURE,
 575         VALIDATE_DATATYPES_FEATURE,
 576         BALANCE_SYNTAX_TREES,
 577         NOTIFY_CHAR_REFS_FEATURE,
 578         NOTIFY_BUILTIN_REFS_FEATURE,
 579         DISALLOW_DOCTYPE_DECL_FEATURE,
 580         STANDARD_URI_CONFORMANT_FEATURE,
 581         GENERATE_SYNTHETIC_ANNOTATIONS_FEATURE,
 582         VALIDATE_ANNOTATIONS_FEATURE,
 583         HONOUR_ALL_SCHEMALOCATIONS_FEATURE,
 584         XINCLUDE_FEATURE,
 585         XINCLUDE_FIXUP_BASE_URIS_FEATURE,
 586         XINCLUDE_FIXUP_LANGUAGE_FEATURE,
 587         NAMESPACE_GROWTH_FEATURE,
 588         TOLERATE_DUPLICATES_FEATURE,
 589     };
 590 
 591     /** Xerces properties. */
 592     private static final String[] fgXercesProperties = {
 593             CURRENT_ELEMENT_NODE_PROPERTY,
 594             DOCUMENT_CLASS_NAME_PROPERTY,
 595             SYMBOL_TABLE_PROPERTY,
 596             ERROR_HANDLER_PROPERTY,
 597             ERROR_REPORTER_PROPERTY,
 598             ENTITY_MANAGER_PROPERTY,
 599             ENTITY_RESOLVER_PROPERTY,
 600             XMLGRAMMAR_POOL_PROPERTY,
 601             DATATYPE_VALIDATOR_FACTORY_PROPERTY,
 602             DOCUMENT_SCANNER_PROPERTY,
 603             DTD_SCANNER_PROPERTY,
 604             VALIDATOR_PROPERTY,
 605             SCHEMA_LOCATION,
 606             SCHEMA_NONS_LOCATION,
 607             VALIDATION_MANAGER_PROPERTY,
 608             BUFFER_SIZE_PROPERTY,
 609             SECURITY_MANAGER_PROPERTY,
 610             LOCALE_PROPERTY,
 611             SCHEMA_DV_FACTORY_PROPERTY,
 612     };
 613 
 614     /** Empty enumeration. */
 615     private static final Enumeration fgEmptyEnumeration = new ArrayEnumeration(new Object[] {});
 616 
 617     //
 618     // Constructors
 619     //
 620 
 621     /** This class cannot be instantiated. */
 622     private Constants() {}
 623 
 624     //
 625     // Public methods
 626     //
 627 
 628     // sax
 629 
 630     /** Returns an enumeration of the SAX features. */
 631     public static Enumeration getSAXFeatures() {
 632         return fgSAXFeatures.length > 0
 633         ? new ArrayEnumeration(fgSAXFeatures) : fgEmptyEnumeration;
 634     } // getSAXFeatures():Enumeration
 635 
 636     /** Returns an enumeration of the SAX properties. */
 637     public static Enumeration getSAXProperties() {
 638         return fgSAXProperties.length > 0
 639         ? new ArrayEnumeration(fgSAXProperties) : fgEmptyEnumeration;
 640     } // getSAXProperties():Enumeration
 641 
 642     // xerces
 643 
 644     /** Returns an enumeration of the Xerces features. */
 645     public static Enumeration getXercesFeatures() {
 646         return fgXercesFeatures.length > 0
 647         ? new ArrayEnumeration(fgXercesFeatures) : fgEmptyEnumeration;
 648     } // getXercesFeatures():Enumeration
 649 
 650     /** Returns an enumeration of the Xerces properties. */
 651     public static Enumeration getXercesProperties() {
 652         return fgXercesProperties.length > 0
 653         ? new ArrayEnumeration(fgXercesProperties) : fgEmptyEnumeration;
 654     } // getXercesProperties():Enumeration
 655 
 656     //
 657     // Classes
 658     //
 659 
 660     /**
 661      * An array enumeration.
 662      *
 663      * @author Andy Clark, IBM
 664      */
 665     static class ArrayEnumeration
 666     implements Enumeration {
 667 
 668         //
 669         // Data
 670         //
 671 
 672         /** Array. */
 673         private Object[] array;
 674 
 675         /** Index. */
 676         private int index;
 677 
 678         //
 679         // Constructors
 680         //
 681 
 682         /** Constructs an array enumeration. */
 683         public ArrayEnumeration(Object[] array) {
 684             this.array = array;
 685         } // <init>(Object[])
 686 
 687         //
 688         // Enumeration methods
 689         //
 690 
 691         /**
 692          * Tests if this enumeration contains more elements.
 693          *
 694          * @return  <code>true</code> if this enumeration contains more elements;
 695          *          <code>false</code> otherwise.
 696          * @since   JDK1.0
 697          */
 698         public boolean hasMoreElements() {
 699             return index < array.length;
 700         } // hasMoreElement():boolean
 701 
 702         /**
 703          * Returns the next element of this enumeration.
 704          *
 705          * @return     the next element of this enumeration.
 706          * @exception  NoSuchElementException  if no more elements exist.
 707          * @since      JDK1.0
 708          */
 709         public Object nextElement() {
 710             if (index < array.length) {
 711                 return array[index++];
 712             }
 713             throw new NoSuchElementException();
 714         } // nextElement():Object
 715 
 716     } // class ArrayEnumeration
 717 
 718     //
 719     // MAIN
 720     //
 721 
 722     /** Prints all of the constants to standard output. */
 723     public static void main(String[] argv) {
 724 
 725         print("SAX features:", SAX_FEATURE_PREFIX, fgSAXFeatures);
 726         print("SAX properties:", SAX_PROPERTY_PREFIX, fgSAXProperties);
 727         print("Xerces features:", XERCES_FEATURE_PREFIX, fgXercesFeatures);
 728         print("Xerces properties:", XERCES_PROPERTY_PREFIX, fgXercesProperties);
 729 
 730     } // main(String[])
 731 
 732     /** Prints a list of features/properties. */
 733     private static void print(String header, String prefix, Object[] array) {
 734         System.out.print(header);
 735         if (array.length > 0) {
 736             System.out.println();
 737             for (int i = 0; i < array.length; i++) {
 738                 System.out.print("  ");
 739                 System.out.print(prefix);
 740                 System.out.println(array[i]);
 741             }
 742         }
 743         else {
 744             System.out.println(" none.");
 745         }
 746     } // print(String,String,Object[])
 747 
 748 } // class Constants