org.apache.xml.serializer
Class OutputPropertiesFactory

java.lang.Object
  extended by org.apache.xml.serializer.OutputPropertiesFactory

public final class OutputPropertiesFactory
extends java.lang.Object

This class is a factory to generate a set of default properties of key/value pairs that are used to create a serializer through the factory SerilizerFactory. The properties generated by this factory may be modified to non-default values before the SerializerFactory is used to create a Serializer.

The given output types supported are "xml", "text", and "html". These type strings can be obtained from the Method class in this package.

Other constants defined in this class are the non-standard property keys that can be used to set non-standard property values on a java.util.Properties object that is used to create or configure a serializer. Here are the non-standard keys:

See Also:
SerializerFactory, Method, Serializer

Field Summary
private static java.lang.Class ACCESS_CONTROLLER_CLASS
           
private static java.util.Properties m_html_properties
          The default properties when method="html".
private static java.lang.Integer m_synch_object
          Synchronization object for lazy initialization of the above tables.
private static java.util.Properties m_text_properties
          The default properties when method="text".
private static java.util.Properties m_unknown_properties
          The properties when method="" for the "unknown" wrapper
private static java.util.Properties m_xml_properties
          The default properties of all output files.
private static java.lang.String PROP_DIR
          the directory in which the various method property files are located
private static java.lang.String PROP_FILE_HTML
          property file for default HTML properties
private static java.lang.String PROP_FILE_TEXT
          property file for default TEXT properties
private static java.lang.String PROP_FILE_UNKNOWN
          property file for default UNKNOWN (Either XML or HTML, to be determined later) properties
private static java.lang.String PROP_FILE_XML
          property file for default XML properties
static java.lang.String S_BUILTIN_EXTENSIONS_UNIVERSAL
          This is not a public API.
private static java.lang.String S_BUILTIN_EXTENSIONS_URL
          S_BUILTIN_EXTENSIONS_URL is a mnemonic for the XML Namespace (http://xml.apache.org/xalan) predefined to signify Xalan's built-in XSLT Extensions.
static java.lang.String S_BUILTIN_OLD_EXTENSIONS_UNIVERSAL
          The old built-in extension namespace, this is not a public API.
static int S_BUILTIN_OLD_EXTENSIONS_UNIVERSAL_LEN
          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.
private static java.lang.String S_BUILTIN_OLD_EXTENSIONS_URL
          The old built-in extension url.
static java.lang.String S_KEY_CONTENT_HANDLER
          This non-standard property key is used to set the name of the fully qualified Java class that implements the ContentHandler interface.
static java.lang.String S_KEY_ENTITIES
          This non-standard property key is used to specify the name of the property file that specifies character to entity reference mappings.
static java.lang.String S_KEY_INDENT_AMOUNT
          The non-standard property key to use to set the number of whitepaces to indent by, per indentation level, if indent="yes".
static java.lang.String S_KEY_LINE_SEPARATOR
          The non-standard property key to use to set the characters to write out as at the end of a line, rather than the default ones from the runtime.
static java.lang.String S_OMIT_META_TAG
          This non-standard property key is used to set a value of "yes" if the META tag should be omitted where it would otherwise be supplied.
static java.lang.String S_USE_URL_ESCAPING
          This non-standard property key is used to set a value of "yes" if the href values for HTML serialization should use %xx escaping.
private static java.lang.String S_XALAN_PREFIX
           
private static int S_XALAN_PREFIX_LEN
           
private static java.lang.String S_XSLT_PREFIX
           
private static int S_XSLT_PREFIX_LEN
           
 
Constructor Summary
OutputPropertiesFactory()
           
 
Method Summary
private static java.lang.Class findAccessControllerClass()
           
private static java.lang.String fixupPropertyString(java.lang.String s, boolean doClipping)
          Fix up a string in an output properties file according to the rules of loadPropertiesFile(java.lang.String, java.util.Properties).
static java.util.Properties getDefaultMethodProperties(java.lang.String method)
          Creates an empty OutputProperties with the property key/value defaults specified by a property file.
private static java.util.Properties loadPropertiesFile(java.lang.String resourceName, java.util.Properties defaults)
          Load the properties file from a resource stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

S_BUILTIN_EXTENSIONS_URL

private static final java.lang.String S_BUILTIN_EXTENSIONS_URL
S_BUILTIN_EXTENSIONS_URL is a mnemonic for the XML Namespace (http://xml.apache.org/xalan) predefined to signify Xalan's built-in XSLT Extensions. When used in stylesheets, this is often bound to the "xalan:" prefix.

See Also:
Constant Field Values

S_BUILTIN_OLD_EXTENSIONS_URL

private static final java.lang.String S_BUILTIN_OLD_EXTENSIONS_URL
The old built-in extension url. It is still supported for backward compatibility.

See Also:
Constant Field Values

S_BUILTIN_EXTENSIONS_UNIVERSAL

public static final java.lang.String S_BUILTIN_EXTENSIONS_UNIVERSAL
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 name".

See Also:
Constant Field Values

S_KEY_INDENT_AMOUNT

public static final java.lang.String S_KEY_INDENT_AMOUNT
The non-standard property key to use to set the number of whitepaces to indent by, per indentation level, if indent="yes".

See Also:
Constant Field Values

S_KEY_LINE_SEPARATOR

public static final java.lang.String S_KEY_LINE_SEPARATOR
The non-standard property key to use to set the characters to write out as at the end of a line, rather than the default ones from the runtime.

See Also:
Constant Field Values

S_KEY_CONTENT_HANDLER

public static final java.lang.String S_KEY_CONTENT_HANDLER
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 will be sent to.

See Also:
Constant Field Values

S_KEY_ENTITIES

public static final java.lang.String S_KEY_ENTITIES
This non-standard property key is used to specify the name of the property file that specifies character to entity reference mappings.

See Also:
Constant Field Values

S_USE_URL_ESCAPING

public static final java.lang.String S_USE_URL_ESCAPING
This non-standard property key is used to set a value of "yes" if the href values for HTML serialization should use %xx escaping.

See Also:
Constant Field Values

S_OMIT_META_TAG

public static final java.lang.String S_OMIT_META_TAG
This non-standard property key is used to set a value of "yes" if the META tag should be omitted where it would otherwise be supplied.

See Also:
Constant Field Values

S_BUILTIN_OLD_EXTENSIONS_UNIVERSAL

public static final java.lang.String S_BUILTIN_OLD_EXTENSIONS_UNIVERSAL
The old built-in extension namespace, this is not a public API.

See Also:
Constant Field Values

S_BUILTIN_OLD_EXTENSIONS_UNIVERSAL_LEN

public static final int S_BUILTIN_OLD_EXTENSIONS_UNIVERSAL_LEN
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.


S_XSLT_PREFIX

private static final java.lang.String S_XSLT_PREFIX
See Also:
Constant Field Values

S_XSLT_PREFIX_LEN

private static final int S_XSLT_PREFIX_LEN

S_XALAN_PREFIX

private static final java.lang.String S_XALAN_PREFIX
See Also:
Constant Field Values

S_XALAN_PREFIX_LEN

private static final int S_XALAN_PREFIX_LEN

m_synch_object

private static java.lang.Integer m_synch_object
Synchronization object for lazy initialization of the above tables.


PROP_DIR

private static final java.lang.String PROP_DIR
the directory in which the various method property files are located


PROP_FILE_XML

private static final java.lang.String PROP_FILE_XML
property file for default XML properties

See Also:
Constant Field Values

PROP_FILE_TEXT

private static final java.lang.String PROP_FILE_TEXT
property file for default TEXT properties

See Also:
Constant Field Values

PROP_FILE_HTML

private static final java.lang.String PROP_FILE_HTML
property file for default HTML properties

See Also:
Constant Field Values

PROP_FILE_UNKNOWN

private static final java.lang.String PROP_FILE_UNKNOWN
property file for default UNKNOWN (Either XML or HTML, to be determined later) properties

See Also:
Constant Field Values

m_xml_properties

private static java.util.Properties m_xml_properties
The default properties of all output files.


m_html_properties

private static java.util.Properties m_html_properties
The default properties when method="html".


m_text_properties

private static java.util.Properties m_text_properties
The default properties when method="text".


m_unknown_properties

private static java.util.Properties m_unknown_properties
The properties when method="" for the "unknown" wrapper


ACCESS_CONTROLLER_CLASS

private static final java.lang.Class ACCESS_CONTROLLER_CLASS
Constructor Detail

OutputPropertiesFactory

public OutputPropertiesFactory()
Method Detail

findAccessControllerClass

private static java.lang.Class findAccessControllerClass()

getDefaultMethodProperties

public static final java.util.Properties getDefaultMethodProperties(java.lang.String method)
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 the form output_[method].properties (for instance, output_html.properties). The output_xml.properties file is always used as the base.

Anything other than 'text', 'xml', and 'html', will use the output_xml.properties file.

Parameters:
method - non-null reference to method name.
Returns:
Properties object that holds the defaults for the given method.

loadPropertiesFile

private static java.util.Properties loadPropertiesFile(java.lang.String resourceName,
                                                       java.util.Properties defaults)
                                                throws java.io.IOException
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 : 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).

Parameters:
resourceName - non-null reference to resource name.
defaults - Default properties, which may be null.
Throws:
java.io.IOException

fixupPropertyString

private static java.lang.String fixupPropertyString(java.lang.String s,
                                                    boolean doClipping)
Fix up a string in an output properties file according to the rules of loadPropertiesFile(java.lang.String, java.util.Properties).

Parameters:
s - non-null reference to string that may need to be fixed up.
Returns:
A new string if fixup occured, otherwise the s argument.