286N/A/*
286N/A * Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved.
286N/A */
286N/A
286N/A/*
286N/A * Copyright 2005 The Apache Software Foundation.
286N/A *
286N/A * Licensed under the Apache License, Version 2.0 (the "License");
286N/A * you may not use this file except in compliance with the License.
286N/A * You may obtain a copy of the License at
286N/A *
286N/A * http://www.apache.org/licenses/LICENSE-2.0
286N/A *
286N/A * Unless required by applicable law or agreed to in writing, software
286N/A * distributed under the License is distributed on an "AS IS" BASIS,
286N/A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
286N/A * See the License for the specific language governing permissions and
286N/A * limitations under the License.
286N/A */
286N/A
286N/Apackage com.sun.org.apache.xerces.internal.impl;
286N/A
559N/Aimport com.sun.org.apache.xerces.internal.utils.SecuritySupport;
286N/Aimport java.util.Enumeration;
286N/Aimport java.util.NoSuchElementException;
286N/A
286N/A/**
286N/A * Commonly used constants.
286N/A *
286N/A * @xerces.internal
286N/A *
286N/A * @author Andy Clark, IBM
286N/A *
286N/A * @version $Id: Constants.java,v 1.14 2010-11-01 04:39:40 joehw Exp $
286N/A */
286N/Apublic final class Constants {
286N/A
286N/A //
286N/A // Constants
286N/A //
286N/A // Schema Types:
286N/A public static final String NS_XMLSCHEMA = "http://www.w3.org/2001/XMLSchema".intern();
286N/A public static final String NS_DTD = "http://www.w3.org/TR/REC-xml".intern();
286N/A
286N/A // Schema features
286N/A public static final String SUN_SCHEMA_FEATURE_PREFIX = "http://java.sun.com/xml/schema/features/";
286N/A public static final String SUN_REPORT_IGNORED_ELEMENT_CONTENT_WHITESPACE = "report-ignored-element-content-whitespace";
286N/A
286N/A //stax properties
286N/A
286N/A public static final String ZEPHYR_PROPERTY_PREFIX = "http://java.sun.com/xml/stream/properties/" ;
286N/A public static final String STAX_PROPERTIES = "stax-properties" ;
286N/A public static final String STAX_ENTITY_RESOLVER_PROPERTY = "internal/stax-entity-resolver";
286N/A public static final String STAX_REPORT_CDATA_EVENT = "report-cdata-event";
286N/A public static final String READER_IN_DEFINED_STATE = ZEPHYR_PROPERTY_PREFIX + "reader-in-defined-state" ;
286N/A public static final String ADD_NAMESPACE_DECL_AS_ATTRIBUTE = "add-namespacedecl-as-attrbiute";
286N/A public static final String ESCAPE_CHARACTERS = "escapeCharacters";
286N/A public static final String REUSE_INSTANCE = "reuse-instance" ;
286N/A
286N/A //DOM properties
286N/A public static final String SUN_DOM_PROPERTY_PREFIX = "http://java.sun.com/xml/dom/properties/" ;
286N/A public static final String SUN_DOM_ANCESTOR_CHECCK = "ancestor-check";
286N/A
286N/A /**
286N/A * If true, ignore DOCTYPE declaration as if it wasn't present at all.
286N/A * Note that this is a violation of the XML recommendation.
286N/A * The full property name is prefixed by {@link #ZEPHYR_PROPERTY_PREFIX}.
286N/A */
286N/A public static final String IGNORE_EXTERNAL_DTD = "ignore-external-dtd";
286N/A
286N/A // sax features
286N/A
286N/A /** SAX feature prefix ("http://xml.org/sax/features/"). */
286N/A public static final String SAX_FEATURE_PREFIX = "http://xml.org/sax/features/";
286N/A
286N/A public static final String NAMESPACES_FEATURE = "namespaces";
286N/A
286N/A /** Namespace prefixes feature ("namespace-prefixes"). */
286N/A public static final String NAMESPACE_PREFIXES_FEATURE = "namespace-prefixes";
286N/A
286N/A /** String interning feature ("string-interning"). */
286N/A public static final String STRING_INTERNING_FEATURE = "string-interning";
286N/A
286N/A /** Validation feature ("validation"). */
286N/A public static final String VALIDATION_FEATURE = "validation";
286N/A
286N/A /** External general entities feature ("external-general-entities "). */
286N/A public static final String EXTERNAL_GENERAL_ENTITIES_FEATURE = "external-general-entities";
286N/A
286N/A /** External parameter entities feature ("external-parameter-entities "). */
286N/A public static final String EXTERNAL_PARAMETER_ENTITIES_FEATURE = "external-parameter-entities";
286N/A
286N/A /** Lexical handler parameter entities feature ("lexical-handler/parameter-entities"). */
286N/A public static final String LEXICAL_HANDLER_PARAMETER_ENTITIES_FEATURE = "lexical-handler/parameter-entities";
286N/A
286N/A /** Is standalone feature ("is-standalone"). */
286N/A public static final String IS_STANDALONE_FEATURE = "is-standalone";
286N/A
286N/A /** Resolve DTD URIs feature ("resolve-dtd-uris"). */
286N/A public static final String RESOLVE_DTD_URIS_FEATURE = "resolve-dtd-uris";
286N/A
286N/A /** Use Attributes2 feature ("use-attributes2"). */
286N/A public static final String USE_ATTRIBUTES2_FEATURE = "use-attributes2";
286N/A
286N/A /** Use Locator2 feature ("use-locator2"). */
286N/A public static final String USE_LOCATOR2_FEATURE = "use-locator2";
286N/A
286N/A /** Use EntityResolver2 feature ("use-entity-resolver2"). */
286N/A public static final String USE_ENTITY_RESOLVER2_FEATURE = "use-entity-resolver2";
286N/A
286N/A /** Unicode normalization checking feature ("unicode-normalization-checking"). */
286N/A public static final String UNICODE_NORMALIZATION_CHECKING_FEATURE = "unicode-normalization-checking";
286N/A
286N/A /** xmlns URIs feature ("xmlns-uris"). */
286N/A public static final String XMLNS_URIS_FEATURE = "xmlns-uris";
286N/A
286N/A /** XML 1.1 feature ("xml-1.1"). */
286N/A public static final String XML_11_FEATURE = "xml-1.1";
286N/A
286N/A /** Allow unparsed entity and notation declaration events to be sent after the end DTD event ("allow-dtd-events-after-endDTD") */
286N/A public static final String ALLOW_DTD_EVENTS_AFTER_ENDDTD_FEATURE = "allow-dtd-events-after-endDTD";
286N/A
286N/A // sax properties
286N/A
286N/A /** SAX property prefix ("http://xml.org/sax/properties/"). */
286N/A public static final String SAX_PROPERTY_PREFIX = "http://xml.org/sax/properties/";
286N/A
286N/A /** Declaration handler property ("declaration-handler"). */
286N/A public static final String DECLARATION_HANDLER_PROPERTY = "declaration-handler";
286N/A
286N/A /** Lexical handler property ("lexical-handler"). */
286N/A public static final String LEXICAL_HANDLER_PROPERTY = "lexical-handler";
286N/A
286N/A /** DOM node property ("dom-node"). */
286N/A public static final String DOM_NODE_PROPERTY = "dom-node";
286N/A
286N/A /** XML string property ("xml-string"). */
286N/A public static final String XML_STRING_PROPERTY = "xml-string";
286N/A
286N/A public static final String FEATURE_SECURE_PROCESSING = "http://javax.xml.XMLConstants/feature/secure-processing";
286N/A
559N/A // Oracle Feature:
559N/A /**
559N/A * <p>Use Service Mechanism</p>
559N/A *
559N/A * <ul>
559N/A * <li>
559N/A * {@code true} instruct an object to use service mechanism to
559N/A * find a service implementation. This is the default behavior.
559N/A * </li>
559N/A * <li>
559N/A * {@code false} instruct an object to skip service mechanism and
559N/A * use the default implementation for that service.
559N/A * </li>
559N/A * </ul>
559N/A */
286N/A public static final String ORACLE_FEATURE_SERVICE_MECHANISM = "http://www.oracle.com/feature/use-service-mechanism";
286N/A
286N/A /** Document XML version property ("document-xml-version"). */
286N/A public static final String DOCUMENT_XML_VERSION_PROPERTY = "document-xml-version";
286N/A
286N/A
286N/A //
286N/A // JAXP properties
286N/A //
286N/A
286N/A /** JAXP property prefix ("http://java.sun.com/xml/jaxp/properties/"). */
286N/A public static final String JAXP_PROPERTY_PREFIX =
286N/A "http://java.sun.com/xml/jaxp/properties/";
286N/A
286N/A /** JAXP schemaSource property: when used internally may include DTD sources (DOM) */
286N/A public static final String SCHEMA_SOURCE = "schemaSource";
286N/A
286N/A /** JAXP schemaSource language: when used internally may include DTD namespace (DOM) */
286N/A public static final String SCHEMA_LANGUAGE = "schemaLanguage";
286N/A
286N/A public static final String SYSTEM_PROPERTY_ELEMENT_ATTRIBUTE_LIMIT = "elementAttributeLimit" ;
286N/A
559N/A /** JAXP Standard property prefix ("http://javax.xml.XMLConstants/property/"). */
559N/A public static final String JAXPAPI_PROPERTY_PREFIX =
559N/A "http://javax.xml.XMLConstants/property/";
559N/A
559N/A /** Oracle JAXP property prefix ("http://www.oracle.com/xml/jaxp/properties/"). */
559N/A public static final String ORACLE_JAXP_PROPERTY_PREFIX =
559N/A "http://www.oracle.com/xml/jaxp/properties/";
559N/A
559N/A //System Properties corresponding to ACCESS_EXTERNAL_* properties
559N/A public static final String SP_ACCESS_EXTERNAL_DTD = "javax.xml.accessExternalDTD";
559N/A public static final String SP_ACCESS_EXTERNAL_SCHEMA = "javax.xml.accessExternalSchema";
559N/A //all access keyword
559N/A public static final String ACCESS_EXTERNAL_ALL = "all";
559N/A
559N/A /**
559N/A * Default value when FEATURE_SECURE_PROCESSING (FSP) is set to true
559N/A */
559N/A public static final String EXTERNAL_ACCESS_DEFAULT_FSP = "";
559N/A /**
559N/A * JDK version by which the default is to restrict external connection
559N/A */
559N/A public static final int RESTRICT_BY_DEFAULT_JDK_VERSION = 8;
559N/A
559N/A /**
559N/A * FEATURE_SECURE_PROCESSING (FSP) is true by default
559N/A */
559N/A public static final String EXTERNAL_ACCESS_DEFAULT = getExternalAccessDefault(true);
559N/A
286N/A //
286N/A // DOM features
286N/A //
286N/A
286N/A /** Comments feature ("include-comments"). */
286N/A public static final String INCLUDE_COMMENTS_FEATURE = "include-comments";
286N/A
286N/A /** Create cdata nodes feature ("create-cdata-nodes"). */
286N/A public static final String CREATE_CDATA_NODES_FEATURE = "create-cdata-nodes";
286N/A
286N/A /** Feature id: load as infoset. */
286N/A public static final String LOAD_AS_INFOSET = "load-as-infoset";
286N/A
286N/A
286N/A //
286N/A // Constants: DOM Level 3 feature ids
286N/A //
286N/A
286N/A public static final String DOM_CANONICAL_FORM = "canonical-form";
286N/A public static final String DOM_CDATA_SECTIONS ="cdata-sections";
286N/A
286N/A public static final String DOM_COMMENTS = "comments";
286N/A
286N/A // REVISIT: this feature seems to have no effect for Xerces
286N/A
286N/A public static final String DOM_CHARSET_OVERRIDES_XML_ENCODING =
286N/A "charset-overrides-xml-encoding";
286N/A
286N/A public static final String DOM_DATATYPE_NORMALIZATION = "datatype-normalization";
286N/A
286N/A public static final String DOM_ENTITIES = "entities";
286N/A public static final String DOM_INFOSET = "infoset";
286N/A public static final String DOM_NAMESPACES = "namespaces";
286N/A public static final String DOM_NAMESPACE_DECLARATIONS = "namespace-declarations";
286N/A public static final String DOM_SUPPORTED_MEDIATYPES_ONLY =
286N/A "supported-media-types-only";
286N/A
286N/A public static final String DOM_VALIDATE_IF_SCHEMA = "validate-if-schema";
286N/A public static final String DOM_VALIDATE = "validate";
286N/A public static final String DOM_ELEMENT_CONTENT_WHITESPACE =
286N/A "element-content-whitespace";
286N/A
286N/A // DOM Level 3 features defined in Core:
286N/A public static final String DOM_DISCARD_DEFAULT_CONTENT = "discard-default-content";
286N/A public static final String DOM_NORMALIZE_CHARACTERS = "normalize-characters";
286N/A public static final String DOM_CHECK_CHAR_NORMALIZATION = "check-character-normalization";
286N/A public static final String DOM_WELLFORMED = "well-formed";
286N/A public static final String DOM_SPLIT_CDATA = "split-cdata-sections";
286N/A
286N/A // Load and Save
286N/A public static final String DOM_FORMAT_PRETTY_PRINT = "format-pretty-print";
286N/A public static final String DOM_XMLDECL = "xml-declaration";
286N/A public static final String DOM_UNKNOWNCHARS = "unknown-characters";
286N/A public static final String DOM_CERTIFIED = "certified";
286N/A public static final String DOM_DISALLOW_DOCTYPE = "disallow-doctype";
286N/A public static final String DOM_IGNORE_UNKNOWN_CHARACTER_DENORMALIZATIONS = "ignore-unknown-character-denormalizations";
286N/A
286N/A // DOM Properties
286N/A public static final String DOM_RESOURCE_RESOLVER = "resource-resolver";
286N/A public static final String DOM_ERROR_HANDLER = "error-handler";
286N/A public static final String DOM_SCHEMA_TYPE = "schema-type";
286N/A public static final String DOM_SCHEMA_LOCATION = "schema-location";
286N/A public static final String DOM_ANCESTOR_CHECCK = "ancestor-check";
286N/A // XSModel
286N/A public static final String DOM_PSVI = "psvi";
286N/A
286N/A
286N/A // xerces features
286N/A
286N/A /** Xerces features prefix ("http://apache.org/xml/features/"). */
286N/A public static final String XERCES_FEATURE_PREFIX = "http://apache.org/xml/features/";
286N/A
286N/A /** Schema validation feature ("validation/schema"). */
286N/A public static final String SCHEMA_VALIDATION_FEATURE = "validation/schema";
286N/A
286N/A /** Expose schema normalized values */
286N/A public static final String SCHEMA_NORMALIZED_VALUE = "validation/schema/normalized-value";
286N/A
286N/A /** Send schema default value via characters() */
286N/A public static final String SCHEMA_ELEMENT_DEFAULT = "validation/schema/element-default";
286N/A
286N/A /** Schema full constraint checking ("validation/schema-full-checking"). */
286N/A public static final String SCHEMA_FULL_CHECKING = "validation/schema-full-checking";
286N/A
286N/A /** Augment Post-Schema-Validation-Infoset */
286N/A public static final String SCHEMA_AUGMENT_PSVI = "validation/schema/augment-psvi";
286N/A
286N/A /** Dynamic validation feature ("validation/dynamic"). */
286N/A public static final String DYNAMIC_VALIDATION_FEATURE = "validation/dynamic";
286N/A
286N/A /** Warn on duplicate attribute declaration feature ("validation/warn-on-duplicate-attdef"). */
286N/A public static final String WARN_ON_DUPLICATE_ATTDEF_FEATURE = "validation/warn-on-duplicate-attdef";
286N/A
286N/A /** Warn on undeclared element feature ("validation/warn-on-undeclared-elemdef"). */
286N/A public static final String WARN_ON_UNDECLARED_ELEMDEF_FEATURE = "validation/warn-on-undeclared-elemdef";
286N/A
286N/A /** Warn on duplicate entity declaration feature ("warn-on-duplicate-entitydef"). */
286N/A public static final String WARN_ON_DUPLICATE_ENTITYDEF_FEATURE = "warn-on-duplicate-entitydef";
286N/A
286N/A /** Allow Java encoding names feature ("allow-java-encodings"). */
286N/A public static final String ALLOW_JAVA_ENCODINGS_FEATURE = "allow-java-encodings";
286N/A
286N/A /** Disallow DOCTYPE declaration feature ("disallow-doctype-decl"). */
286N/A public static final String DISALLOW_DOCTYPE_DECL_FEATURE = "disallow-doctype-decl";
286N/A
286N/A /** Continue after fatal error feature ("continue-after-fatal-error"). */
286N/A public static final String CONTINUE_AFTER_FATAL_ERROR_FEATURE = "continue-after-fatal-error";
286N/A
286N/A /** Load dtd grammar when nonvalidating feature ("nonvalidating/load-dtd-grammar"). */
286N/A public static final String LOAD_DTD_GRAMMAR_FEATURE = "nonvalidating/load-dtd-grammar";
286N/A
286N/A /** Load external dtd when nonvalidating feature ("nonvalidating/load-external-dtd"). */
286N/A public static final String LOAD_EXTERNAL_DTD_FEATURE = "nonvalidating/load-external-dtd";
286N/A
286N/A /** Defer node expansion feature ("dom/defer-node-expansion"). */
286N/A public static final String DEFER_NODE_EXPANSION_FEATURE = "dom/defer-node-expansion";
286N/A
286N/A /** Create entity reference nodes feature ("dom/create-entity-ref-nodes"). */
286N/A public static final String CREATE_ENTITY_REF_NODES_FEATURE = "dom/create-entity-ref-nodes";
286N/A
286N/A /** Include ignorable whitespace feature ("dom/include-ignorable-whitespace"). */
286N/A public static final String INCLUDE_IGNORABLE_WHITESPACE = "dom/include-ignorable-whitespace";
286N/A
286N/A /** Default attribute values feature ("validation/default-attribute-values"). */
286N/A public static final String DEFAULT_ATTRIBUTE_VALUES_FEATURE = "validation/default-attribute-values";
286N/A
286N/A /** Validate content models feature ("validation/validate-content-models"). */
286N/A public static final String VALIDATE_CONTENT_MODELS_FEATURE = "validation/validate-content-models";
286N/A
286N/A /** Validate datatypes feature ("validation/validate-datatypes"). */
286N/A public static final String VALIDATE_DATATYPES_FEATURE = "validation/validate-datatypes";
286N/A
286N/A /** Balance syntax trees feature ("validation/balance-syntax-trees"). */
286N/A public static final String BALANCE_SYNTAX_TREES = "validation/balance-syntax-trees";
286N/A
286N/A /** Notify character references feature (scanner/notify-char-refs"). */
286N/A public static final String NOTIFY_CHAR_REFS_FEATURE = "scanner/notify-char-refs";
286N/A
286N/A /** Notify built-in (&amp;amp;, etc.) references feature (scanner/notify-builtin-refs"). */
286N/A public static final String NOTIFY_BUILTIN_REFS_FEATURE = "scanner/notify-builtin-refs";
286N/A
286N/A /** Standard URI conformant feature ("standard-uri-conformant"). */
286N/A public static final String STANDARD_URI_CONFORMANT_FEATURE = "standard-uri-conformant";
286N/A
286N/A /** Generate synthetic annotations feature ("generate-synthetic-annotations"). */
286N/A public static final String GENERATE_SYNTHETIC_ANNOTATIONS_FEATURE = "generate-synthetic-annotations";
286N/A
286N/A /** Validate annotations feature ("validate-annotations"). */
286N/A public static final String VALIDATE_ANNOTATIONS_FEATURE = "validate-annotations";
286N/A
286N/A
286N/A /** Honour all schemaLocations feature ("honour-all-schemaLocations"). */
286N/A public static final String HONOUR_ALL_SCHEMALOCATIONS_FEATURE = "honour-all-schemaLocations";
286N/A
286N/A /** Namespace growth feature ("namespace-growth"). */
286N/A public static final String NAMESPACE_GROWTH_FEATURE = "namespace-growth";
286N/A
286N/A /** Tolerate duplicates feature ("internal/tolerate-duplicates"). */
286N/A public static final String TOLERATE_DUPLICATES_FEATURE = "internal/tolerate-duplicates";
286N/A
286N/A /** XInclude processing feature ("xinclude"). */
286N/A public static final String XINCLUDE_FEATURE = "xinclude";
286N/A
286N/A /** XInclude fixup base URIs feature ("xinclude/fixup-base-uris"). */
286N/A public static final String XINCLUDE_FIXUP_BASE_URIS_FEATURE = "xinclude/fixup-base-uris";
286N/A
286N/A /** XInclude fixup language feature ("xinclude/fixup-language"). */
286N/A public static final String XINCLUDE_FIXUP_LANGUAGE_FEATURE = "xinclude/fixup-language";
286N/A
286N/A /**
286N/A * Internal feature. When set to true the schema validator will only use
286N/A * schema components from the grammar pool provided.
286N/A */
286N/A public static final String USE_GRAMMAR_POOL_ONLY_FEATURE = "internal/validation/schema/use-grammar-pool-only";
286N/A
286N/A /** Internal performance related feature:
286N/A * false - the parser settings (features/properties) have not changed between 2 parses
286N/A * true - the parser settings have changed between 2 parses
286N/A * NOTE: this feature should only be set by the parser configuration.
286N/A */
286N/A public static final String PARSER_SETTINGS = "internal/parser-settings";
286N/A
286N/A
286N/A /** Feature to make XML Processor XInclude Aware */
286N/A public static final String XINCLUDE_AWARE = "xinclude-aware";
286N/A
286N/A /** Ignore xsi:schemaLocation and xsi:noNamespaceSchemaLocation. */
286N/A public static final String IGNORE_SCHEMA_LOCATION_HINTS = "validation/schema/ignore-schema-location-hints";
286N/A
286N/A /**
286N/A * When true, the schema processor will change characters events
286N/A * to ignorableWhitespaces events, when characters are expected to
286N/A * only contain ignorable whitespaces.
286N/A */
286N/A public static final String CHANGE_IGNORABLE_CHARACTERS_INTO_IGNORABLE_WHITESPACES =
286N/A "validation/change-ignorable-characters-into-ignorable-whitespaces";
286N/A
286N/A // xerces properties
286N/A
286N/A /** Xerces properties prefix ("http://apache.org/xml/properties/"). */
286N/A public static final String XERCES_PROPERTY_PREFIX = "http://apache.org/xml/properties/";
286N/A
286N/A /** Current element node property ("dom/current-element-node"). */
286N/A public static final String CURRENT_ELEMENT_NODE_PROPERTY = "dom/current-element-node";
286N/A
286N/A /** Document class name property ("dom/document-class-name"). */
286N/A public static final String DOCUMENT_CLASS_NAME_PROPERTY = "dom/document-class-name";
286N/A
286N/A /** Symbol table property ("internal/symbol-table"). */
286N/A public static final String SYMBOL_TABLE_PROPERTY = "internal/symbol-table";
286N/A
286N/A /** Error reporter property ("internal/error-reporter"). */
286N/A public static final String ERROR_REPORTER_PROPERTY = "internal/error-reporter";
286N/A
286N/A /** Error handler property ("internal/error-handler"). */
286N/A public static final String ERROR_HANDLER_PROPERTY = "internal/error-handler";
286N/A
286N/A /** XInclude handler property ("internal/xinclude-handler"). */
286N/A public static final String XINCLUDE_HANDLER_PROPERTY = "internal/xinclude-handler";
286N/A
286N/A /** XPointer handler property ("internal/xpointer-handler"). */
286N/A public static final String XPOINTER_HANDLER_PROPERTY = "internal/xpointer-handler";
286N/A
286N/A /** Entity manager property ("internal/entity-manager"). */
286N/A public static final String ENTITY_MANAGER_PROPERTY = "internal/entity-manager";
286N/A /** Input buffer size property ("input-buffer-size"). */
286N/A public static final String BUFFER_SIZE_PROPERTY = "input-buffer-size";
286N/A
286N/A /** Security manager property ("security-manager"). */
286N/A public static final String SECURITY_MANAGER_PROPERTY = "security-manager";
286N/A
286N/A /** Locale property ("locale"). */
286N/A public static final String LOCALE_PROPERTY = "locale";
286N/A
286N/A /** property identifier: security manager. */
286N/A protected static final String SECURITY_MANAGER =
286N/A Constants.XERCES_PROPERTY_PREFIX + Constants.SECURITY_MANAGER_PROPERTY;
286N/A
286N/A
286N/A public static final String ENTITY_RESOLVER_PROPERTY = "internal/entity-resolver";
286N/A
286N/A /** Grammar pool property ("internal/grammar-pool"). */
286N/A public static final String XMLGRAMMAR_POOL_PROPERTY = "internal/grammar-pool";
286N/A
286N/A /** Datatype validator factory ("internal/datatype-validator-factory"). */
286N/A public static final String DATATYPE_VALIDATOR_FACTORY_PROPERTY = "internal/datatype-validator-factory";
286N/A
286N/A /** Document scanner property ("internal/document-scanner"). */
286N/A public static final String DOCUMENT_SCANNER_PROPERTY = "internal/document-scanner";
286N/A
286N/A /** DTD scanner property ("internal/dtd-scanner"). */
286N/A public static final String DTD_SCANNER_PROPERTY = "internal/dtd-scanner";
286N/A
286N/A /** DTD processor property ("internal/dtd-processor"). */
286N/A public static final String DTD_PROCESSOR_PROPERTY = "internal/dtd-processor";
286N/A
286N/A /** Validator property ("internal/validator"). */
286N/A public static final String VALIDATOR_PROPERTY = "internal/validator";
286N/A
286N/A /** Validator property ("internal/validator/dtd"). */
286N/A public static final String DTD_VALIDATOR_PROPERTY = "internal/validator/dtd";
286N/A
286N/A /** Validator property ("internal/validator/schema"). */
286N/A public static final String SCHEMA_VALIDATOR_PROPERTY = "internal/validator/schema";
286N/A
286N/A /** No namespace schema location property ("schema/external-schemaLocation"). */
286N/A public static final String SCHEMA_LOCATION = "schema/external-schemaLocation";
286N/A
286N/A /** Schema location property ("schema/external-noNamespaceSchemaLocation"). */
286N/A public static final String SCHEMA_NONS_LOCATION = "schema/external-noNamespaceSchemaLocation";
286N/A
286N/A /** Namespace binder property ("internal/namespace-binder"). */
286N/A public static final String NAMESPACE_BINDER_PROPERTY = "internal/namespace-binder";
286N/A
286N/A /** Namespace context property ("internal/namespace-context"). */
286N/A public static final String NAMESPACE_CONTEXT_PROPERTY = "internal/namespace-context";
286N/A
286N/A /** Validation manager property ("internal/validation-manager"). */
286N/A public static final String VALIDATION_MANAGER_PROPERTY = "internal/validation-manager";
286N/A
286N/A
286N/A /** XPointer Schema property ("xpointer-schema"). */
286N/A public static final String XPOINTER_SCHEMA_PROPERTY = "xpointer-schema";
286N/A
286N/A /** Schema element declaration for the root element in a document ("internal/validation/schema/dv-factory"). */
286N/A public static final String SCHEMA_DV_FACTORY_PROPERTY = "internal/validation/schema/dv-factory";
286N/A
286N/A
286N/A // general constants
286N/A
286N/A /** Element PSVI is stored in augmentations using string "ELEMENT_PSVI" */
286N/A public final static String ELEMENT_PSVI = "ELEMENT_PSVI";
286N/A
286N/A /** Attribute PSVI is stored in augmentations using string "ATTRIBUTE_PSVI" */
286N/A public final static String ATTRIBUTE_PSVI = "ATTRIBUTE_PSVI";
286N/A
286N/A /**
286N/A * Boolean indicating whether an attribute is declared in the DTD is stored
286N/A * in augmentations using the string "ATTRIBUTE_DECLARED". The absence of this
286N/A * augmentation indicates that the attribute was not declared in the DTD.
286N/A */
286N/A public final static String ATTRIBUTE_DECLARED = "ATTRIBUTE_DECLARED";
286N/A
286N/A public final static String ENTITY_EXPANSION_LIMIT = "entityExpansionLimit";
286N/A
286N/A public final static String MAX_OCCUR_LIMIT = "maxOccurLimit";
286N/A
286N/A /**
286N/A * {@link org.w3c.dom.TypeInfo} associated with current element/attribute
286N/A * is stored in augmentations using this string as the key.
286N/A *
286N/A * This will ultimately controls {@link com.sun.org.apache.xerces.internal.parsers.AbstractDOMParser}
286N/A * regarding what object the DOM will return from
286N/A * {@link org.w3c.dom.Attr#getSchemaTypeInfo()} and
286N/A * {@link org.w3c.dom.Element#getSchemaTypeInfo()} and
286N/A */
286N/A public final static String TYPEINFO = "org.w3c.dom.TypeInfo";
286N/A
286N/A /**
286N/A * Whether an attribute is an id or not is stored in augmentations
286N/A * using this string as the key. The value is {@link Boolean#TRUE}
286N/A * or {@link Boolean#FALSE}.
286N/A *
286N/A * This will ultimately controls {@link com.sun.org.apache.xerces.internal.parsers.AbstractDOMParser}
286N/A * about whether it will mark an attribute as ID or not.
286N/A */
286N/A public final static String ID_ATTRIBUTE = "ID_ATTRIBUTE";
286N/A
286N/A // XML version constants
286N/A
286N/A /**
286N/A * Boolean indicating whether an entity referenced in the document has
286N/A * not been read is stored in augmentations using the string "ENTITY_SKIPPED".
286N/A * The absence of this augmentation indicates that the entity had a
286N/A * declaration and was expanded.
286N/A */
286N/A public final static String ENTITY_SKIPPED = "ENTITY_SKIPPED";
286N/A
286N/A /**
286N/A * Boolean indicating whether a character is a probable white space
286N/A * character (ch <= 0x20) that was the replacement text of a character
286N/A * reference is stored in augmentations using the string "CHAR_REF_PROBABLE_WS".
286N/A * The absence of this augmentation indicates that the character is not
286N/A * probable white space and/or was not included from a character reference.
286N/A */
286N/A public final static String CHAR_REF_PROBABLE_WS = "CHAR_REF_PROBABLE_WS";
286N/A
286N/A /** Boolean indicating if this entity is the last opened entity.
286N/A *
286N/A *@see com.sun.org.apache.xerces.internal.impl.XMLEntityManager#endEntity()
286N/A *@see com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl#endEntity()
286N/A *@see com.sun.org.apache.xerces.internal.impl.XMLDTDScannerImpl#endEntity()
286N/A */
286N/A public final static String LAST_ENTITY = "LAST_ENTITY";
286N/A
286N/A // XML version constants
286N/A public final static short XML_VERSION_ERROR = -1;
286N/A public final static short XML_VERSION_1_0 = 1;
286N/A public final static short XML_VERSION_1_1 = 2;
286N/A
286N/A
286N/A
286N/A // DOM related constants
286N/A public final static String ANONYMOUS_TYPE_NAMESPACE =
286N/A "http://apache.org/xml/xmlschema/1.0/anonymousTypes";
286N/A
286N/A
286N/A
286N/A // Constant to enable Schema 1.1 support
286N/A public final static boolean SCHEMA_1_1_SUPPORT = false;
286N/A public final static short SCHEMA_VERSION_1_0 = 1;
286N/A public final static short SCHEMA_VERSION_1_0_EXTENDED = 2;
286N/A
286N/A // private
286N/A
286N/A /** SAX features. */
286N/A private static final String[] fgSAXFeatures = {
286N/A NAMESPACES_FEATURE,
286N/A NAMESPACE_PREFIXES_FEATURE,
286N/A STRING_INTERNING_FEATURE,
286N/A VALIDATION_FEATURE,
286N/A EXTERNAL_GENERAL_ENTITIES_FEATURE,
286N/A EXTERNAL_PARAMETER_ENTITIES_FEATURE,
286N/A };
286N/A
286N/A /** SAX properties. */
286N/A private static final String[] fgSAXProperties = {
286N/A DECLARATION_HANDLER_PROPERTY,
286N/A LEXICAL_HANDLER_PROPERTY,
286N/A DOM_NODE_PROPERTY,
286N/A XML_STRING_PROPERTY,
286N/A };
286N/A
286N/A /** Xerces features. */
286N/A private static final String[] fgXercesFeatures = {
286N/A
286N/A SCHEMA_VALIDATION_FEATURE,
286N/A SCHEMA_FULL_CHECKING,
286N/A DYNAMIC_VALIDATION_FEATURE,
286N/A WARN_ON_DUPLICATE_ATTDEF_FEATURE,
286N/A WARN_ON_UNDECLARED_ELEMDEF_FEATURE,
286N/A ALLOW_JAVA_ENCODINGS_FEATURE,
286N/A CONTINUE_AFTER_FATAL_ERROR_FEATURE,
286N/A LOAD_DTD_GRAMMAR_FEATURE,
286N/A LOAD_EXTERNAL_DTD_FEATURE,
286N/A //DEFER_NODE_EXPANSION_FEATURE,
286N/A CREATE_ENTITY_REF_NODES_FEATURE,
286N/A XINCLUDE_AWARE,
286N/A INCLUDE_IGNORABLE_WHITESPACE,
286N/A //GRAMMAR_ACCESS_FEATURE,
286N/A DEFAULT_ATTRIBUTE_VALUES_FEATURE,
286N/A VALIDATE_CONTENT_MODELS_FEATURE,
286N/A VALIDATE_DATATYPES_FEATURE,
286N/A BALANCE_SYNTAX_TREES,
286N/A NOTIFY_CHAR_REFS_FEATURE,
286N/A NOTIFY_BUILTIN_REFS_FEATURE,
286N/A DISALLOW_DOCTYPE_DECL_FEATURE,
286N/A STANDARD_URI_CONFORMANT_FEATURE,
286N/A GENERATE_SYNTHETIC_ANNOTATIONS_FEATURE,
286N/A VALIDATE_ANNOTATIONS_FEATURE,
286N/A HONOUR_ALL_SCHEMALOCATIONS_FEATURE,
286N/A XINCLUDE_FEATURE,
286N/A XINCLUDE_FIXUP_BASE_URIS_FEATURE,
286N/A XINCLUDE_FIXUP_LANGUAGE_FEATURE,
286N/A NAMESPACE_GROWTH_FEATURE,
286N/A TOLERATE_DUPLICATES_FEATURE,
286N/A };
286N/A
286N/A /** Xerces properties. */
286N/A private static final String[] fgXercesProperties = {
286N/A CURRENT_ELEMENT_NODE_PROPERTY,
286N/A DOCUMENT_CLASS_NAME_PROPERTY,
286N/A SYMBOL_TABLE_PROPERTY,
286N/A ERROR_HANDLER_PROPERTY,
286N/A ERROR_REPORTER_PROPERTY,
286N/A ENTITY_MANAGER_PROPERTY,
286N/A ENTITY_RESOLVER_PROPERTY,
286N/A XMLGRAMMAR_POOL_PROPERTY,
286N/A DATATYPE_VALIDATOR_FACTORY_PROPERTY,
286N/A DOCUMENT_SCANNER_PROPERTY,
286N/A DTD_SCANNER_PROPERTY,
286N/A VALIDATOR_PROPERTY,
286N/A SCHEMA_LOCATION,
286N/A SCHEMA_NONS_LOCATION,
286N/A VALIDATION_MANAGER_PROPERTY,
286N/A BUFFER_SIZE_PROPERTY,
286N/A SECURITY_MANAGER_PROPERTY,
286N/A LOCALE_PROPERTY,
286N/A SCHEMA_DV_FACTORY_PROPERTY,
286N/A };
286N/A
286N/A /** Empty enumeration. */
286N/A private static final Enumeration fgEmptyEnumeration = new ArrayEnumeration(new Object[] {});
286N/A
286N/A //
286N/A // Constructors
286N/A //
286N/A
286N/A /** This class cannot be instantiated. */
286N/A private Constants() {}
286N/A
286N/A //
286N/A // Public methods
286N/A //
286N/A
286N/A // sax
286N/A
286N/A /** Returns an enumeration of the SAX features. */
286N/A public static Enumeration getSAXFeatures() {
286N/A return fgSAXFeatures.length > 0
286N/A ? new ArrayEnumeration(fgSAXFeatures) : fgEmptyEnumeration;
286N/A } // getSAXFeatures():Enumeration
286N/A
286N/A /** Returns an enumeration of the SAX properties. */
286N/A public static Enumeration getSAXProperties() {
286N/A return fgSAXProperties.length > 0
286N/A ? new ArrayEnumeration(fgSAXProperties) : fgEmptyEnumeration;
286N/A } // getSAXProperties():Enumeration
286N/A
286N/A // xerces
286N/A
286N/A /** Returns an enumeration of the Xerces features. */
286N/A public static Enumeration getXercesFeatures() {
286N/A return fgXercesFeatures.length > 0
286N/A ? new ArrayEnumeration(fgXercesFeatures) : fgEmptyEnumeration;
286N/A } // getXercesFeatures():Enumeration
286N/A
286N/A /** Returns an enumeration of the Xerces properties. */
286N/A public static Enumeration getXercesProperties() {
286N/A return fgXercesProperties.length > 0
286N/A ? new ArrayEnumeration(fgXercesProperties) : fgEmptyEnumeration;
286N/A } // getXercesProperties():Enumeration
286N/A
559N/A /**
559N/A * Determine the default value of the external access properties
559N/A *
559N/A * jaxp 1.5 does not require implementations to restrict by default
559N/A *
559N/A * For JDK8:
559N/A * The default value is 'file' (including jar:file); The keyword "all" grants permission
559N/A * to all protocols. When {@link javax.xml.XMLConstants#FEATURE_SECURE_PROCESSING} is on,
559N/A * the default value is an empty string indicating no access is allowed.
559N/A *
559N/A * For JDK7:
559N/A * The default value is 'all' granting permission to all protocols. If by default,
559N/A * {@link javax.xml.XMLConstants#FEATURE_SECURE_PROCESSING} is true, it should
559N/A * not change the default value. However, if {@link javax.xml.XMLConstants#FEATURE_SECURE_PROCESSING}
559N/A * is set explicitly, the values of the properties shall be set to an empty string
559N/A * indicating no access is allowed.
559N/A *
559N/A * @param isSecureProcessing indicating if Secure Processing is set
559N/A * @return default value
559N/A */
559N/A public static String getExternalAccessDefault(boolean isSecureProcessing) {
559N/A String defaultValue = "all";
559N/A if (isJDKandAbove(RESTRICT_BY_DEFAULT_JDK_VERSION)) {
559N/A defaultValue = "file";
559N/A if (isSecureProcessing) {
559N/A defaultValue = EXTERNAL_ACCESS_DEFAULT_FSP;
559N/A }
559N/A }
559N/A return defaultValue;
559N/A }
559N/A
559N/A /*
559N/A * Check the version of the current JDK against that specified in the
559N/A * parameter
559N/A *
559N/A * There is a proposal to change the java version string to:
559N/A * MAJOR.MINOR.FU.CPU.PSU-BUILDNUMBER_BUGIDNUMBER_OPTIONAL
559N/A * This method would work with both the current format and that proposed
559N/A *
559N/A * @param compareTo a JDK version to be compared to
559N/A * @return true if the current version is the same or above that represented
559N/A * by the parameter
559N/A */
559N/A public static boolean isJDKandAbove(int compareTo) {
559N/A String javaVersion = SecuritySupport.getSystemProperty("java.version");
559N/A String versions[] = javaVersion.split("\\.", 3);
559N/A if (Integer.parseInt(versions[0]) >= compareTo ||
559N/A Integer.parseInt(versions[1]) >= compareTo) {
559N/A return true;
559N/A }
559N/A return false;
559N/A }
559N/A
286N/A //
286N/A // Classes
286N/A //
286N/A
286N/A /**
286N/A * An array enumeration.
286N/A *
286N/A * @author Andy Clark, IBM
286N/A */
286N/A static class ArrayEnumeration
286N/A implements Enumeration {
286N/A
286N/A //
286N/A // Data
286N/A //
286N/A
286N/A /** Array. */
286N/A private Object[] array;
286N/A
286N/A /** Index. */
286N/A private int index;
286N/A
286N/A //
286N/A // Constructors
286N/A //
286N/A
286N/A /** Constructs an array enumeration. */
286N/A public ArrayEnumeration(Object[] array) {
286N/A this.array = array;
286N/A } // <init>(Object[])
286N/A
286N/A //
286N/A // Enumeration methods
286N/A //
286N/A
286N/A /**
286N/A * Tests if this enumeration contains more elements.
286N/A *
286N/A * @return <code>true</code> if this enumeration contains more elements;
286N/A * <code>false</code> otherwise.
286N/A * @since JDK1.0
286N/A */
286N/A public boolean hasMoreElements() {
286N/A return index < array.length;
286N/A } // hasMoreElement():boolean
286N/A
286N/A /**
286N/A * Returns the next element of this enumeration.
286N/A *
286N/A * @return the next element of this enumeration.
286N/A * @exception NoSuchElementException if no more elements exist.
286N/A * @since JDK1.0
286N/A */
286N/A public Object nextElement() {
286N/A if (index < array.length) {
286N/A return array[index++];
286N/A }
286N/A throw new NoSuchElementException();
286N/A } // nextElement():Object
286N/A
286N/A } // class ArrayEnumeration
286N/A
286N/A //
286N/A // MAIN
286N/A //
286N/A
286N/A /** Prints all of the constants to standard output. */
286N/A public static void main(String[] argv) {
286N/A
286N/A print("SAX features:", SAX_FEATURE_PREFIX, fgSAXFeatures);
286N/A print("SAX properties:", SAX_PROPERTY_PREFIX, fgSAXProperties);
286N/A print("Xerces features:", XERCES_FEATURE_PREFIX, fgXercesFeatures);
286N/A print("Xerces properties:", XERCES_PROPERTY_PREFIX, fgXercesProperties);
286N/A
286N/A } // main(String[])
286N/A
286N/A /** Prints a list of features/properties. */
286N/A private static void print(String header, String prefix, Object[] array) {
286N/A System.out.print(header);
286N/A if (array.length > 0) {
286N/A System.out.println();
286N/A for (int i = 0; i < array.length; i++) {
286N/A System.out.print(" ");
286N/A System.out.print(prefix);
286N/A System.out.println(array[i]);
286N/A }
286N/A }
286N/A else {
286N/A System.out.println(" none.");
286N/A }
286N/A } // print(String,String,Object[])
286N/A
286N/A} // class Constants