0N/A * DO NOT REMOVE OR ALTER! 0N/A * Copyright 1999-2004 The Apache Software Foundation. 0N/A * Licensed under the Apache License, Version 2.0 (the "License"); 0N/A * you may not use this file except in compliance with the License. 0N/A * You may obtain a copy of the License at 0N/A * Unless required by applicable law or agreed to in writing, software 0N/A * distributed under the License is distributed on an "AS IS" BASIS, 0N/A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 0N/A * See the License for the specific language governing permissions and 0N/A * limitations under the License. 0N/A * This class is a factory to generate a set of default properties 0N/A * of key/value pairs that are used to create a serializer through the 0N/A * factory {@link SerializerFactory SerilizerFactory}. 0N/A * The properties generated by this factory 0N/A * may be modified to non-default values before the SerializerFactory is used to 0N/A * create a Serializer. 0N/A * The given output types supported are "xml", "text", and "html". 0N/A * These type strings can be obtained from the 0N/A * {@link Method Method} class in this package. * Other constants defined in this class are the non-standard property keys * that is used to create or configure a serializer. Here are the non-standard keys: * <li> <b>S_KEY_INDENT_AMOUNT </b> - * The non-standard property key to use to set the indentation amount. * The "indent" key needs to have a value of "yes", and this * properties value is a the number of whitespaces to indent by per * <li> <b>S_KEY_CONTENT_HANDLER </b> - * This non-standard property key is used to set the name of the fully qualified * Java class that implements the ContentHandler interface. * The output of the serializer will be SAX events sent to this an * <li> <b>S_KEY_ENTITIES </b> - * This non-standard property key is used to specify the name of the property file * that specifies character to entity reference mappings. A line in such a * file is has the name of the entity and the numeric (base 10) value * of the corresponding character, like this one: <br> quot=34 <br> * <li> <b>S_USE_URL_ESCAPING </b> - * This non-standard property key is used to set a value of "yes" if the href values for HTML serialization should * <li> <b>S_OMIT_META_TAG </b> - * This non-standard property key is used to set a value of "yes" if the META tag should be omitted where it would /** S_BUILTIN_EXTENSIONS_URL is a mnemonic for the XML Namespace * built-in XSLT Extensions. When used in stylesheets, this is often * bound to the "xalan:" prefix. * The old built-in extension url. It is still supported for * backward compatibility. //************************************************************ //************************************************************ * This is not a public API. * This is the built-in extensions namespace, * reexpressed in {namespaceURI} syntax * suitable for prepending to a localname to produce a "universal // Some special Xalan keys. * The non-standard property key to use to set the * number of whitepaces to indent by, per indentation level, * The non-standard property key to use to set the * number of whitepaces to indent by, per indentation level, /** This non-standard property key is used to set the name of the fully qualified * Java class that implements the ContentHandler interface. * Fully qualified name of class with a default constructor that * implements the ContentHandler interface, where the result tree events * This non-standard property key is used to specify the name of the property file * that specifies character to entity reference mappings. * This non-standard property key is used to set a value of "yes" if the href values for HTML serialization should * This non-standard property key is used to set a value of "yes" if the META tag should be omitted where it would * The old built-in extension namespace, this is not a public API. * This is not a public API, it is only public because it is used * by outside of this package, * it is the length of the old built-in extension namespace. * This non-standard, Oracle-impl only property key is used as if OutputKeys.STANDALONE is specified but * without writing it out in the declaration; It can be used to reverse the change by Xalan patch 1495. * Since Xalan patch 1495 can cause incompatible behavior, this property is add for application to neutralize * the effect of Xalan patch 1495 * <code>yes</code> to indicate the output is intended to be used as standalone * <code>no</code> has no effect. //************************************************************ //************************************************************ /** Synchronization object for lazy initialization of the above tables. */ /** the directory in which the various method property files are located */ /** property file for default XML properties */ /** property file for default TEXT properties */ /** property file for default HTML properties */ /** property file for default UNKNOWN (Either XML or HTML, to be determined later) properties */ //************************************************************ //* PRIVATE STATIC FIELDS //************************************************************ /** The default properties of all output files. */ /** The default properties when method="html". */ /** The default properties when method="text". */ /** The properties when method="" for the "unknown" wrapper */ private static final Class // This Class was introduced in JDK 1.2. With the re-architecture of // security mechanism ( starting in JDK 1.2 ), we have option of // giving privileges to certain part of code using doPrivileged block. // In JDK1.1.X applications won't be having security manager and if // there is security manager ( in applets ), code need to be signed // and trusted for having access to resources. //User may be using older JDK ( JDK <1.2 ). Allow him/her to use it. // But don't try to use doPrivileged * Creates an empty OutputProperties with the property key/value defaults specified by * a property file. The method argument is used to construct a string of * <p>Anything other than 'text', 'xml', and 'html', will * @param method non-null reference to method name. * @return Properties object that holds the defaults for the given method. // According to this article : Double-check locking does not work // TODO: Calculate res file from name. // wrap these cached defaultProperties in a new Property object just so // that the caller of this method can't modify the default values * Load the properties file from a resource stream. If a * key name such as "org.apache.xslt.xxx", fix up the start of * string to be a curly namespace. If a key name starts with * "xslt.output.xxx", clip off "xslt.output.". If a key name *or* a * key value is discovered, check for \u003a in the text, and * fix it up to be ":", since earlier versions of the JDK do not * handle the escape sequence (at least in key names). * @param resourceName non-null reference to resource name. * @param defaults Default properties, which may be null. // This static method should eventually be moved to a thread-specific class // so that we can cache the ContextClassLoader and bottleneck all properties file // loading throughout Xalan. // User may be using older JDK ( JDK < 1.2 ) //"Could not load '"+resourceName+"' (check CLASSPATH), now using just the defaults ", ioe); //"Could not load '"+resourceName+"' (check CLASSPATH, applet security), now using just the defaults ", se); // Note that we're working at the HashTable level here, // and not at the Properties level! This is important // because we don't want to modify the default properties. // NB: If fixupPropertyString ends up changing the property // name or value, we need to remove the old key and re-add // with the new key and value. However, then our Enumeration // could lose its place in the HashTable. So, we first // clone the HashTable and enumerate over that since the // clone will not change. When we migrate to Collections, // this code should be revisited and cleaned up to use // an Iterator which may (or may not) alleviate the need for // the clone. Many thanks to Padraig O'hIceadha // <padraig@gradient.ie> for finding this problem. Bugzilla 2000. // Now check if the given key was specified as a // System property. If so, the system property // overides the default value in the propery file. * Fix up a string in an output properties file according to * the rules of {@link #loadPropertiesFile}. * @param s non-null reference to string that may need to be fixed up. * @return A new string if fixup occured, otherwise the s argument.