1 /* 2 * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved. 3 * @LastModified: Sep 2017 4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 5 * 6 * This code is free software; you can redistribute it and/or modify it 7 * under the terms of the GNU General Public License version 2 only, as 8 * published by the Free Software Foundation. Oracle designates this 9 * particular file as subject to the "Classpath" exception as provided 10 * by Oracle in the LICENSE file that accompanied this code. 11 * 12 * This code is distributed in the hope that it will be useful, but WITHOUT 13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 15 * version 2 for more details (a copy is included in the LICENSE file that 16 * accompanied this code). 17 * 18 * You should have received a copy of the GNU General Public License version 19 * 2 along with this work; if not, write to the Free Software Foundation, 20 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 21 * 22 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 23 * or visit www.oracle.com if you need additional information or have any 24 * questions. 25 */ 26 27 package com.sun.org.apache.xalan.internal; 28 29 import jdk.xml.internal.SecuritySupport; 30 31 /** 32 * Commonly used constants. 33 * 34 * @author Huizhe Wang, Oracle 35 * 36 */ 37 public final class XalanConstants { 38 39 // 40 // Constants 41 // 42 //Xerces security manager 43 public static final String SECURITY_MANAGER = 44 "http://apache.org/xml/properties/security-manager"; 45 46 // 47 // Implementation limits: API properties 48 // 49 /** Oracle JAXP property prefix ("http://www.oracle.com/xml/jaxp/properties/"). */ 50 public static final String ORACLE_JAXP_PROPERTY_PREFIX = 51 "http://www.oracle.com/xml/jaxp/properties/"; 52 /** 53 * JDK entity expansion limit; Note that the existing system property 54 * "entityExpansionLimit" with no prefix is still observed 55 */ 56 public static final String JDK_ENTITY_EXPANSION_LIMIT = 57 ORACLE_JAXP_PROPERTY_PREFIX + "entityExpansionLimit"; 58 59 /** 60 * JDK element attribute limit; Note that the existing system property 61 * "elementAttributeLimit" with no prefix is still observed 62 */ 63 public static final String JDK_ELEMENT_ATTRIBUTE_LIMIT = 64 ORACLE_JAXP_PROPERTY_PREFIX + "elementAttributeLimit"; 65 66 /** 67 * JDK maxOccur limit; Note that the existing system property 68 * "maxOccurLimit" with no prefix is still observed 69 */ 70 public static final String JDK_MAX_OCCUR_LIMIT = 71 ORACLE_JAXP_PROPERTY_PREFIX + "maxOccurLimit"; 72 73 /** 74 * JDK total entity size limit 75 */ 76 public static final String JDK_TOTAL_ENTITY_SIZE_LIMIT = 77 ORACLE_JAXP_PROPERTY_PREFIX + "totalEntitySizeLimit"; 78 79 /** 80 * JDK maximum general entity size limit 81 */ 82 public static final String JDK_GENERAL_ENTITY_SIZE_LIMIT = 83 ORACLE_JAXP_PROPERTY_PREFIX + "maxGeneralEntitySizeLimit"; 84 85 /** 86 * JDK node count limit in entities that limits the total number of nodes 87 * in all of entity references. 88 */ 89 public static final String JDK_ENTITY_REPLACEMENT_LIMIT = 90 ORACLE_JAXP_PROPERTY_PREFIX + "entityReplacementLimit"; 91 92 /** 93 * JDK maximum parameter entity size limit 94 */ 95 public static final String JDK_PARAMETER_ENTITY_SIZE_LIMIT = 96 ORACLE_JAXP_PROPERTY_PREFIX + "maxParameterEntitySizeLimit"; 97 /** 98 * JDK maximum XML name limit 99 */ 100 public static final String JDK_XML_NAME_LIMIT = 101 ORACLE_JAXP_PROPERTY_PREFIX + "maxXMLNameLimit"; 102 103 /** 104 * JDK maxElementDepth limit 105 */ 106 public static final String JDK_MAX_ELEMENT_DEPTH = 107 ORACLE_JAXP_PROPERTY_PREFIX + "maxElementDepth"; 108 109 /** 110 * JDK property indicating whether the parser shall print out entity 111 * count information 112 * Value: a string "yes" means print, "no" or any other string means not. 113 */ 114 public static final String JDK_ENTITY_COUNT_INFO = 115 ORACLE_JAXP_PROPERTY_PREFIX + "getEntityCountInfo"; 116 117 // 118 // Implementation limits: corresponding System Properties of the above 119 // API properties 120 // 121 /** 122 * JDK entity expansion limit; Note that the existing system property 123 * "entityExpansionLimit" with no prefix is still observed 124 */ 125 public static final String SP_ENTITY_EXPANSION_LIMIT = "jdk.xml.entityExpansionLimit"; 126 127 /** 128 * JDK element attribute limit; Note that the existing system property 129 * "elementAttributeLimit" with no prefix is still observed 130 */ 131 public static final String SP_ELEMENT_ATTRIBUTE_LIMIT = "jdk.xml.elementAttributeLimit"; 132 133 /** 134 * JDK maxOccur limit; Note that the existing system property 135 * "maxOccurLimit" with no prefix is still observed 136 */ 137 public static final String SP_MAX_OCCUR_LIMIT = "jdk.xml.maxOccurLimit"; 138 139 /** 140 * JDK total entity size limit 141 */ 142 public static final String SP_TOTAL_ENTITY_SIZE_LIMIT = "jdk.xml.totalEntitySizeLimit"; 143 144 /** 145 * JDK maximum general entity size limit 146 */ 147 public static final String SP_GENERAL_ENTITY_SIZE_LIMIT = "jdk.xml.maxGeneralEntitySizeLimit"; 148 149 /** 150 * JDK node count limit in entities that limits the total number of nodes 151 * in all of entity references. 152 */ 153 public static final String SP_ENTITY_REPLACEMENT_LIMIT = "jdk.xml.entityReplacementLimit"; 154 155 /** 156 * JDK maximum parameter entity size limit 157 */ 158 public static final String SP_PARAMETER_ENTITY_SIZE_LIMIT = "jdk.xml.maxParameterEntitySizeLimit"; 159 /** 160 * JDK maximum XML name limit 161 */ 162 public static final String SP_XML_NAME_LIMIT = "jdk.xml.maxXMLNameLimit"; 163 164 /** 165 * JDK maxElementDepth limit 166 */ 167 public static final String SP_MAX_ELEMENT_DEPTH = "jdk.xml.maxElementDepth"; 168 169 /** 170 * JDK TransformerFactory and Transformer attribute that specifies a class 171 * loader that will be used for extension functions class loading 172 * Value: a "null", the default value, means that the default EF class loading 173 * path will be used. 174 * Instance of ClassLoader: the specified instance of ClassLoader will be used 175 * for extension functions loading during translation process 176 */ 177 public static final String JDK_EXTENSION_CLASSLOADER = "jdk.xml.transform.extensionClassLoader"; 178 179 //legacy System Properties 180 public final static String ENTITY_EXPANSION_LIMIT = "entityExpansionLimit"; 181 public static final String ELEMENT_ATTRIBUTE_LIMIT = "elementAttributeLimit" ; 182 public final static String MAX_OCCUR_LIMIT = "maxOccurLimit"; 183 184 /** 185 * A string "yes" that can be used for properties such as getEntityCountInfo 186 */ 187 public static final String JDK_YES = "yes"; 188 189 // Oracle Feature: 190 /** 191 * <p>Use Service Mechanism</p> 192 * 193 * <ul> 194 * <li> 195 * {@code true} instruct an object to use service mechanism to 196 * find a service implementation. This is the default behavior. 197 * </li> 198 * <li> 199 * {@code false} instruct an object to skip service mechanism and 200 * use the default implementation for that service. 201 * </li> 202 * </ul> 203 */ 204 public static final String ORACLE_FEATURE_SERVICE_MECHANISM = "http://www.oracle.com/feature/use-service-mechanism"; 205 206 207 //System Properties corresponding to ACCESS_EXTERNAL_* properties 208 public static final String SP_ACCESS_EXTERNAL_STYLESHEET = "javax.xml.accessExternalStylesheet"; 209 public static final String SP_ACCESS_EXTERNAL_DTD = "javax.xml.accessExternalDTD"; 210 211 //all access keyword 212 public static final String ACCESS_EXTERNAL_ALL = "all"; 213 214 /** 215 * Default value when FEATURE_SECURE_PROCESSING (FSP) is set to true 216 */ 217 public static final String EXTERNAL_ACCESS_DEFAULT_FSP = ""; 218 219 /** 220 * FEATURE_SECURE_PROCESSING (FSP) is false by default 221 */ 222 public static final String EXTERNAL_ACCESS_DEFAULT = ACCESS_EXTERNAL_ALL; 223 224 public static final String XML_SECURITY_PROPERTY_MANAGER = 225 ORACLE_JAXP_PROPERTY_PREFIX + "xmlSecurityPropertyManager"; 226 227 228 /** 229 * Values for a feature 230 */ 231 public static final String FEATURE_TRUE = "true"; 232 public static final String FEATURE_FALSE = "false"; 233 234 } // class Constants 235