DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=22025>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=22025

SerializerFactory requires xalan specific properties to be explicity set





------- Additional Comments From [EMAIL PROTECTED]  2003-07-31 17:55 -------
I have a component where I often need to override the serialization properties
from those specified in the xsl transform. These properties are already stored
in a properties object and can come from many different sources. The difficulty
is that before I call the SerializerFactory, I either have to merge the default
properties obtained from OutputPropertiesFactory.getDefaultMethodProperties()
and the user provided properties, or I have to set up a switch statement and
manually set the content-handler property. This would make it more convenient if
the SerializerFactory were able to determine the xalan-specific properties from
the method property.

Setting the content-handler property is also not obvious from reading the
documentation, so allowing a minimal set of properties makes the call more
intuitive.

I agree that you shouldn't merge the properties onto those passed in. I would
assume it should run something like this:

if (null == className)
{
        // Missing Content Handler property, load default using OutputPropertiesFactory
        Properties methodDefaults =
OutputPropertiesFactory.getDefaultMethodProperties(method);
        format = format.clone();
        Enumeration keys = methodDefaults.keys();
        while( keys.hasMoreElements() )
        {
                String key = ( String )keys.nextElement();
                if( !format.containsKey( key ) )
                        format.setProperty( key, methodDefaults.getProperty( key ) );
        }
        className =
methodDefaults.getProperty(OutputPropertiesFactory.S_KEY_CONTENT_HANDLER);
        if (null == className)
                throw new IllegalArgumentException(
                        "The output format must have a '"
                        + OutputPropertiesFactory.S_KEY_CONTENT_HANDLER + "' 
property!");
}

Reply via email to