Commiting changes for XALANJ-2275. Which un-entagles
output properties from xsl:output from OutputStream
or Writer.

For example one can set an encoding via JAXP and this
does have implications on the writer that wraps an
OutputStream, because the writer is encoding sensitive.

Ugly code, just less ugly now.
diff --git a/src/org/apache/xml/serializer/EmptySerializer.java b/src/org/apache/xml/serializer/EmptySerializer.java
index 0d9808f..ab1822b 100644
--- a/src/org/apache/xml/serializer/EmptySerializer.java
+++ b/src/org/apache/xml/serializer/EmptySerializer.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2003-2004 The Apache Software Foundation.
+ * Copyright 2003-2006 The Apache Software Foundation.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -752,4 +752,26 @@
         aMethodIsCalled();
 
     }
+    
+
+    public String getOutputProperty(String name) {
+        aMethodIsCalled();
+        return null;
+    }
+
+    public String getOutputPropertyDefault(String name) {
+        aMethodIsCalled();
+        return null;
+    }
+
+    public void setOutputProperty(String name, String val) {
+        aMethodIsCalled();
+        
+    }
+
+    public void setOutputPropertyDefault(String name, String val) {
+        aMethodIsCalled();
+        
+    }
+
 }
diff --git a/src/org/apache/xml/serializer/SerializerBase.java b/src/org/apache/xml/serializer/SerializerBase.java
index 66784ba..55d170e 100644
--- a/src/org/apache/xml/serializer/SerializerBase.java
+++ b/src/org/apache/xml/serializer/SerializerBase.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2001-2004 The Apache Software Foundation.
+ * Copyright 2001-2006 The Apache Software Foundation.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -19,7 +19,10 @@
 package org.apache.xml.serializer;
 
 import java.io.IOException;
+import java.util.HashMap;
+import java.util.Set;
 
+import javax.xml.transform.OutputKeys;
 import javax.xml.transform.SourceLocator;
 import javax.xml.transform.Transformer;
 
@@ -141,12 +144,12 @@
     /**
      * The System ID for the doc type.
      */
-    private String m_doctypeSystem;
+    protected String m_doctypeSystem;
 
     /**
      * The public ID for the doc type.
      */
-    private String m_doctypePublic;
+    protected String m_doctypePublic;
 
     /**
      * Flag to tell that we need to add the doctype decl, which we can't do
@@ -155,15 +158,9 @@
     boolean m_needToOutputDocTypeDecl = true;
 
     /**
-     * The character encoding.  Must match the encoding used for the
-     * printWriter.
-     */
-    String m_encoding = null;
-
-    /**
      * Tells if we should write the XML declaration.
      */
-    private boolean m_shouldNotWriteXMLHeader = false;
+    protected boolean m_shouldNotWriteXMLHeader = false;
 
     /**
      * The standalone value for the doctype.
@@ -187,12 +184,12 @@
     /**
      * Tells the XML version, for writing out to the XML decl.
      */
-    private String m_version = null;
+    protected String m_version = null;
 
     /**
      * The mediatype.  Not used right now.
      */
-    private String m_mediatype;
+    protected String m_mediatype;
 
     /**
      * The transformer that was around when this output handler was created (if
@@ -559,7 +556,7 @@
      */
     public String getEncoding()
     {
-        return m_encoding;
+        return getOutputProperty(OutputKeys.ENCODING);
     }
 
    /**
@@ -568,7 +565,7 @@
      */
     public void setEncoding(String encoding)
     {
-        this.m_encoding = encoding;
+        setOutputProperty(OutputKeys.ENCODING,encoding);
     }
 
     /**
@@ -578,7 +575,8 @@
      */
     public void setOmitXMLDeclaration(boolean b)
     {
-        this.m_shouldNotWriteXMLHeader = b;
+        String val = b ? "yes":"no";
+        setOutputProperty(OutputKeys.OMIT_XML_DECLARATION,val);
     }
 
 
@@ -609,7 +607,7 @@
       */
     public void setDoctypePublic(String doctypePublic)
     {
-        this.m_doctypePublic = doctypePublic;
+        setOutputProperty(OutputKeys.DOCTYPE_PUBLIC, doctypePublic);
     }
 
 
@@ -631,7 +629,7 @@
       */
     public void setDoctypeSystem(String doctypeSystem)
     {
-        this.m_doctypeSystem = doctypeSystem;
+        setOutputProperty(OutputKeys.DOCTYPE_SYSTEM, doctypeSystem);
     }
 
     /** Set the value coming from the xsl:output doctype-public and doctype-system stylesheet properties
@@ -642,8 +640,8 @@
      */
     public void setDoctype(String doctypeSystem, String doctypePublic)
     {
-        this.m_doctypeSystem = doctypeSystem;
-        this.m_doctypePublic = doctypePublic;
+        setOutputProperty(OutputKeys.DOCTYPE_SYSTEM, doctypeSystem);
+        setOutputProperty(OutputKeys.DOCTYPE_PUBLIC, doctypePublic);
     }
 
     /**
@@ -655,11 +653,7 @@
      */
     public void setStandalone(String standalone)
     {
-        if (standalone != null)
-        {
-            m_standaloneWasSpecified = true;
-            setStandaloneInternal(standalone);
-        }
+        setOutputProperty(OutputKeys.STANDALONE, standalone);
     }
     /**
      * Sets the XSL standalone attribute, but does not remember if this is a
@@ -721,7 +715,7 @@
      */
     public void setVersion(String version)
     {
-        m_version = version;
+        setOutputProperty(OutputKeys.VERSION, version);
     }
 
     /**
@@ -733,7 +727,7 @@
      */
     public void setMediaType(String mediaType)
     {
-        m_mediatype = mediaType;
+        setOutputProperty(OutputKeys.MEDIA_TYPE,mediaType);
     }
 
     /**
@@ -762,7 +756,8 @@
      */
     public void setIndent(boolean doIndent)
     {
-        m_doIndent = doIndent;
+        String val = doIndent ? "yes":"no";
+        setOutputProperty(OutputKeys.INDENT,val);
     }
 
     /**
@@ -1257,7 +1252,6 @@
     	this.m_doctypePublic = null;
     	this.m_doctypeSystem = null;
     	this.m_doIndent = false;
-    	this.m_encoding = null;
     	this.m_indentAmount = 0;
     	this.m_inEntityRef = false;
     	this.m_inExternalDTD = false;
@@ -1477,9 +1471,21 @@
                 m_elemContext.m_elementLocalName = localName;                   
             }
             
-            if (m_elemContext.m_elementURI == null)
-                m_elemContext.m_elementURI = getElementURI();
+            if ( m_elemContext.m_elementURI == null) {
                 
+                m_elemContext.m_elementURI = getElementURI();
+            }
+            else if ( m_elemContext.m_elementURI.length() == 0) {
+                if ( m_elemContext.m_elementName == null) {
+                    m_elemContext.m_elementName = m_elemContext.m_elementLocalName;    
+                    // leave URI as "", meaning in no namespace
+                }
+                else if (m_elemContext.m_elementLocalName.length() < m_elemContext.m_elementName.length()){
+                    // We were told the URI was "", yet the name has a prefix since the name is longer than the localname.
+                    // So we will fix that incorrect information here.
+                    m_elemContext.m_elementURI = getElementURI();  
+                }
+            }
 
             java.util.Hashtable h = (java.util.Hashtable) m_CdataElems.get(m_elemContext.m_elementLocalName);
             if (h != null) 
@@ -1526,5 +1532,145 @@
 
         return uri;
     }
+    
+
+    /**
+     * Get the value of an output property,
+     * the explicit value, if any, otherwise the
+     * default value, if any, otherwise null.
+     */
+    public String getOutputProperty(String name) {
+        String val = getOutputPropertyNonDefault(name);
+        // If no explicit value, try to get the default value
+        if (val == null)
+            val = getOutputPropertyDefault(name);
+        return val;
+        
+    }
+    /**
+     * Get the value of an output property, 
+     * not the default value. If there is a default
+     * value, but no non-default value this method
+     * will return null.
+     * <p>
+     * 
+     */
+    public String getOutputPropertyNonDefault(String name )
+    {
+        return getProp(name,false);
+    }
+    
+    /**
+     * Get the default value of an xsl:output property,
+     * which would be null only if no default value exists
+     * for the property.
+     */
+    public String getOutputPropertyDefault(String name) {
+        return getProp(name, true);
+    } 
+    
+    /**
+     * Set the value for the output property, typically from
+     * an xsl:output element, but this does not change what
+     * the default value is.
+     */
+    public void   setOutputProperty(String name, String val) {
+        setProp(name,val,false);
+        
+    }
+    
+    /**
+     * Set the default value for an output property, but this does
+     * not impact any explicitly set value.
+     */
+    public void   setOutputPropertyDefault(String name, String val) {
+        setProp(name,val,true);
+        
+    }
+    
+    /**
+     * A mapping of keys to explicitly set values, for example if 
+     * and <xsl:output/> has an "encoding" attribute, this
+     * map will have what that attribute maps to.
+     */
+    private HashMap m_OutputProps;
+    /**
+     * A mapping of keys to default values, for example if
+     * the default value of the encoding is "UTF-8" then this
+     * map will have that "encoding" maps to "UTF-8".
+     */
+    private HashMap m_OutputPropsDefault;
+    
+    Set getOutputPropDefaultKeys() {
+        return m_OutputPropsDefault.keySet();
+    }
+    Set getOutputPropKeys() {
+        return m_OutputProps.keySet();
+    }
+    
+    private String getProp(String name, boolean defaultVal) {
+        if (m_OutputProps == null) {
+            m_OutputProps = new HashMap();
+            m_OutputPropsDefault = new HashMap();
+        }
+        
+        String val;
+        if (defaultVal)
+            val = (String) m_OutputPropsDefault.get(name);
+        else
+            val = (String) m_OutputProps.get(name);
+        
+        return val;
+        
+    }
+    /**
+     * 
+     * @param name The name of the property, e.g. "{http://myprop}indent-tabs" or "indent".
+     * @param val The value of the property, e.g. "4"
+     * @param defaultVal true if this is a default value being set for the property as 
+     * opposed to a user define on, set say explicitly in the stylesheet or via JAXP
+     */
+    void setProp(String name, String val, boolean defaultVal) {
+        if (m_OutputProps == null) {
+            m_OutputProps = new HashMap();
+            m_OutputPropsDefault = new HashMap();
+        }
+        
+        if (defaultVal)
+            m_OutputPropsDefault.put(name,val);
+        else {
+            if (OutputKeys.CDATA_SECTION_ELEMENTS.equals(name) && val != null) {
+                initCdataElems(val);
+                String oldVal = (String) m_OutputProps.get(name);
+                String newVal;
+                if (oldVal == null)
+                    newVal = oldVal + ' ' + val;
+                else
+                    newVal = val;
+                m_OutputProps.put(name,newVal);
+            }
+            else {
+                m_OutputProps.put(name,val);
+            }
+        }
+        
+
+    }
+
+    /**
+     * Get the first char of the local name
+     * @param name Either a local name, or a local name
+     * preceeded by a uri enclosed in curly braces.
+     */
+    static char getFirstCharLocName(String name) {
+        final char first;
+        int i = name.indexOf('}');
+        if (i < 0)
+            first = name.charAt(0);
+        else
+            first = name.charAt(i+1);
+        return first;
+    }
 }
     
+
diff --git a/src/org/apache/xml/serializer/ToHTMLStream.java b/src/org/apache/xml/serializer/ToHTMLStream.java
index fc648a5..3453cd4 100644
--- a/src/org/apache/xml/serializer/ToHTMLStream.java
+++ b/src/org/apache/xml/serializer/ToHTMLStream.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2001-2004 The Apache Software Foundation.
+ * Copyright 2001-2006 The Apache Software Foundation.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -19,8 +19,6 @@
 package org.apache.xml.serializer;
 
 import java.io.IOException;
-import java.io.OutputStream;
-import java.io.UnsupportedEncodingException;
 import java.util.Properties;
 
 import javax.xml.transform.Result;
@@ -344,87 +342,87 @@
 
 
         // ----------------------------------------------
-        elemDesc = (ElemDesc) m_elementFlags.get("A");
+        elemDesc = (ElemDesc) m_elementFlags.get("a");
         elemDesc.setAttr("HREF", ElemDesc.ATTRURL);
         elemDesc.setAttr("NAME", ElemDesc.ATTRURL);
         
         // ----------------------------------------------
-        elemDesc = (ElemDesc) m_elementFlags.get("AREA");
+        elemDesc = (ElemDesc) m_elementFlags.get("area");
 
         elemDesc.setAttr("HREF", ElemDesc.ATTRURL);
         elemDesc.setAttr("NOHREF", ElemDesc.ATTREMPTY);
 
         // ----------------------------------------------
-        elemDesc = (ElemDesc) m_elementFlags.get("BASE");
+        elemDesc = (ElemDesc) m_elementFlags.get("base");
 
         elemDesc.setAttr("HREF", ElemDesc.ATTRURL);
 
         // ----------------------------------------------
-        elemDesc = (ElemDesc) m_elementFlags.get("BUTTON");
+        elemDesc = (ElemDesc) m_elementFlags.get("button");
         elemDesc.setAttr("DISABLED", ElemDesc.ATTREMPTY);
 
         // ----------------------------------------------
-        elemDesc = (ElemDesc) m_elementFlags.get("BLOCKQUOTE");
+        elemDesc = (ElemDesc) m_elementFlags.get("blockquote");
 
         elemDesc.setAttr("CITE", ElemDesc.ATTRURL);
 
         // ----------------------------------------------
-        elemDesc = (ElemDesc) m_elementFlags.get("DEL");
+        elemDesc = (ElemDesc) m_elementFlags.get("del");
         elemDesc.setAttr("CITE", ElemDesc.ATTRURL);
 
         // ----------------------------------------------
-        elemDesc = (ElemDesc) m_elementFlags.get("DIR");
+        elemDesc = (ElemDesc) m_elementFlags.get("dir");
         elemDesc.setAttr("COMPACT", ElemDesc.ATTREMPTY);
            
         // ----------------------------------------------
         
-        elemDesc = (ElemDesc) m_elementFlags.get("DIV");
+        elemDesc = (ElemDesc) m_elementFlags.get("div");
         elemDesc.setAttr("SRC", ElemDesc.ATTRURL); // Netscape 4 extension
         elemDesc.setAttr("NOWRAP", ElemDesc.ATTREMPTY); // Internet-Explorer extension
    
         // ----------------------------------------------        
-        elemDesc = (ElemDesc) m_elementFlags.get("DL");
+        elemDesc = (ElemDesc) m_elementFlags.get("dl");
         elemDesc.setAttr("COMPACT", ElemDesc.ATTREMPTY);
            
         // ----------------------------------------------
-        elemDesc = (ElemDesc) m_elementFlags.get("FORM");
+        elemDesc = (ElemDesc) m_elementFlags.get("form");
         elemDesc.setAttr("ACTION", ElemDesc.ATTRURL);
 
         // ----------------------------------------------
         // Attribution to: "Voytenko, Dimitry" <DVoytenko@SECTORBASE.COM>
-        elemDesc = (ElemDesc) m_elementFlags.get("FRAME");
+        elemDesc = (ElemDesc) m_elementFlags.get("frame");
         elemDesc.setAttr("SRC", ElemDesc.ATTRURL);
         elemDesc.setAttr("LONGDESC", ElemDesc.ATTRURL);
         elemDesc.setAttr("NORESIZE",ElemDesc.ATTREMPTY);
 
         // ----------------------------------------------
-        elemDesc = (ElemDesc) m_elementFlags.get("HEAD");
+        elemDesc = (ElemDesc) m_elementFlags.get("head");
         elemDesc.setAttr("PROFILE", ElemDesc.ATTRURL);
 
         // ----------------------------------------------        
-        elemDesc = (ElemDesc) m_elementFlags.get("HR");
+        elemDesc = (ElemDesc) m_elementFlags.get("hr");
         elemDesc.setAttr("NOSHADE", ElemDesc.ATTREMPTY);
         
         // ----------------------------------------------
         // HTML 4.0, section 16.5
-        elemDesc = (ElemDesc) m_elementFlags.get("IFRAME");
+        elemDesc = (ElemDesc) m_elementFlags.get("iframe");
         elemDesc.setAttr("SRC", ElemDesc.ATTRURL);
         elemDesc.setAttr("LONGDESC", ElemDesc.ATTRURL);
 
         // ----------------------------------------------
         // Netscape 4 extension
-        elemDesc = (ElemDesc) m_elementFlags.get("ILAYER");
+        elemDesc = (ElemDesc) m_elementFlags.get("ilayer");
         elemDesc.setAttr("SRC", ElemDesc.ATTRURL);
 
         // ----------------------------------------------
-        elemDesc = (ElemDesc) m_elementFlags.get("IMG");
+        elemDesc = (ElemDesc) m_elementFlags.get("img");
         elemDesc.setAttr("SRC", ElemDesc.ATTRURL);
         elemDesc.setAttr("LONGDESC", ElemDesc.ATTRURL);
         elemDesc.setAttr("USEMAP", ElemDesc.ATTRURL);
         elemDesc.setAttr("ISMAP", ElemDesc.ATTREMPTY);
 
         // ----------------------------------------------
-        elemDesc = (ElemDesc) m_elementFlags.get("INPUT");
+        elemDesc = (ElemDesc) m_elementFlags.get("input");
 
         elemDesc.setAttr("SRC", ElemDesc.ATTRURL);
         elemDesc.setAttr("USEMAP", ElemDesc.ATTRURL);
@@ -434,24 +432,24 @@
         elemDesc.setAttr("READONLY", ElemDesc.ATTREMPTY);
         
         // ----------------------------------------------
-        elemDesc = (ElemDesc) m_elementFlags.get("INS");
+        elemDesc = (ElemDesc) m_elementFlags.get("ins");
         elemDesc.setAttr("CITE", ElemDesc.ATTRURL);
 
         // ----------------------------------------------
         // Netscape 4 extension
-        elemDesc = (ElemDesc) m_elementFlags.get("LAYER");
+        elemDesc = (ElemDesc) m_elementFlags.get("layer");
         elemDesc.setAttr("SRC", ElemDesc.ATTRURL);
 
         // ----------------------------------------------
-        elemDesc = (ElemDesc) m_elementFlags.get("LINK");
+        elemDesc = (ElemDesc) m_elementFlags.get("link");
         elemDesc.setAttr("HREF", ElemDesc.ATTRURL);
        
         // ----------------------------------------------       
-        elemDesc = (ElemDesc) m_elementFlags.get("MENU");
+        elemDesc = (ElemDesc) m_elementFlags.get("menu");
         elemDesc.setAttr("COMPACT", ElemDesc.ATTREMPTY);
         
         // ----------------------------------------------
-        elemDesc = (ElemDesc) m_elementFlags.get("OBJECT");
+        elemDesc = (ElemDesc) m_elementFlags.get("object");
 
         elemDesc.setAttr("CLASSID", ElemDesc.ATTRURL);
         elemDesc.setAttr("CODEBASE", ElemDesc.ATTRURL);
@@ -461,58 +459,58 @@
         elemDesc.setAttr("DECLARE", ElemDesc.ATTREMPTY);
         
         // ----------------------------------------------        
-        elemDesc = (ElemDesc) m_elementFlags.get("OL");
+        elemDesc = (ElemDesc) m_elementFlags.get("ol");
         elemDesc.setAttr("COMPACT", ElemDesc.ATTREMPTY);
         
         // ----------------------------------------------
-        elemDesc = (ElemDesc) m_elementFlags.get("OPTGROUP");
+        elemDesc = (ElemDesc) m_elementFlags.get("optgroup");
         elemDesc.setAttr("DISABLED", ElemDesc.ATTREMPTY);
 
         // ----------------------------------------------
-        elemDesc = (ElemDesc) m_elementFlags.get("OPTION");
+        elemDesc = (ElemDesc) m_elementFlags.get("option");
         elemDesc.setAttr("SELECTED", ElemDesc.ATTREMPTY);
         elemDesc.setAttr("DISABLED", ElemDesc.ATTREMPTY);
         
         // ----------------------------------------------
-        elemDesc = (ElemDesc) m_elementFlags.get("Q");
+        elemDesc = (ElemDesc) m_elementFlags.get("q");
         elemDesc.setAttr("CITE", ElemDesc.ATTRURL);
 
         // ----------------------------------------------
-        elemDesc = (ElemDesc) m_elementFlags.get("SCRIPT");
+        elemDesc = (ElemDesc) m_elementFlags.get("script");
         elemDesc.setAttr("SRC", ElemDesc.ATTRURL);
         elemDesc.setAttr("FOR", ElemDesc.ATTRURL);
         elemDesc.setAttr("DEFER", ElemDesc.ATTREMPTY);
 
         // ----------------------------------------------
-        elemDesc = (ElemDesc) m_elementFlags.get("SELECT");
+        elemDesc = (ElemDesc) m_elementFlags.get("select");
         elemDesc.setAttr("DISABLED", ElemDesc.ATTREMPTY);
         elemDesc.setAttr("MULTIPLE", ElemDesc.ATTREMPTY);
 
         // ----------------------------------------------
-        elemDesc = (ElemDesc) m_elementFlags.get("TABLE");
+        elemDesc = (ElemDesc) m_elementFlags.get("table");
         elemDesc.setAttr("NOWRAP", ElemDesc.ATTREMPTY); // Internet-Explorer extension
         
         // ----------------------------------------------        
-        elemDesc = (ElemDesc) m_elementFlags.get("TD");
+        elemDesc = (ElemDesc) m_elementFlags.get("td");
         elemDesc.setAttr("NOWRAP", ElemDesc.ATTREMPTY);
 
         // ----------------------------------------------
-        elemDesc = (ElemDesc) m_elementFlags.get("TEXTAREA");
+        elemDesc = (ElemDesc) m_elementFlags.get("textarea");
         elemDesc.setAttr("DISABLED", ElemDesc.ATTREMPTY);
         elemDesc.setAttr("READONLY", ElemDesc.ATTREMPTY);
        
         // ----------------------------------------------                
-        elemDesc = (ElemDesc) m_elementFlags.get("TH");
+        elemDesc = (ElemDesc) m_elementFlags.get("th");
         elemDesc.setAttr("NOWRAP", ElemDesc.ATTREMPTY);
         
         // ----------------------------------------------
         // The nowrap attribute of a tr element is both
         // a Netscape and Internet-Explorer extension                
-        elemDesc = (ElemDesc) m_elementFlags.get("TR");
+        elemDesc = (ElemDesc) m_elementFlags.get("tr");
         elemDesc.setAttr("NOWRAP", ElemDesc.ATTREMPTY);
         
         // ----------------------------------------------        
-        elemDesc = (ElemDesc) m_elementFlags.get("UL");
+        elemDesc = (ElemDesc) m_elementFlags.get("ul");
         elemDesc.setAttr("COMPACT", ElemDesc.ATTREMPTY);
     }
 
@@ -1785,54 +1783,9 @@
                 throw new SAXException(e);
             }
     }
-    /**
-     * Initialize the serializer with the specified output stream and output
-     * format. Must be called before calling any of the serialize methods.
-     *
-     * @param output The output stream to use
-     * @param format The output format
-     * @throws UnsupportedEncodingException The encoding specified   in the
-     * output format is not supported
-     */
-    protected synchronized void init(OutputStream output, Properties format)
-        throws UnsupportedEncodingException
-    {
-        if (null == format)
-        {
-            format = OutputPropertiesFactory.getDefaultMethodProperties(Method.HTML);
-         }
-        super.init(output,format, false);
-    }
     
-        /**
-         * Specifies an output stream to which the document should be
-         * serialized. This method should not be called while the
-         * serializer is in the process of serializing a document.
-         * <p>
-         * The encoding specified in the output properties is used, or
-         * if no encoding was specified, the default for the selected
-         * output method.
-         *
-         * @param output The output stream
-         */
-        public void setOutputStream(OutputStream output)
-        {
 
-            try
-            {
-                Properties format;
-                if (null == m_format)
-                    format = OutputPropertiesFactory.getDefaultMethodProperties(Method.HTML);
-                else
-                    format = m_format;
-                init(output, format, true);
-            }
-            catch (UnsupportedEncodingException uee)
-            {
-
-                // Should have been warned in init, I guess...
-            }
-        }    
+   
         /**
          * This method is used when a prefix/uri namespace mapping
          * is indicated after the element was started with a
diff --git a/src/org/apache/xml/serializer/ToStream.java b/src/org/apache/xml/serializer/ToStream.java
index f0026bb..5db982d 100644
--- a/src/org/apache/xml/serializer/ToStream.java
+++ b/src/org/apache/xml/serializer/ToStream.java
@@ -20,11 +20,14 @@
 
 import java.io.IOException;
 import java.io.OutputStream;
+import java.io.OutputStreamWriter;
 import java.io.UnsupportedEncodingException;
 import java.io.Writer;
 import java.util.EmptyStackException;
 import java.util.Enumeration;
+import java.util.Iterator;
 import java.util.Properties;
+import java.util.Set;
 import java.util.StringTokenizer;
 import java.util.Vector;
 
@@ -101,7 +104,7 @@
      */
     protected boolean m_isprevtext = false;
 
-
+        
     /**
      * The system line separator for writing out line breaks.
      * The default value is from the system property,
@@ -154,8 +157,6 @@
        */
     boolean m_isUTF8 = false;
 
-    /** The xsl:output properties. */
-    protected Properties m_format;
 
     /**
      * remembers if we are in between the startCDATA() and endCDATA() callbacks
@@ -262,6 +263,7 @@
         }
     }
 
+    OutputStream m_outputStream;
     /**
      * Get the output stream where the events will be serialized to.
      *
@@ -270,12 +272,7 @@
      */
     public OutputStream getOutputStream()
     {
-
-        if (m_writer instanceof WriterToUTF8Buffered)
-            return ((WriterToUTF8Buffered) m_writer).getOutputStream();
-        if (m_writer instanceof WriterToASCI)
-            return ((WriterToASCI) m_writer).getOutputStream();
-        return null;
+        return m_outputStream;
     }
 
     // Implement DeclHandler
@@ -378,6 +375,173 @@
         m_writer.write(m_lineSep, 0, m_lineSepLen);
     }
 
+    void setProp(String name, String val, boolean defaultVal) {
+        if (val != null) {
+
+
+            char first = getFirstCharLocName(name);
+            switch (first) {
+            case 'c':
+                if (OutputKeys.CDATA_SECTION_ELEMENTS.equals(name)) {
+                    String cdataSectionNames = val;
+                    addCdataSectionElements(cdataSectionNames);
+                }
+                break;
+            case 'd':
+                if (OutputKeys.DOCTYPE_SYSTEM.equals(name)) {
+                    this.m_doctypeSystem = val;
+                } else if (OutputKeys.DOCTYPE_PUBLIC.equals(name)) {
+                    this.m_doctypePublic = val;
+                    if (val.startsWith("-//W3C//DTD XHTML"))
+                        m_spaceBeforeClose = true;
+                }
+                break;
+            case 'e':
+                String newEncoding = val;
+                if (OutputKeys.ENCODING.equals(name)) {
+                    String possible_encoding = Encodings.getMimeEncoding(val);
+                    if (possible_encoding != null) {
+                        // if the encoding is being set, try to get the
+                        // preferred
+                        // mime-name and set it too.
+                        super.setProp("mime-name", possible_encoding,
+                                defaultVal);
+                    }
+                    final String oldExplicitEncoding = getOutputPropertyNonDefault(OutputKeys.ENCODING);
+                    final String oldDefaultEncoding  = getOutputPropertyDefault(OutputKeys.ENCODING);
+                    if ( (defaultVal && ( oldDefaultEncoding == null || !oldDefaultEncoding.equalsIgnoreCase(newEncoding)))
+                            || ( !defaultVal && (oldExplicitEncoding == null || !oldExplicitEncoding.equalsIgnoreCase(newEncoding) ))) {
+                       // We are trying to change the default or the non-default setting of the encoding to a different value
+                       // from what it was
+                       
+                       EncodingInfo encodingInfo = Encodings.getEncodingInfo(newEncoding);
+                       if (newEncoding != null && encodingInfo.name == null) {
+                        // We tried to get an EncodingInfo for Object for the given
+                        // encoding, but it came back with an internall null name
+                        // so the encoding is not supported by the JDK, issue a message.
+                        final String msg = Utils.messages.createMessage(
+                                MsgKey.ER_ENCODING_NOT_SUPPORTED,new Object[]{ newEncoding });
+                        
+                        final String msg2 = 
+                            "Warning: encoding \"" + newEncoding + "\" not supported, using "
+                                   + Encodings.DEFAULT_MIME_ENCODING;
+                        try {
+                                // Prepare to issue the warning message
+                                final Transformer tran = super.getTransformer();
+                                if (tran != null) {
+                                    final ErrorListener errHandler = tran
+                                            .getErrorListener();
+                                    // Issue the warning message
+                                    if (null != errHandler
+                                            && m_sourceLocator != null) {
+                                        errHandler
+                                                .warning(new TransformerException(
+                                                        msg, m_sourceLocator));
+                                        errHandler
+                                                .warning(new TransformerException(
+                                                        msg2, m_sourceLocator));
+                                    } else {
+                                        System.out.println(msg);
+                                        System.out.println(msg2);
+                                    }
+                                } else {
+                                    System.out.println(msg);
+                                    System.out.println(msg2);
+                                }
+                            } catch (Exception e) {
+                            }
+
+                            // We said we are using UTF-8, so use it
+                            newEncoding = Encodings.DEFAULT_MIME_ENCODING;
+                            val = Encodings.DEFAULT_MIME_ENCODING; // to store the modified value into the properties a little later
+                            encodingInfo = Encodings.getEncodingInfo(newEncoding);
+
+                        } 
+                       // The encoding was good, or was forced to UTF-8 above
+                       
+                       
+                       // If there is already a non-default set encoding and we 
+                       // are trying to set the default encoding, skip the this block
+                       // as the non-default value is already the one to use.
+                       if (defaultVal == false || oldExplicitEncoding == null) {
+                           m_encodingInfo = encodingInfo;
+                           if (newEncoding != null)
+                               m_isUTF8 = newEncoding.equals(Encodings.DEFAULT_MIME_ENCODING);
+                           
+                           // if there was a previously set OutputStream
+                           OutputStream os = getOutputStream();
+                           if (os != null) {
+                               Writer w = getWriter();
+                               
+                               // If the writer was previously set, but
+                               // set by the user, or if the new encoding is the same
+                               // as the old encoding, skip this block
+                               String oldEncoding = getOutputProperty(OutputKeys.ENCODING);
+                               if ((w == null || !m_writer_set_by_user) 
+                                       && !newEncoding.equalsIgnoreCase(oldEncoding)) {
+                                   // Make the change of encoding in our internal
+                                   // table, then call setOutputStreamInternal
+                                   // which will stomp on the old Writer (if any)
+                                   // with a new Writer with the new encoding.
+                                   super.setProp(name, val, defaultVal);
+                                   setOutputStreamInternal(os,false);
+                               }
+                           }
+                       }
+                    }
+                }
+                break;
+            case 'i':
+                if (OutputPropertiesFactory.S_KEY_INDENT_AMOUNT.equals(name)) {
+                    setIndentAmount(Integer.parseInt(val));
+                } else if (OutputKeys.INDENT.equals(name)) {
+                    boolean b = "yes".equals(val) ? true : false;
+                    m_doIndent = b;
+                }
+
+                break;
+            case 'l':
+                if (OutputPropertiesFactory.S_KEY_LINE_SEPARATOR.equals(name)) {
+                    m_lineSep = val.toCharArray();
+                    m_lineSepLen = m_lineSep.length;
+                }
+
+                break;
+            case 'm':
+                if (OutputKeys.MEDIA_TYPE.equals(name)) {
+                    m_mediatype = val;
+                }
+                break;
+            case 'o':
+                if (OutputKeys.OMIT_XML_DECLARATION.equals(name)) {
+                    boolean b = "yes".equals(val) ? true : false;
+                    this.m_shouldNotWriteXMLHeader = b;
+                }
+                break;
+            case 's':
+                // if standalone was explicitly specified
+                if (OutputKeys.STANDALONE.equals(name)) {
+                    if (defaultVal) {
+                        setStandaloneInternal(val);
+                    } else {
+                        m_standaloneWasSpecified = true;
+                        setStandaloneInternal(val);
+                    }
+                }
+
+                break;
+            case 'v':
+                if (OutputKeys.VERSION.equals(name)) {
+                    m_version = val;
+                }
+                break;
+            default:
+                break;
+
+            } 
+            super.setProp(name, val, defaultVal);
+        }
+    }
     /**
      * Specifies an output format for this serializer. It the
      * serializer has already been associated with an output format,
@@ -391,123 +555,32 @@
     {
 
         boolean shouldFlush = m_shouldFlush;
-
-        init(m_writer, format, false, false);
-
-        m_shouldFlush = shouldFlush;
-    }
-
-    /**
-     * Initialize the serializer with the specified writer and output format.
-     * Must be called before calling any of the serialize methods.
-     * This method can be called multiple times and the xsl:output properties
-     * passed in the 'format' parameter are accumulated across calls.
-     *
-     * @param writer The writer to use
-     * @param format The output format
-     * @param shouldFlush True if the writer should be flushed at EndDocument.
-     */
-    private synchronized void init(
-        Writer writer,
-        Properties format,
-        boolean defaultProperties,
-        boolean shouldFlush)
-    {
-
-        m_shouldFlush = shouldFlush;
-
         
-        // if we are tracing events we need to trace what
-        // characters are written to the output writer.
-        if (m_tracer != null
-         && !(writer instanceof SerializerTraceWriter)  )
-            setWriterInternal(new SerializerTraceWriter(writer, m_tracer), false);
-        else
-            setWriterInternal(writer, false);        
-        
-        if (m_format == null)
-            m_format = new java.util.Properties();
         if (format != null)
         {
-            Enumeration propNames = format.propertyNames();
+            // Set the default values first,
+            // and the non-default values after that, 
+            // just in case there is some unexpected
+            // residual values left over from over-ridden default values
+            Enumeration propNames;
+            propNames = format.propertyNames();
             while (propNames.hasMoreElements())
             {
                 String key = (String) propNames.nextElement();
+                // Get the value, possibly a default value
                 String value = format.getProperty(key);
-                m_format.setProperty(key, value);
+                // Get the non-default value (if any).
+                String explicitValue = (String) format.get(key);
+                if (explicitValue == null && value != null) {
+                    // This is a default value
+                    this.setOutputPropertyDefault(key,value);
+                }
+                if (explicitValue != null) {
+                    // This is an explicit non-default value
+                    this.setOutputProperty(key,explicitValue);
+                }
             } 
-        }
-
-        String cdataSectionNames = format.getProperty(OutputKeys.CDATA_SECTION_ELEMENTS);
-        addCdataSectionElements(cdataSectionNames);
-
-        setIndentAmount(
-            OutputPropertyUtils.getIntProperty(
-                OutputPropertiesFactory.S_KEY_INDENT_AMOUNT,
-                format));
-
-        String vall = format.getProperty(OutputKeys.INDENT);
-        if (vall != null) {
-            setIndent(
-                OutputPropertyUtils.getBooleanProperty(OutputKeys.INDENT, format));
-        }
-
-        {
-            String sep = 
-                    format.getProperty(OutputPropertiesFactory.S_KEY_LINE_SEPARATOR);
-            if (sep != null) {
-            	this.setNewLine(sep.toCharArray());
-            }
-        }
-
-        boolean shouldNotWriteXMLHeader =
-            OutputPropertyUtils.getBooleanProperty(
-                OutputKeys.OMIT_XML_DECLARATION,
-                format);
-        setOmitXMLDeclaration(shouldNotWriteXMLHeader);
-        setDoctypeSystem(format.getProperty(OutputKeys.DOCTYPE_SYSTEM));
-        String doctypePublic = format.getProperty(OutputKeys.DOCTYPE_PUBLIC);
-        setDoctypePublic(doctypePublic);
-
-        // if standalone was explicitly specified
-        if (format.get(OutputKeys.STANDALONE) != null)
-        {
-            String val = format.getProperty(OutputKeys.STANDALONE);
-            if (defaultProperties)
-                setStandaloneInternal(val);
-            else
-                setStandalone(val);
-        }
-
-        setMediaType(format.getProperty(OutputKeys.MEDIA_TYPE));
-
-        if (null != doctypePublic)
-        {
-            if (doctypePublic.startsWith("-//W3C//DTD XHTML"))
-                m_spaceBeforeClose = true;
-        }
-
-        /* 
-         * This code is added for XML 1.1 Version output.
-         */
-        String version = getVersion();
-        if (null == version)
-        {
-            version = format.getProperty(OutputKeys.VERSION);
-            setVersion(version);
-        }
-
-        // initCharsMap();
-        String previous_encoding = getEncoding();
-        String possible_encoding =  
-            Encodings.getMimeEncoding(format.getProperty(OutputKeys.ENCODING));
-        if (previous_encoding == null || defaultProperties == false) {
-        	// Only set the encoding if there was no previous encoding, or if we are
-        	// setting a value that is not a default value, because we don't
-        	// want to stomp on a previously set non-default one with the default one.
-        	setEncoding(possible_encoding);
-        }
-
+        }   
 
         // Access this only from the Hashtable level... we don't want to 
         // get default properties.
@@ -523,6 +596,60 @@
             m_charInfo = CharInfo.getCharInfo(entitiesFileName, method);
         }
 
+
+         
+
+        m_shouldFlush = shouldFlush;
+    }
+
+    /**
+     * Returns the output format for this serializer.
+     *
+     * @return The output format in use
+     */
+    public Properties getOutputFormat() {
+        Properties def = new Properties();
+        {
+            Set s = getOutputPropDefaultKeys();
+            Iterator i = s.iterator();
+            while (i.hasNext()) {
+                String key = (String) i.next();
+                String val = getOutputPropertyDefault(key);
+                def.put(key, val);
+            }
+        }
+        
+        Properties props = new Properties(def);
+        {
+            Set s = getOutputPropKeys();
+            Iterator i = s.iterator();
+            while (i.hasNext()) {
+                String key = (String) i.next();
+                String val = getOutputPropertyNonDefault(key);
+                if (val != null)
+                    props.put(key, val);
+            }
+        }
+        return props;
+    }
+
+    /**
+     * Specifies a writer to which the document should be serialized.
+     * This method should not be called while the serializer is in
+     * the process of serializing a document.
+     *
+     * @param writer The output writer stream
+     */
+    public void setWriter(Writer writer)
+    {        
+        setWriterInternal(writer, true);
+    }
+    
+    private boolean m_writer_set_by_user;
+    private void setWriterInternal(Writer writer, boolean setByUser) {
+
+        m_writer_set_by_user = setByUser;
+        m_writer = writer;
         // if we are tracing events we need to trace what
         // characters are written to the output writer.
         if (m_tracer != null) {
@@ -536,142 +663,9 @@
                 w2 = ((WriterChain)w2).getWriter();
             }
             if (noTracerYet)
-                setWriterInternal(new SerializerTraceWriter(m_writer, m_tracer), false);
+                m_writer = new SerializerTraceWriter(m_writer, m_tracer);
         }
     }
-
-    /**
-     * Initialize the serializer with the specified writer and output format.
-     * Must be called before calling any of the serialize methods.
-     *
-     * @param writer The writer to use
-     * @param format The output format
-     */
-    private synchronized void init(Writer writer, Properties format)
-    {
-        init(writer, format, false, false);
-    }
-    /**
-     * Initialize the serializer with the specified output stream and output
-     * format. Must be called before calling any of the serialize methods.
-     *
-     * @param output The output stream to use
-     * @param format The output format
-     * @param defaultProperties true if the properties are the default
-     * properties
-     * 
-     * @throws UnsupportedEncodingException The encoding specified   in the
-     * output format is not supported
-     */
-    protected synchronized void init(
-        OutputStream output,
-        Properties format,
-        boolean defaultProperties)
-        throws UnsupportedEncodingException
-    {
-
-        // Get the encoding in the format Properties, or UTF-8 if none in the format
-    	String previous_encoding = getEncoding();
-        String possible_encoding = Encodings.getMimeEncoding(format.getProperty(OutputKeys.ENCODING));
-        if (previous_encoding == null || defaultProperties == false ) {
-        	// Lets not stomp on an encoding that was already set, with one that is only coming from
-        	// a default set of properties.  So only do this setting of the encoding if either there
-        	// was no previously set encoding, or if this is not a default value for the encoding
-        	setEncoding(possible_encoding);
-        }
-        
-        // When all is said and done encoding may be possible_encoding, or
-        // if there was a problem with that one the encoding will be unchanged, so
-        // just get what it is.
-        String encoding = getEncoding();
-        	
-        
-        if (Encodings.DEFAULT_MIME_ENCODING.equalsIgnoreCase(encoding))
-        {
-                init(
-                    new WriterToUTF8Buffered(output),
-                    format,
-                    defaultProperties,
-                    true);
-
-
-        }
-        else if (
-        		"WINDOWS-1250".equals(encoding)
-                || "US-ASCII".equals(encoding)
-                || "ASCII".equals(encoding))
-        {
-            init(new WriterToASCI(output), format, defaultProperties, true);
-        }
-        else
-        {
-            Writer osw = null;
-
-            if (encoding == null)
-            	encoding = possible_encoding;
-            else {
-            	try
-            	{
-            		osw = Encodings.getWriter(output, encoding);
-            	}
-            	catch (UnsupportedEncodingException uee)
-            	{
-            		osw = null;
-            	}
-            }
-            
-            if (osw == null) {
-                System.out.println(
-                    "Warning: encoding \""
-                        + encoding
-                        + "\" not supported"
-                        + ", using "
-                        + Encodings.DEFAULT_MIME_ENCODING);
-
-                encoding = Encodings.DEFAULT_MIME_ENCODING;
-                setEncoding(encoding);
-                osw = Encodings.getWriter(output, encoding);
-            }
-
-            init(osw, format, defaultProperties, true);
-        }
-
-    }
-
-    /**
-     * Returns the output format for this serializer.
-     *
-     * @return The output format in use
-     */
-    public Properties getOutputFormat()
-    {
-        return m_format;
-    }
-
-    /**
-     * Specifies a writer to which the document should be serialized.
-     * This method should not be called while the serializer is in
-     * the process of serializing a document.
-     *
-     * @param writer The output writer stream
-     */
-    public void setWriter(Writer writer)
-    {        
-        // if we are tracing events we need to trace what 
-        // characters are written to the output writer.
-        if (m_tracer != null
-         && !(writer instanceof SerializerTraceWriter)  )
-            setWriterInternal(new SerializerTraceWriter(writer, m_tracer), true);
-        else
-            setWriterInternal(writer, true);
-    }
-    
-    private boolean m_writer_set_by_user;
-    private void setWriterInternal(Writer writer, boolean setByUser) {
-        if (setByUser)
-            m_writer_set_by_user = true;
-        m_writer = writer;
-    }
     
     /**
      * Set if the operating systems end-of-line line separator should
@@ -705,22 +699,60 @@
      */
     public void setOutputStream(OutputStream output)
     {
-
-        try
+        setOutputStreamInternal(output, true);
+    }
+    
+    private void setOutputStreamInternal(OutputStream output, boolean setByUser)
+    {
+        m_outputStream = output;
+        String encoding = getOutputProperty(OutputKeys.ENCODING);        
+        if (Encodings.DEFAULT_MIME_ENCODING.equalsIgnoreCase(encoding))
         {
-            Properties format;
-            if (null == m_format)
-                format =
-                    OutputPropertiesFactory.getDefaultMethodProperties(
-                        Method.XML);
-            else
-                format = m_format;
-            init(output, format, true);
+            // We wrap the OutputStream with a writer, but
+            // not one set by the user
+            setWriterInternal(new WriterToUTF8Buffered(output), false);
+        } else if (
+                "WINDOWS-1250".equals(encoding)
+                || "US-ASCII".equals(encoding)
+                || "ASCII".equals(encoding))
+        {
+            setWriterInternal(new WriterToASCI(output), false);
+        } else if (encoding != null) {
+            Writer osw = null;
+                try
+                {
+                    osw = Encodings.getWriter(output, encoding);
+                }
+                catch (UnsupportedEncodingException uee)
+                {
+                    osw = null;
+                }
+
+            
+            if (osw == null) {
+                System.out.println(
+                    "Warning: encoding \""
+                        + encoding
+                        + "\" not supported"
+                        + ", using "
+                        + Encodings.DEFAULT_MIME_ENCODING);
+
+                encoding = Encodings.DEFAULT_MIME_ENCODING;
+                setEncoding(encoding);
+                try {
+                    osw = Encodings.getWriter(output, encoding);
+                } catch (UnsupportedEncodingException e) {
+                    // We can't really get here, UTF-8 is always supported
+                    // This try-catch exists to make the compiler happy
+                    e.printStackTrace();
+                }
+            }
+            setWriterInternal(osw,false);
         }
-        catch (UnsupportedEncodingException uee)
-        {
-
-            // Should have been warned in init, I guess...
+        else {
+            // don't have any encoding, but we have an OutputStream
+            Writer osw = new OutputStreamWriter(output);
+            setWriterInternal(osw,false);
         }
     }
 
@@ -3250,61 +3282,7 @@
       */
      public void setEncoding(String encoding)
      {
-         final String old = getEncoding();
-         if (old == null || !old.equals(encoding)) {        
-            // We are trying to change the setting of the encoding to a different value
-            // from what it was
-            
-            EncodingInfo encodingInfo = Encodings.getEncodingInfo(encoding);
-            if (encoding != null && encodingInfo.name == null) {
-            	// We tried to get an EncodingInfo for Object for the given
-            	// encoding, but it came back with an internall null name
-            	// so the encoding is not supported by the JDK, issue a message.
-            	final String msg = Utils.messages.createMessage(
-            			MsgKey.ER_ENCODING_NOT_SUPPORTED,new Object[]{ encoding });
-            	
-            	final String msg2 = 
-            		"Warning: encoding \"" + encoding + "\" not supported, using "
-                        + Encodings.DEFAULT_MIME_ENCODING;
-            	try 
-            	{
-            		// Prepare to issue the warning message
-            		final Transformer tran = super.getTransformer();
-            		if (tran != null) {
-            			final ErrorListener errHandler = tran.getErrorListener();
-            			// Issue the warning message
-            			if (null != errHandler && m_sourceLocator != null) {
-            				errHandler.warning(new TransformerException(msg, m_sourceLocator));
-            				errHandler.warning(new TransformerException(msg2, m_sourceLocator));
-            			}
-            			else {
-            				System.out.println(msg);
-            				System.out.println(msg2);
-            			}
-            	    }
-            		else {
-            			System.out.println(msg);
-            			System.out.println(msg2);
-            		}
-            	}
-            	catch (Exception e){}
-            	
-            	// We said we are using UTF-8, so use it
-            	encoding = Encodings.DEFAULT_MIME_ENCODING;
-            	encodingInfo = Encodings.getEncodingInfo(encoding);
-            	//if (m_format != null) 
-            	//	m_format.setProperty(OutputKeys.ENCODING,Encodings.DEFAULT_MIME_ENCODING);
-            } else {
-
-            // Either the encoding was good, or it was forced into UTF-8. 
-            // In any case we remember it for later.
-            m_encodingInfo = encodingInfo;
-            this.m_encoding = encoding;                
-            if (encoding != null)
-            	m_isUTF8 = encoding.equals(Encodings.DEFAULT_MIME_ENCODING);
-            }
-         }
-         return;
+         setOutputProperty(OutputKeys.ENCODING,encoding);
      }
      
     /**
diff --git a/src/org/apache/xml/serializer/WriterToUTF8Buffered.java b/src/org/apache/xml/serializer/WriterToUTF8Buffered.java
index 435c42a..05d9852 100644
--- a/src/org/apache/xml/serializer/WriterToUTF8Buffered.java
+++ b/src/org/apache/xml/serializer/WriterToUTF8Buffered.java
@@ -77,7 +77,6 @@
    * @throws UnsupportedEncodingException
    */
   public WriterToUTF8Buffered(OutputStream out)
-          throws UnsupportedEncodingException
   {
       m_os = out;
       // get 3 extra bytes to make buffer overflow checking simpler and faster
diff --git a/src/org/apache/xml/serializer/XSLOutputAttributes.java b/src/org/apache/xml/serializer/XSLOutputAttributes.java
index 32da626..4b5c722 100644
--- a/src/org/apache/xml/serializer/XSLOutputAttributes.java
+++ b/src/org/apache/xml/serializer/XSLOutputAttributes.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2003-2004 The Apache Software Foundation.
+ * Copyright 2003-2006 The Apache Software Foundation.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -177,4 +177,58 @@
      */
     public void setVersion(String version);
 
+    /**
+     * Get the value for a property that affects seraialization,
+     * if a property was set return that value, otherwise return
+     * the default value, otherwise return null.
+     * @param name The name of the property, which is just the local name
+     * if it is in no namespace, but is the URI in curly braces followed by
+     * the local name if it is in a namespace, for example:
+     * <ul>
+     * <li> "encoding"
+     * <li> "method"
+     * <li> "{http://xml.apache.org/xalan}indent-amount"
+     * <li> "{http://xml.apache.org/xalan}line-separator"
+     * </ul>
+     * @return The value of the parameter
+     */
+    public String getOutputProperty(String name);
+    /**
+     * Get the default value for a property that affects seraialization,
+     * or null if there is none. It is possible that a non-default value
+     * was set for the property, however the value returned by this method
+     * is unaffected by any non-default settings.
+     * @param name The name of the property.
+     * @return The default value of the parameter, or null if there is no default value.
+     */    
+    public String getOutputPropertyDefault(String name);
+    /**
+     * Set the non-default value for a property that affects seraialization.
+     * @param name The name of the property, which is just the local name
+     * if it is in no namespace, but is the URI in curly braces followed by
+     * the local name if it is in a namespace, for example:
+     * <ul>
+     * <li> "encoding"
+     * <li> "method"
+     * <li> "{http://xml.apache.org/xalan}indent-amount"
+     * <li> "{http://xml.apache.org/xalan}line-separator"
+     * </ul>
+     * @val The non-default value of the parameter
+     */    
+    public void   setOutputProperty(String name, String val);
+    
+    /**
+     * Set the default value for a property that affects seraialization.
+     * @param name The name of the property, which is just the local name
+     * if it is in no namespace, but is the URI in curly braces followed by
+     * the local name if it is in a namespace, for example:
+     * <ul>
+     * <li> "encoding"
+     * <li> "method"
+     * <li> "{http://xml.apache.org/xalan}indent-amount"
+     * <li> "{http://xml.apache.org/xalan}line-separator"
+     * </ul>
+     * @val The default value of the parameter
+     */ 
+    public void   setOutputPropertyDefault(String name, String val);
 }