changeset 24890:12e7286572ef

Merge
author lana
date Wed, 18 Jun 2014 10:08:42 -0700
parents 8602afc014fb 98666dcb5f5e
children db8a9b8ab674
files
diffstat 32 files changed, 929 insertions(+), 548 deletions(-) [+]
line wrap: on
line diff
--- a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/runtime/AbstractTranslet.java	Fri Jun 13 11:21:26 2014 -0700
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/runtime/AbstractTranslet.java	Wed Jun 18 10:08:42 2014 -0700
@@ -3,9 +3,11 @@
  * DO NOT REMOVE OR ALTER!
  */
 /*
- * Copyright 2001-2004 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the  "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -32,7 +34,6 @@
 import java.text.DecimalFormatSymbols;
 import java.util.ArrayList;
 import java.util.Enumeration;
-import java.util.Vector;
 import javax.xml.transform.Templates;
 import javax.xml.parsers.DocumentBuilderFactory;
 import org.w3c.dom.Document;
@@ -51,6 +52,7 @@
 import com.sun.org.apache.xalan.internal.xsltc.runtime.output.TransletOutputHandlerFactory;
 import com.sun.org.apache.xml.internal.dtm.DTMAxisIterator;
 import com.sun.org.apache.xml.internal.serializer.SerializationHandler;
+import com.sun.org.apache.xml.internal.serializer.ToStream;
 
 /**
  * @author Jacek Ambroziak
@@ -74,7 +76,7 @@
     public String  _doctypeSystem = null;
     public boolean _indent = false;
     public String  _mediaType = null;
-    public Vector _cdata = null;
+    public ArrayList<String> _cdata = null;
     public int _indentamount = -1;
 
     public static final int FIRST_TRANSLET_VERSION = 100;
@@ -642,7 +644,7 @@
      */
     public void addCdataElement(String name) {
         if (_cdata == null) {
-            _cdata = new Vector();
+            _cdata = new ArrayList<>();
         }
 
         int lastColon = name.lastIndexOf(':');
@@ -650,11 +652,11 @@
         if (lastColon > 0) {
             String uri = name.substring(0, lastColon);
             String localName = name.substring(lastColon+1);
-            _cdata.addElement(uri);
-            _cdata.addElement(localName);
+            _cdata.add(uri);
+            _cdata.add(localName);
         } else {
-            _cdata.addElement(null);
-            _cdata.addElement(name);
+            _cdata.add(null);
+            _cdata.add(name);
         }
     }
 
--- a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/trax/TransformerImpl.java	Fri Jun 13 11:21:26 2014 -0700
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/trax/TransformerImpl.java	Wed Jun 18 10:08:42 2014 -0700
@@ -3,9 +3,11 @@
  * DO NOT REMOVE OR ALTER!
  */
 /*
- * Copyright 2001-2004 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the  "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -40,7 +42,7 @@
 import java.util.Enumeration;
 import java.util.Properties;
 import java.util.StringTokenizer;
-import java.util.Vector;
+import java.util.ArrayList;
 import java.lang.reflect.Constructor;
 
 import javax.xml.parsers.DocumentBuilder;
@@ -1084,7 +1086,7 @@
             else if (name.equals(OutputKeys.CDATA_SECTION_ELEMENTS)) {
                 if (value != null) {
                     StringTokenizer e = new StringTokenizer(value);
-                    Vector uriAndLocalNames = null;
+                    ArrayList<String> uriAndLocalNames = null;
                     while (e.hasMoreTokens()) {
                         final String token = e.nextToken();
 
@@ -1104,11 +1106,11 @@
                         }
 
                         if (uriAndLocalNames == null) {
-                            uriAndLocalNames = new Vector();
+                            uriAndLocalNames = new ArrayList<>();
                         }
                         // add the uri/localName as a pair, in that order
-                        uriAndLocalNames.addElement(uri);
-                        uriAndLocalNames.addElement(localName);
+                        uriAndLocalNames.add(uri);
+                        uriAndLocalNames.add(localName);
                     }
                     handler.setCdataSectionElements(uriAndLocalNames);
                 }
--- a/jaxp/src/com/sun/org/apache/xerces/internal/dom/EntityReferenceImpl.java	Fri Jun 13 11:21:26 2014 -0700
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/dom/EntityReferenceImpl.java	Wed Jun 18 10:08:42 2014 -0700
@@ -347,7 +347,7 @@
      * @see DocumentTypeImpl
      * @see EntityImpl
      */
-    // The Xerces parser invokes callbacks for startEnityReference
+    // The Xerces parser invokes callbacks for startEntityReference
     // the parsed value of the entity EACH TIME, so it is actually
     // easier to create the nodes through the callbacks rather than
     // clone the Entity.
--- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLDTDScannerImpl.java	Fri Jun 13 11:21:26 2014 -0700
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLDTDScannerImpl.java	Wed Jun 18 10:08:42 2014 -0700
@@ -585,7 +585,7 @@
         boolean reportEntity = fReportEntity;
         if (name.startsWith("%")) {
             reportEntity = peekReportEntity();
-            // check well-formedness of the enity
+            // check well-formedness of the entity
             int startMarkUpDepth = popPEStack();
             // throw fatalError if this entity was incomplete and
             // was a freestanding decl
--- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLDocumentFragmentScannerImpl.java	Fri Jun 13 11:21:26 2014 -0700
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLDocumentFragmentScannerImpl.java	Wed Jun 18 10:08:42 2014 -0700
@@ -2728,7 +2728,7 @@
                     //if the last section was character data
                     if(fLastSectionWasCharacterData){
 
-                        //if we dont encounter any CDATA or ENITY REFERENCE and current state is also not SCANNER_STATE_CHARACTER_DATA
+                        //if we dont encounter any CDATA or ENTITY REFERENCE and current state is also not SCANNER_STATE_CHARACTER_DATA
                         //return the last scanned charactrer data.
                         if((fScannerState != SCANNER_STATE_CDATA) && (fScannerState != SCANNER_STATE_REFERENCE)
                         && (fScannerState != SCANNER_STATE_CHARACTER_DATA)){
--- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/dtd/XMLDTDValidator.java	Fri Jun 13 11:21:26 2014 -0700
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/dtd/XMLDTDValidator.java	Wed Jun 18 10:08:42 2014 -0700
@@ -1218,7 +1218,7 @@
                     // references appear in the document.
                     // REVISIT: this can be combined to a single check in
                     // startEntity if we add one more argument in
-                    // startEnity, inAttrValue
+                    // startEntity, inAttrValue
                     String nonNormalizedValue = attributes.getNonNormalizedValue(i);
                     if (nonNormalizedValue != null) {
                         String entityName = getExternalEntityRefInAttrValue(nonNormalizedValue);
--- a/jaxp/src/com/sun/org/apache/xerces/internal/xpointer/ElementSchemePointer.java	Fri Jun 13 11:21:26 2014 -0700
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/xpointer/ElementSchemePointer.java	Wed Jun 18 10:08:42 2014 -0700
@@ -559,11 +559,13 @@
          * @param token The token string
          */
         private void addToken(String tokenStr) {
-            if (!fTokenNames.containsValue(tokenStr)) {
-                Integer tokenInt = new Integer(fTokenNames.size());
+            String str = fTokenNames.get(tokenStr);
+            Integer tokenInt = str == null ? null : Integer.parseInt(str);
+            if (tokenInt == null) {
+                tokenInt = new Integer(fTokenNames.size());
                 fTokenNames.put(tokenInt, tokenStr);
-                addToken(tokenInt.intValue());
             }
+            addToken(tokenInt.intValue());
         }
 
         /**
--- a/jaxp/src/com/sun/org/apache/xerces/internal/xpointer/XPointerHandler.java	Fri Jun 13 11:21:26 2014 -0700
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/xpointer/XPointerHandler.java	Wed Jun 18 10:08:42 2014 -0700
@@ -524,11 +524,13 @@
          * @param token The token string
          */
         private void addToken(String tokenStr) {
-            if (!fTokenNames.containsValue(tokenStr)) {
-                Integer tokenInt = new Integer(fTokenNames.size());
+            String str = fTokenNames.get(tokenStr);
+            Integer tokenInt = str == null ? null : Integer.parseInt(str);
+            if (tokenInt == null) {
+                tokenInt = new Integer(fTokenNames.size());
                 fTokenNames.put(tokenInt, tokenStr);
-                addToken(tokenInt.intValue());
             }
+            addToken(tokenInt.intValue());
         }
 
         /**
@@ -1251,4 +1253,4 @@
         super.setProperty(propertyId, value);
     }
 
-}
+}
\ No newline at end of file
--- a/jaxp/src/com/sun/org/apache/xml/internal/dtm/DTMConfigurationException.java	Fri Jun 13 11:21:26 2014 -0700
+++ b/jaxp/src/com/sun/org/apache/xml/internal/dtm/DTMConfigurationException.java	Wed Jun 18 10:08:42 2014 -0700
@@ -32,7 +32,7 @@
 
     /**
      * Create a new <code>DTMConfigurationException</code> with no
-     * detail mesage.
+     * detail message.
      */
     public DTMConfigurationException() {
         super("Configuration Error");
--- a/jaxp/src/com/sun/org/apache/xml/internal/serializer/EmptySerializer.java	Fri Jun 13 11:21:26 2014 -0700
+++ b/jaxp/src/com/sun/org/apache/xml/internal/serializer/EmptySerializer.java	Wed Jun 18 10:08:42 2014 -0700
@@ -3,9 +3,11 @@
  * DO NOT REMOVE OR ALTER!
  */
 /*
- * Copyright 2003-2004 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the  "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -27,7 +29,7 @@
 import java.io.Writer;
 import java.util.Hashtable;
 import java.util.Properties;
-import java.util.Vector;
+import java.util.ArrayList;
 
 import javax.xml.transform.SourceLocator;
 import javax.xml.transform.Transformer;
@@ -150,9 +152,9 @@
         couldThrowIOException();
     }
     /**
-     * @see SerializationHandler#setCdataSectionElements(java.util.Vector)
+     * @see SerializationHandler#setCdataSectionElements(java.util.ArrayList<String>)
      */
-    public void setCdataSectionElements(Vector URI_and_localNames)
+    public void setCdataSectionElements(ArrayList<String> URI_and_localNames)
     {
         aMethodIsCalled();
     }
@@ -763,4 +765,25 @@
         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();
+
+    }
 }
--- a/jaxp/src/com/sun/org/apache/xml/internal/serializer/SerializerBase.java	Fri Jun 13 11:21:26 2014 -0700
+++ b/jaxp/src/com/sun/org/apache/xml/internal/serializer/SerializerBase.java	Wed Jun 18 10:08:42 2014 -0700
@@ -3,9 +3,11 @@
  * DO NOT REMOVE OR ALTER!
  */
 /*
- * Copyright 2001-2004 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the  "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -23,8 +25,11 @@
 package com.sun.org.apache.xml.internal.serializer;
 
 import java.io.IOException;
-import java.util.Vector;
+import java.util.HashMap;
+import java.util.Set;
+import java.util.ArrayList;
 
+import javax.xml.transform.OutputKeys;
 import javax.xml.transform.SourceLocator;
 import javax.xml.transform.Transformer;
 
@@ -108,12 +113,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
@@ -122,15 +127,9 @@
     boolean m_needToOutputDocTypeDecl = true;
 
     /**
-     * The character encoding.  Must match the encoding used for the
-     * printWriter.
-     */
-    private 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.
@@ -159,12 +158,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
@@ -173,13 +172,6 @@
     private Transformer m_transformer;
 
     /**
-     * Pairs of local names and corresponding URIs of CDATA sections. This list
-     * comes from the cdata-section-elements attribute. Every second one is a
-     * local name, and every other second one is the URI for the local name.
-     */
-    protected Vector m_cdataSectionElements = null;
-
-    /**
      * Namespace support, that keeps track of currently defined
      * prefix/uri mappings. As processed elements come and go, so do
      * the associated mappings for that element.
@@ -538,16 +530,16 @@
      */
     public String getEncoding()
     {
-        return m_encoding;
+        return getOutputProperty(OutputKeys.ENCODING);
     }
 
    /**
      * Sets the character encoding coming from the xsl:output encoding stylesheet attribute.
      * @param m_encoding the character encoding
      */
-    public void setEncoding(String m_encoding)
+    public void setEncoding(String encoding)
     {
-        this.m_encoding = m_encoding;
+        setOutputProperty(OutputKeys.ENCODING,encoding);
     }
 
     /**
@@ -557,7 +549,8 @@
      */
     public void setOmitXMLDeclaration(boolean b)
     {
-        this.m_shouldNotWriteXMLHeader = b;
+        String val = b ? "yes":"no";
+        setOutputProperty(OutputKeys.OMIT_XML_DECLARATION,val);
     }
 
 
@@ -588,7 +581,7 @@
       */
     public void setDoctypePublic(String doctypePublic)
     {
-        this.m_doctypePublic = doctypePublic;
+        setOutputProperty(OutputKeys.DOCTYPE_PUBLIC, doctypePublic);
     }
 
 
@@ -610,7 +603,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
@@ -621,8 +614,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);
     }
 
     /**
@@ -634,12 +627,9 @@
      */
     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
      * default or explicite setting.
@@ -700,7 +690,7 @@
      */
     public void setVersion(String version)
     {
-        m_version = version;
+        setOutputProperty(OutputKeys.VERSION, version);
     }
 
     /**
@@ -712,7 +702,7 @@
      */
     public void setMediaType(String mediaType)
     {
-        m_mediatype = mediaType;
+        setOutputProperty(OutputKeys.MEDIA_TYPE,mediaType);
     }
 
     /**
@@ -741,7 +731,8 @@
      */
     public void setIndent(boolean doIndent)
     {
-        m_doIndent = doIndent;
+        String val = doIndent ? "yes":"no";
+        setOutputProperty(OutputKeys.INDENT,val);
     }
 
     /**
@@ -787,59 +778,6 @@
     }
 
     /**
-     * Push a boolean state based on if the name of the current element
-     * is found in the list of qnames.  A state is only pushed if
-     * there were some cdata-section-names were specified.
-     * <p>
-     * Hidden parameters are the vector of qualified elements specified in
-     * cdata-section-names attribute, and the m_cdataSectionStates stack
-     * onto which whether the current element is in the list is pushed (true or
-     * false). Other hidden parameters are the current elements namespaceURI,
-     * localName and qName
-     */
-    protected boolean isCdataSection()
-    {
-
-        boolean b = false;
-
-        if (null != m_cdataSectionElements)
-        {
-            if (m_elemContext.m_elementLocalName == null)
-                m_elemContext.m_elementLocalName =
-                    getLocalName(m_elemContext.m_elementName);
-            if (m_elemContext.m_elementURI == null)
-            {
-                String prefix = getPrefixPart(m_elemContext.m_elementName);
-                if (prefix != null)
-                    m_elemContext.m_elementURI =
-                        m_prefixMap.lookupNamespace(prefix);
-
-            }
-
-            if ((null != m_elemContext.m_elementURI)
-                && m_elemContext.m_elementURI.length() == 0)
-                m_elemContext.m_elementURI = null;
-
-            int nElems = m_cdataSectionElements.size();
-
-            // loop through 2 at a time, as these are pairs of URI and localName
-            for (int i = 0; i < nElems; i += 2)
-            {
-                String uri = (String) m_cdataSectionElements.elementAt(i);
-                String loc = (String) m_cdataSectionElements.elementAt(i + 1);
-                if (loc.equals(m_elemContext.m_elementLocalName)
-                    && subPartMatch(m_elemContext.m_elementURI, uri))
-                {
-                    b = true;
-
-                    break;
-                }
-            }
-        }
-        return b;
-    }
-
-    /**
      * Tell if two strings are equal, without worry if the first string is null.
      *
      * @param p String reference, which may be null.
@@ -1312,12 +1250,11 @@
     private void resetSerializerBase()
     {
         this.m_attributes.clear();
-        this.m_cdataSectionElements = null;
+        this.m_StringOfCDATASections = null;
         this.m_elemContext = new ElemContext();
         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;
@@ -1399,4 +1336,333 @@
         // A particular sub-class of SerializerBase provides the implementation (if desired)
     }
 
+
+    /**
+     * The CDATA section names stored in a whitespace separateed list with
+     * each element being a word of the form "{uri}localName" This list
+     * comes from the cdata-section-elements attribute.
+     *
+     * This field replaces m_cdataSectionElements Vector.
+     */
+    protected String m_StringOfCDATASections = null;
+
+    boolean m_docIsEmpty = true;
+    void initCdataElems(String s)
+    {
+        if (s != null)
+        {
+            int max = s.length();
+
+            // true if we are in the middle of a pair of curly braces that delimit a URI
+            boolean inCurly = false;
+
+            // true if we found a URI but haven't yet processed the local name
+            boolean foundURI = false;
+
+            StringBuilder buf = new StringBuilder();
+            String uri = null;
+            String localName = null;
+
+            // parse through string, breaking on whitespaces.  I do this instead
+            // of a tokenizer so I can track whitespace inside of curly brackets,
+            // which theoretically shouldn't happen if they contain legal URLs.
+            for (int i = 0; i < max; i++)
+            {
+                char c = s.charAt(i);
+
+                if (Character.isWhitespace(c))
+                {
+                    if (!inCurly)
+                    {
+                        if (buf.length() > 0)
+                        {
+                            localName = buf.toString();
+                            if (!foundURI)
+                                uri = "";
+                            addCDATAElement(uri,localName);
+                            buf.setLength(0);
+                            foundURI = false;
+                        }
+                        continue;
+                    }
+                    else
+                        buf.append(c); // add whitespace to the URI
+                }
+                else if ('{' == c) // starting a URI
+                    inCurly = true;
+                else if ('}' == c)
+                {
+                    // we just ended a URI
+                    foundURI = true;
+                    uri = buf.toString();
+                    buf.setLength(0);
+                    inCurly = false;
+                }
+                else
+                {
+                    // append non-whitespace, non-curly to current URI or localName being gathered.
+                    buf.append(c);
+                }
+
+            }
+
+            if (buf.length() > 0)
+            {
+                // We have one last localName to process.
+                localName = buf.toString();
+                if (!foundURI)
+                    uri = "";
+                addCDATAElement(uri,localName);
+            }
+        }
+    }
+
+    protected java.util.HashMap<String, HashMap<String, String>> m_CdataElems = null;
+    private void addCDATAElement(String uri, String localName)
+    {
+        if (m_CdataElems == null) {
+            m_CdataElems = new java.util.HashMap<>();
+        }
+
+        HashMap<String,String> h = m_CdataElems.get(localName);
+        if (h == null) {
+            h = new HashMap<>();
+            m_CdataElems.put(localName,h);
+        }
+        h.put(uri,uri);
+
+    }
+
+
+    /**
+     * Return true if nothing has been sent to this result tree yet.
+     * <p>
+     * This is not a public API.
+     *
+     * @xsl.usage internal
+     */
+    public boolean documentIsEmpty() {
+        // If we haven't called startDocument() yet, then this document is empty
+        return m_docIsEmpty && (m_elemContext.m_currentElemDepth == 0);
+    }
+
+    /**
+     * Return true if the current element in m_elemContext
+     * is a CDATA section.
+     * CDATA sections are specified in the <xsl:output> attribute
+     * cdata-section-names or in the JAXP equivalent property.
+     * In any case the format of the value of such a property is:
+     * <pre>
+     * "{uri1}localName1 {uri2}localName2 . . . "
+     * </pre>
+     *
+     * <p>
+     * This method is not a public API, but is only used internally by the serializer.
+     */
+    protected boolean isCdataSection() {
+        boolean b = false;
+
+        if (null != m_StringOfCDATASections) {
+            if (m_elemContext.m_elementLocalName == null) {
+                String localName =  getLocalName(m_elemContext.m_elementName);
+                m_elemContext.m_elementLocalName = localName;
+            }
+
+            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();
+                }
+            }
+
+            HashMap<String, String> h = null;
+            if (m_CdataElems != null) {
+                h = m_CdataElems.get(m_elemContext.m_elementLocalName);
+            }
+            if (h != null) {
+                Object obj = h.get(m_elemContext.m_elementURI);
+                if (obj != null)
+                    b = true;
+            }
+
+        }
+        return b;
+    }
+
+    /**
+     * Before this call m_elementContext.m_elementURI is null,
+     * which means it is not yet known. After this call it
+     * is non-null, but possibly "" meaning that it is in the
+     * default namespace.
+     *
+     * @return The URI of the element, never null, but possibly "".
+     */
+    private String getElementURI() {
+        String uri = null;
+        // At this point in processing we have received all the
+        // namespace mappings
+        // As we still don't know the elements namespace,
+        // we now figure it out.
+
+        String prefix = getPrefixPart(m_elemContext.m_elementName);
+
+        if (prefix == null) {
+            // no prefix so lookup the URI of the default namespace
+            uri = m_prefixMap.lookupNamespace("");
+        } else {
+            uri = m_prefixMap.lookupNamespace(prefix);
+        }
+        if (uri == null) {
+            // We didn't find the namespace for the
+            // prefix ... ouch, that shouldn't happen.
+            // This is a hack, we really don't know
+            // the namespace
+            uri = EMPTYSTRING;
+        }
+
+        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<String, String> 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<String, String> m_OutputPropsDefault;
+
+    Set<String> getOutputPropDefaultKeys() {
+        return m_OutputPropsDefault.keySet();
+    }
+    Set<String> 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 = m_OutputPropsDefault.get(name);
+        else
+            val = 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 = 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;
+    }
 }
--- a/jaxp/src/com/sun/org/apache/xml/internal/serializer/ToHTMLStream.java	Fri Jun 13 11:21:26 2014 -0700
+++ b/jaxp/src/com/sun/org/apache/xml/internal/serializer/ToHTMLStream.java	Wed Jun 18 10:08:42 2014 -0700
@@ -3,9 +3,11 @@
  * DO NOT REMOVE OR ALTER!
  */
 /*
- * Copyright 2001-2004 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the  "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -349,84 +351,84 @@
 
 
         // ----------------------------------------------
-        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);
         elemDesc.setAttr("CHECKED", ElemDesc.ATTREMPTY);
@@ -435,24 +437,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);
         elemDesc.setAttr("DATA", ElemDesc.ATTRURL);
@@ -461,58 +463,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);
     }
 
@@ -1762,7 +1764,7 @@
              * lets determine if the current element is specified in the cdata-
              * section-elements list.
              */
-            if (m_cdataSectionElements != null)
+            if (m_StringOfCDATASections != null)
                 m_elemContext.m_isCdataSection = isCdataSection();
             if (m_doIndent)
             {
@@ -1776,55 +1778,8 @@
                 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
          * startElement() and before and endElement().
--- a/jaxp/src/com/sun/org/apache/xml/internal/serializer/ToSAXHandler.java	Fri Jun 13 11:21:26 2014 -0700
+++ b/jaxp/src/com/sun/org/apache/xml/internal/serializer/ToSAXHandler.java	Wed Jun 18 10:08:42 2014 -0700
@@ -22,7 +22,7 @@
  */
 package com.sun.org.apache.xml.internal.serializer;
 
-import java.util.Vector;
+import java.util.ArrayList;
 
 import org.xml.sax.Attributes;
 import org.xml.sax.ContentHandler;
@@ -234,9 +234,9 @@
     /**
      * Does nothing. The setting of CDATA section elements has an impact on
      * stream serializers.
-     * @see SerializationHandler#setCdataSectionElements(java.util.Vector)
+     * @see SerializationHandler#setCdataSectionElements(java.util.ArrayList<String>)
      */
-    public void setCdataSectionElements(Vector URI_and_localNames)
+    public void setCdataSectionElements(ArrayList<String> URI_and_localNames)
     {
         // do nothing
     }
--- a/jaxp/src/com/sun/org/apache/xml/internal/serializer/ToStream.java	Fri Jun 13 11:21:26 2014 -0700
+++ b/jaxp/src/com/sun/org/apache/xml/internal/serializer/ToStream.java	Wed Jun 18 10:08:42 2014 -0700
@@ -3,9 +3,11 @@
  * DO NOT REMOVE OR ALTER!
  */
 /*
- * Copyright 2001-2004 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the  "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -25,11 +27,15 @@
 import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
 import java.io.IOException;
 import java.io.OutputStream;
+import java.io.OutputStreamWriter;
 import java.io.UnsupportedEncodingException;
 import java.io.Writer;
+import java.util.Enumeration;
+import java.util.Iterator;
 import java.util.Properties;
+import java.util.Set;
 import java.util.StringTokenizer;
-import java.util.Vector;
+import java.util.ArrayList;
 
 import javax.xml.transform.ErrorListener;
 import javax.xml.transform.OutputKeys;
@@ -186,9 +192,6 @@
        */
     boolean m_isUTF8 = false;
 
-    /** The xsl:output properties. */
-    protected Properties m_format;
-
     /**
      * remembers if we are in between the startCDATA() and endCDATA() callbacks
      */
@@ -306,6 +309,7 @@
         }
     }
 
+    OutputStream m_outputStream;
     /**
      * Get the output stream where the events will be serialized to.
      *
@@ -314,13 +318,7 @@
      */
     public OutputStream getOutputStream()
     {
-
-        if (m_writer instanceof WriterToUTF8Buffered)
-            return ((WriterToUTF8Buffered) m_writer).getOutputStream();
-        if (m_writer instanceof WriterToASCI)
-            return ((WriterToASCI) m_writer).getOutputStream();
-        else
-            return null;
+        return m_outputStream;
     }
 
     // Implement DeclHandler
@@ -419,10 +417,174 @@
      */
     protected final void outputLineSep() throws IOException
     {
-
         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)) {
+                    addCdataSectionElements(val); // val is 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,
@@ -434,115 +596,34 @@
      */
     public void setOutputFormat(Properties format)
     {
-
         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)  )
-            m_writer = new SerializerTraceWriter(writer, m_tracer);
-        else
-            m_writer = writer;
-
-
-        m_format = format;
-        //        m_cdataSectionNames =
-        //            OutputProperties.getQNameProperties(
-        //                OutputKeys.CDATA_SECTION_ELEMENTS,
-        //                format);
-        setCdataSectionElements(OutputKeys.CDATA_SECTION_ELEMENTS, format);
-
-        setIndentAmount(
-            OutputPropertyUtils.getIntProperty(
-                OutputPropertiesFactory.S_KEY_INDENT_AMOUNT,
-                format));
-        setIndent(
-            OutputPropertyUtils.getBooleanProperty(OutputKeys.INDENT, format));
-
+        if (format != null)
         {
-            String sep =
-                    format.getProperty(OutputPropertiesFactory.S_KEY_LINE_SEPARATOR);
-            if (sep != null) {
-                m_lineSep = sep.toCharArray();
-                m_lineSepLen = sep.length();
+            // 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);
+                // 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);
+                }
             }
         }
 
-        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 encoding = getEncoding();
-        if (null == encoding)
-        {
-            encoding =
-                Encodings.getMimeEncoding(
-                    format.getProperty(OutputKeys.ENCODING));
-            setEncoding(encoding);
-        }
-
-        m_isUTF8 = encoding.equals(Encodings.DEFAULT_MIME_ENCODING);
-
         // Access this only from the Hashtable level... we don't want to
         // get default properties.
         String entitiesFileName =
@@ -557,107 +638,10 @@
             m_charInfo = CharInfo.getCharInfo(entitiesFileName, method);
         }
 
-    }
-
-    /**
-     * 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
-    {
-
-        String encoding = getEncoding();
-        if (encoding == null)
-        {
-            // if not already set then get it from the properties
-            encoding =
-                Encodings.getMimeEncoding(
-                    format.getProperty(OutputKeys.ENCODING));
-            setEncoding(encoding);
-        }
-
-        if (encoding.equalsIgnoreCase("UTF-8"))
-        {
-            m_isUTF8 = true;
-            //            if (output instanceof java.io.BufferedOutputStream)
-            //            {
-            //                init(new WriterToUTF8(output), format, defaultProperties, true);
-            //            }
-            //            else if (output instanceof java.io.FileOutputStream)
-            //            {
-            //                init(new WriterToUTF8Buffered(output), format, defaultProperties, true);
-            //            }
-            //            else
-            //            {
-            //                // Not sure what to do in this case.  I'm going to be conservative
-            //                // and not buffer.
-            //                init(new WriterToUTF8(output), format, defaultProperties, true);
-            //            }
-
-
-                init(
-                    new WriterToUTF8Buffered(output),
-                    format,
-                    defaultProperties,
-                    true);
-
-
-        }
-        else if (
-            encoding.equals("WINDOWS-1250")
-                || encoding.equals("US-ASCII")
-                || encoding.equals("ASCII"))
-        {
-            init(new WriterToASCI(output), format, defaultProperties, true);
-        }
-        else
-        {
-            Writer osw;
-
-            try
-            {
-                osw = Encodings.getWriter(output, encoding);
-            }
-            catch (UnsupportedEncodingException uee)
-            {
-                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);
-        }
-
+
+
+
+        m_shouldFlush = shouldFlush;
     }
 
     /**
@@ -665,9 +649,26 @@
      *
      * @return The output format in use
      */
-    public Properties getOutputFormat()
-    {
-        return m_format;
+    public Properties getOutputFormat() {
+        Properties def = new Properties();
+        {
+            Set<String> s = getOutputPropDefaultKeys();
+            for (String key : s) {
+                String val = getOutputPropertyDefault(key);
+                def.put(key, val);
+            }
+        }
+
+        Properties props = new Properties(def);
+        {
+            Set<String> s = getOutputPropKeys();
+            for (String key : s) {
+                String val = getOutputPropertyNonDefault(key);
+                if (val != null)
+                    props.put(key, val);
+            }
+        }
+        return props;
     }
 
     /**
@@ -679,13 +680,28 @@
      */
     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
-         && !(writer instanceof SerializerTraceWriter)  )
-            m_writer = new SerializerTraceWriter(writer, m_tracer);
-        else
-            m_writer = writer;
+        if (m_tracer != null) {
+            boolean noTracerYet = true;
+            Writer w2 = m_writer;
+            while (w2 instanceof WriterChain) {
+                if (w2 instanceof SerializerTraceWriter) {
+                    noTracerYet = false;
+                    break;
+                }
+                w2 = ((WriterChain)w2).getWriter();
+            }
+            if (noTracerYet)
+                m_writer = new SerializerTraceWriter(m_writer, m_tracer);
+        }
     }
 
     /**
@@ -720,25 +736,68 @@
      */
     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
+            try {
+                setWriterInternal(new WriterToUTF8Buffered(output), false);
+            } catch (UnsupportedEncodingException e) {
+                e.printStackTrace();
+            }
+        } 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);
         }
     }
 
+
     /**
      * @see SerializationHandler#setEscaping(boolean)
      */
@@ -2455,7 +2514,7 @@
              * lets determine if the current element is specified in the cdata-
              * section-elements list.
              */
-            if (m_cdataSectionElements != null)
+            if (m_StringOfCDATASections != null)
                 m_elemContext.m_isCdataSection = isCdataSection();
 
             if (m_doIndent)
@@ -2532,12 +2591,12 @@
      * @param   key   the property key.
      * @param props the list of properties to search in.
      *
-     * Sets the vector of local-name/URI pairs of the cdata section elements
+     * Sets the ArrayList of local-name/URI pairs of the cdata section elements
      * specified in the cdata-section-elements property.
      *
      * This method is essentially a copy of getQNameProperties() from
      * OutputProperties. Eventually this method should go away and a call
-     * to setCdataSectionElements(Vector v) should be made directly.
+     * to setCdataSectionElements(ArrayList<String> v) should be made directly.
      */
     private void setCdataSectionElements(String key, Properties props)
     {
@@ -2546,11 +2605,11 @@
 
         if (null != s)
         {
-            // Vector of URI/LocalName pairs
-            Vector v = new Vector();
+            // ArrayList<String> of URI/LocalName pairs
+            ArrayList<String> v = new ArrayList<>();
             int l = s.length();
             boolean inCurly = false;
-            StringBuffer buf = new StringBuffer();
+            StringBuilder buf = new StringBuilder();
 
             // parse through string, breaking on whitespaces.  I do this instead
             // of a tokenizer so I can track whitespace inside of curly brackets,
@@ -2597,7 +2656,7 @@
      *
      * @return a QName object
      */
-    private void addCdataSectionElement(String URI_and_localName, Vector v)
+    private void addCdataSectionElement(String URI_and_localName, ArrayList<String> v)
     {
 
         StringTokenizer tokenizer =
@@ -2608,14 +2667,14 @@
         if (null == s2)
         {
             // add null URI and the local name
-            v.addElement(null);
-            v.addElement(s1);
+            v.add(null);
+            v.add(s1);
         }
         else
         {
             // add URI, then local name
-            v.addElement(s1);
-            v.addElement(s2);
+            v.add(s1);
+            v.add(s2);
         }
     }
 
@@ -2624,11 +2683,38 @@
      * The "official way to set URI and localName pairs.
      * This method should be used by both Xalan and XSLTC.
      *
-     * @param URI_and_localNames a vector of pairs of Strings (URI/local)
+     * @param URI_and_localNames an ArrayList of pairs of Strings (URI/local)
      */
-    public void setCdataSectionElements(Vector URI_and_localNames)
+    public void setCdataSectionElements(ArrayList<String> URI_and_localNames)
     {
-        m_cdataSectionElements = URI_and_localNames;
+        // convert to the new way.
+        if (URI_and_localNames != null)
+        {
+            final int len = URI_and_localNames.size() - 1;
+            if (len > 0)
+            {
+                final StringBuilder sb = new StringBuilder();
+                for (int i = 0; i < len; i += 2)
+                {
+                    // whitspace separated "{uri1}local1 {uri2}local2 ..."
+                    if (i != 0)
+                        sb.append(' ');
+                    final String uri = (String) URI_and_localNames.get(i);
+                    final String localName =
+                        (String) URI_and_localNames.get(i + 1);
+                    if (uri != null)
+                    {
+                        // If there is no URI don't put this in, just the localName then.
+                        sb.append('{');
+                        sb.append(uri);
+                        sb.append('}');
+                    }
+                    sb.append(localName);
+                }
+                m_StringOfCDATASections = sb.toString();
+            }
+        }
+        initCdataElems(m_StringOfCDATASections);
     }
 
     /**
@@ -3084,37 +3170,7 @@
       */
      public void setEncoding(String encoding)
      {
-         String old = getEncoding();
-         super.setEncoding(encoding);
-         if (old == null || !old.equals(encoding)) {
-            // If we have changed the setting of the
-            m_encodingInfo = Encodings.getEncodingInfo(encoding);
-
-            if (encoding != null && m_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.
-                String msg = Utils.messages.createMessage(
-                                MsgKey.ER_ENCODING_NOT_SUPPORTED,new Object[]{ encoding });
-                try
-                {
-                        // Prepare to issue the warning message
-                        Transformer tran = super.getTransformer();
-                        if (tran != null) {
-                                ErrorListener errHandler = tran.getErrorListener();
-                                // Issue the warning message
-                                if (null != errHandler && m_sourceLocator != null)
-                                        errHandler.warning(new TransformerException(msg, m_sourceLocator));
-                                else
-                                        System.out.println(msg);
-                    }
-                        else
-                                System.out.println(msg);
-                }
-                catch (Exception e){}
-            }
-         }
-         return;
+         setOutputProperty(OutputKeys.ENCODING,encoding);
      }
 
     /**
@@ -3386,4 +3442,24 @@
     public void setDTDEntityExpansion(boolean expand) {
         m_expandDTDEntities = expand;
     }
+
+    /**
+     * Remembers the cdata sections specified in the cdata-section-elements by appending the given
+     * cdata section elements to the list. This method can be called multiple times, but once an
+     * element is put in the list of cdata section elements it can not be removed.
+     * This method should be used by both Xalan and XSLTC.
+     *
+     * @param URI_and_localNames a whitespace separated list of element names, each element
+     * is a URI in curly braces (optional) and a local name. An example of such a parameter is:
+     * "{http://company.com}price {myURI2}book chapter"
+     */
+    public void addCdataSectionElements(String URI_and_localNames)
+    {
+        if (URI_and_localNames != null)
+            initCdataElems(URI_and_localNames);
+        if (m_StringOfCDATASections == null)
+            m_StringOfCDATASections = URI_and_localNames;
+        else
+            m_StringOfCDATASections += (" " + URI_and_localNames);
+    }
 }
--- a/jaxp/src/com/sun/org/apache/xml/internal/serializer/ToUnknownStream.java	Fri Jun 13 11:21:26 2014 -0700
+++ b/jaxp/src/com/sun/org/apache/xml/internal/serializer/ToUnknownStream.java	Wed Jun 18 10:08:42 2014 -0700
@@ -26,7 +26,7 @@
 import java.io.OutputStream;
 import java.io.Writer;
 import java.util.Properties;
-import java.util.Vector;
+import java.util.ArrayList;
 
 import javax.xml.transform.SourceLocator;
 import javax.xml.transform.Transformer;
@@ -100,12 +100,12 @@
      * A collection of namespace URI's (only for first element).
      * _namespacePrefix has the matching prefix for these URI's
      */
-    private Vector m_namespaceURI = null;
+    private ArrayList<String> m_namespaceURI = null;
     /**
      * A collection of namespace Prefix (only for first element)
      * _namespaceURI has the matching URIs for these prefix'
      */
-    private Vector m_namespacePrefix = null;
+    private ArrayList<String> m_namespacePrefix = null;
 
     /**
      * true if startDocument() was called before the underlying handler
@@ -421,11 +421,11 @@
             {
                 if (m_namespacePrefix == null)
                 {
-                    m_namespacePrefix = new Vector();
-                    m_namespaceURI = new Vector();
+                    m_namespacePrefix = new ArrayList<>();
+                    m_namespaceURI = new ArrayList<>();
                 }
-                m_namespacePrefix.addElement(prefix);
-                m_namespaceURI.addElement(uri);
+                m_namespacePrefix.add(prefix);
+                m_namespaceURI.add(uri);
 
                 if (m_firstElementURI == null)
                 {
@@ -1092,8 +1092,8 @@
                 for (int i = 0; i < n; i++)
                 {
                     final String prefix =
-                        (String) m_namespacePrefix.elementAt(i);
-                    final String uri = (String) m_namespaceURI.elementAt(i);
+                        (String) m_namespacePrefix.get(i);
+                    final String uri = (String) m_namespaceURI.get(i);
                     m_handler.startPrefixMapping(prefix, uri, false);
                 }
                 m_namespacePrefix = null;
@@ -1165,8 +1165,8 @@
             final int max = m_namespacePrefix.size();
             for (int i = 0; i < max; i++)
             {
-                final String prefix = (String) m_namespacePrefix.elementAt(i);
-                final String uri = (String) m_namespaceURI.elementAt(i);
+                final String prefix = m_namespacePrefix.get(i);
+                final String uri = m_namespaceURI.get(i);
 
                 if (m_firstElementPrefix != null
                     && m_firstElementPrefix.equals(prefix)
@@ -1194,7 +1194,7 @@
      * specified in the cdata-section-elements attribute.
      * @see SerializationHandler#setCdataSectionElements(java.util.Vector)
      */
-    public void setCdataSectionElements(Vector URI_and_localNames)
+    public void setCdataSectionElements(ArrayList<String> URI_and_localNames)
     {
         m_handler.setCdataSectionElements(URI_and_localNames);
     }
--- a/jaxp/src/com/sun/org/apache/xml/internal/serializer/WriterToUTF8Buffered.java	Fri Jun 13 11:21:26 2014 -0700
+++ b/jaxp/src/com/sun/org/apache/xml/internal/serializer/WriterToUTF8Buffered.java	Wed Jun 18 10:08:42 2014 -0700
@@ -3,9 +3,11 @@
  * DO NOT REMOVE OR ALTER!
  */
 /*
- * Copyright 1999-2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the  "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  *
--- a/jaxp/src/com/sun/org/apache/xml/internal/serializer/XSLOutputAttributes.java	Fri Jun 13 11:21:26 2014 -0700
+++ b/jaxp/src/com/sun/org/apache/xml/internal/serializer/XSLOutputAttributes.java	Wed Jun 18 10:08:42 2014 -0700
@@ -3,9 +3,11 @@
  * DO NOT REMOVE OR ALTER!
  */
 /*
- * Copyright 2003-2004 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the  "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -22,7 +24,7 @@
  */
 package com.sun.org.apache.xml.internal.serializer;
 
-import java.util.Vector;
+import java.util.ArrayList;
 
 /**
  * This interface has methods associated with the XSLT xsl:output attribues
@@ -105,11 +107,6 @@
      */
     public String getVersion();
 
-
-
-
-
-
     /**
      * Sets the value coming from the xsl:output cdata-section-elements
      * stylesheet property.
@@ -124,7 +121,7 @@
      * relevant in specifying which elements have their text to be output as
      * CDATA sections.
      */
-    public void setCdataSectionElements(Vector URI_and_localNames);
+    public void setCdataSectionElements(ArrayList<String> URI_and_localNames);
 
     /** Set the value coming from the xsl:output doctype-public and doctype-system stylesheet properties
      * @param system the system identifier to be used in the DOCTYPE declaration
@@ -181,4 +178,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);
 }
--- a/jaxp/src/com/sun/xml/internal/stream/Entity.java	Fri Jun 13 11:21:26 2014 -0700
+++ b/jaxp/src/com/sun/xml/internal/stream/Entity.java	Wed Jun 18 10:08:42 2014 -0700
@@ -352,7 +352,7 @@
         }
 
         /**each 'external' parsed entity may have xml/text declaration containing version information
-         * @return String version of the enity, for an internal entity version would be null
+         * @return String version of the entity, for an internal entity version would be null
          */
         public String getEntityVersion(){
             return version ;
--- a/jaxp/src/com/sun/xml/internal/stream/StaxXMLInputSource.java	Fri Jun 13 11:21:26 2014 -0700
+++ b/jaxp/src/com/sun/xml/internal/stream/StaxXMLInputSource.java	Wed Jun 18 10:08:42 2014 -0700
@@ -34,7 +34,7 @@
  * @author  Neeraj
  *
  * This class wraps XMLInputSource and is also capable of telling wether application
- * returned XMLStreamReader or not when XMLResolver.resolveEnity
+ * returned XMLStreamReader or not when XMLResolver.resolveEntity
  * was called.
  */
 public class StaxXMLInputSource {
--- a/jaxp/src/javax/xml/datatype/DatatypeConfigurationException.java	Fri Jun 13 11:21:26 2014 -0700
+++ b/jaxp/src/javax/xml/datatype/DatatypeConfigurationException.java	Wed Jun 18 10:08:42 2014 -0700
@@ -36,7 +36,7 @@
 
     /**
      * <p>Create a new <code>DatatypeConfigurationException</code> with
-     * no specified detail mesage and cause.</p>
+     * no specified detail message and cause.</p>
      */
 
     public DatatypeConfigurationException() {
--- a/jaxp/src/javax/xml/datatype/DatatypeFactory.java	Fri Jun 13 11:21:26 2014 -0700
+++ b/jaxp/src/javax/xml/datatype/DatatypeFactory.java	Wed Jun 18 10:08:42 2014 -0700
@@ -119,7 +119,7 @@
         Pattern.compile("[^YM]*[DT].*");
 
     /**
-     * <p>Protected constructor to prevent instaniation outside of package.</p>
+     * <p>Protected constructor to prevent instantiation outside of package.</p>
      *
      * <p>Use {@link #newInstance()} to create a <code>DatatypeFactory</code>.</p>
      */
--- a/jaxp/src/javax/xml/namespace/QName.java	Fri Jun 13 11:21:26 2014 -0700
+++ b/jaxp/src/javax/xml/namespace/QName.java	Wed Jun 18 10:08:42 2014 -0700
@@ -83,7 +83,7 @@
      *
      * <p>To workaround this issue, serialVersionUID is set with either
      * a default value or a compatibility value.  To use the
-     * compatiblity value, set the system property:</p>
+     * compatibility value, set the system property:</p>
      *
      * <code>com.sun.xml.namespace.QName.useCompatibleSerialVersionUID=1.0</code>
      *
--- a/jaxp/src/javax/xml/parsers/DocumentBuilderFactory.java	Fri Jun 13 11:21:26 2014 -0700
+++ b/jaxp/src/javax/xml/parsers/DocumentBuilderFactory.java	Wed Jun 18 10:08:42 2014 -0700
@@ -423,7 +423,7 @@
      * <ul>
      *   <li>
      *     <code>true</code>: the implementation will limit XML processing to conform to implementation limits.
-     *     Examples include enity expansion limits and XML Schema constructs that would consume large amounts of resources.
+     *     Examples include entity expansion limits and XML Schema constructs that would consume large amounts of resources.
      *     If XML processing is limited for security reasons, it will be reported via a call to the registered
      *    {@link org.xml.sax.ErrorHandler#fatalError(SAXParseException exception)}.
      *     See {@link  DocumentBuilder#setErrorHandler(org.xml.sax.ErrorHandler errorHandler)}.
@@ -517,7 +517,7 @@
      * modified DOM trees.
      *
      * <p>
-     * Initialy, null is set as the {@link Schema}.
+     * Initially, null is set as the {@link Schema}.
      *
      * <p>
      * This processing will take effect even if
@@ -531,7 +531,7 @@
      * exception when the {@link #newDocumentBuilder()} is invoked.</p>
      *
      *
-     * <h4>Note for implmentors</h4>
+     * <h4>Note for implementors</h4>
      *
      * <p>
      * A parser must be able to work with any {@link Schema}
--- a/jaxp/src/javax/xml/parsers/FactoryConfigurationError.java	Fri Jun 13 11:21:26 2014 -0700
+++ b/jaxp/src/javax/xml/parsers/FactoryConfigurationError.java	Wed Jun 18 10:08:42 2014 -0700
@@ -45,7 +45,7 @@
 
     /**
      * Create a new <code>FactoryConfigurationError</code> with no
-     * detail mesage.
+     * detail message.
      */
 
     public FactoryConfigurationError() {
--- a/jaxp/src/javax/xml/parsers/ParserConfigurationException.java	Fri Jun 13 11:21:26 2014 -0700
+++ b/jaxp/src/javax/xml/parsers/ParserConfigurationException.java	Wed Jun 18 10:08:42 2014 -0700
@@ -35,7 +35,7 @@
 
     /**
      * Create a new <code>ParserConfigurationException</code> with no
-     * detail mesage.
+     * detail message.
      */
 
     public ParserConfigurationException() {
--- a/jaxp/src/javax/xml/parsers/SAXParser.java	Fri Jun 13 11:21:26 2014 -0700
+++ b/jaxp/src/javax/xml/parsers/SAXParser.java	Wed Jun 18 10:08:42 2014 -0700
@@ -69,7 +69,7 @@
  * given {@link org.xml.sax.HandlerBase} or the
  * {@link org.xml.sax.helpers.DefaultHandler} are called.<p>
  *
- * Implementors of this class which wrap an underlaying implementation
+ * Implementors of this class which wrap an underlying implementation
  * can consider using the {@link org.xml.sax.helpers.ParserAdapter}
  * class to initially adapt their SAX1 implementation to work under
  * this revised class.
@@ -79,7 +79,7 @@
 public abstract class SAXParser {
 
     /**
-     * <p>Protected constructor to prevent instaniation.
+     * <p>Protected constructor to prevent instantiation.
      * Use {@link javax.xml.parsers.SAXParserFactory#newSAXParser()}.</p>
      */
     protected SAXParser () {
@@ -393,10 +393,10 @@
     }
 
     /**
-     * Returns the SAX parser that is encapsultated by the
+     * Returns the SAX parser that is encapsulated by the
      * implementation of this class.
      *
-     * @return The SAX parser that is encapsultated by the
+     * @return The SAX parser that is encapsulated by the
      *         implementation of this class.
      *
      * @throws SAXException If any SAX errors occur during processing.
--- a/jaxp/src/javax/xml/parsers/SAXParserFactory.java	Fri Jun 13 11:21:26 2014 -0700
+++ b/jaxp/src/javax/xml/parsers/SAXParserFactory.java	Wed Jun 18 10:08:42 2014 -0700
@@ -359,7 +359,7 @@
      * is responsible to make sure that the application will receive
      * those modified event stream.</p>
      *
-     * <p>Initialy, <code>null</code> is set as the {@link Schema}.</p>
+     * <p>Initially, <code>null</code> is set as the {@link Schema}.</p>
      *
      * <p>This processing will take effect even if
      * the {@link #isValidating()} method returns <code>false</code>.
--- a/jaxp/src/javax/xml/transform/ErrorListener.java	Fri Jun 13 11:21:26 2014 -0700
+++ b/jaxp/src/javax/xml/transform/ErrorListener.java	Wed Jun 18 10:08:42 2014 -0700
@@ -28,7 +28,7 @@
 /**
  * <p>To provide customized error handling, implement this interface and
  * use the <code>setErrorListener</code> method to register an instance of the
- * implmentation with the {@link javax.xml.transform.Transformer}.  The
+ * implementation with the {@link javax.xml.transform.Transformer}.  The
  * <code>Transformer</code> then reports all errors and warnings through this
  * interface.</p>
  *
--- a/jaxp/src/javax/xml/transform/TransformerConfigurationException.java	Fri Jun 13 11:21:26 2014 -0700
+++ b/jaxp/src/javax/xml/transform/TransformerConfigurationException.java	Wed Jun 18 10:08:42 2014 -0700
@@ -32,7 +32,7 @@
 
     /**
      * Create a new <code>TransformerConfigurationException</code> with no
-     * detail mesage.
+     * detail message.
      */
     public TransformerConfigurationException() {
         super("Configuration Error");
--- a/jaxp/src/javax/xml/transform/TransformerFactoryConfigurationError.java	Fri Jun 13 11:21:26 2014 -0700
+++ b/jaxp/src/javax/xml/transform/TransformerFactoryConfigurationError.java	Wed Jun 18 10:08:42 2014 -0700
@@ -42,7 +42,7 @@
 
     /**
      * Create a new <code>TransformerFactoryConfigurationError</code> with no
-     * detail mesage.
+     * detail message.
      */
     public TransformerFactoryConfigurationError() {
 
--- a/jaxp/src/javax/xml/validation/SchemaFactory.java	Fri Jun 13 11:21:26 2014 -0700
+++ b/jaxp/src/javax/xml/validation/SchemaFactory.java	Wed Jun 18 10:08:42 2014 -0700
@@ -358,7 +358,7 @@
      * <ul>
      *   <li>
      *     <code>true</code>: the implementation will limit XML processing to conform to implementation limits.
-     *     Examples include enity expansion limits and XML Schema constructs that would consume large amounts of resources.
+     *     Examples include entity expansion limits and XML Schema constructs that would consume large amounts of resources.
      *     If XML processing is limited for security reasons, it will be reported via a call to the registered
      *    {@link ErrorHandler#fatalError(SAXParseException exception)}.
      *     See {@link #setErrorHandler(ErrorHandler errorHandler)}.
--- a/jaxp/src/javax/xml/validation/ValidatorHandler.java	Fri Jun 13 11:21:26 2014 -0700
+++ b/jaxp/src/javax/xml/validation/ValidatorHandler.java	Wed Jun 18 10:08:42 2014 -0700
@@ -379,7 +379,7 @@
      * <ul>
      *   <li>
      *     <code>true</code>: the implementation will limit XML processing to conform to implementation limits.
-     *     Examples include enity expansion limits and XML Schema constructs that would consume large amounts of resources.
+     *     Examples include entity expansion limits and XML Schema constructs that would consume large amounts of resources.
      *     If XML processing is limited for security reasons, it will be reported via a call to the registered
      *    {@link ErrorHandler#fatalError(SAXParseException exception)}.
      *     See {@link #setErrorHandler(ErrorHandler errorHandler)}.