jaxp/src/com/sun/org/apache/xml/internal/serializer/ToUnknownStream.java
changeset 24888 2e493ac78624
parent 12457 c348e06f0e82
child 25834 aba3efbf4ec5
equal deleted inserted replaced
24887:47b6d4800c64 24888:2e493ac78624
    24 
    24 
    25 import java.io.IOException;
    25 import java.io.IOException;
    26 import java.io.OutputStream;
    26 import java.io.OutputStream;
    27 import java.io.Writer;
    27 import java.io.Writer;
    28 import java.util.Properties;
    28 import java.util.Properties;
    29 import java.util.Vector;
    29 import java.util.ArrayList;
    30 
    30 
    31 import javax.xml.transform.SourceLocator;
    31 import javax.xml.transform.SourceLocator;
    32 import javax.xml.transform.Transformer;
    32 import javax.xml.transform.Transformer;
    33 
    33 
    34 import org.w3c.dom.Node;
    34 import org.w3c.dom.Node;
    98 
    98 
    99     /**
    99     /**
   100      * A collection of namespace URI's (only for first element).
   100      * A collection of namespace URI's (only for first element).
   101      * _namespacePrefix has the matching prefix for these URI's
   101      * _namespacePrefix has the matching prefix for these URI's
   102      */
   102      */
   103     private Vector m_namespaceURI = null;
   103     private ArrayList<String> m_namespaceURI = null;
   104     /**
   104     /**
   105      * A collection of namespace Prefix (only for first element)
   105      * A collection of namespace Prefix (only for first element)
   106      * _namespaceURI has the matching URIs for these prefix'
   106      * _namespaceURI has the matching URIs for these prefix'
   107      */
   107      */
   108     private Vector m_namespacePrefix = null;
   108     private ArrayList<String> m_namespacePrefix = null;
   109 
   109 
   110     /**
   110     /**
   111      * true if startDocument() was called before the underlying handler
   111      * true if startDocument() was called before the underlying handler
   112      * was initialized
   112      * was initialized
   113      */
   113      */
   419             }
   419             }
   420             else
   420             else
   421             {
   421             {
   422                 if (m_namespacePrefix == null)
   422                 if (m_namespacePrefix == null)
   423                 {
   423                 {
   424                     m_namespacePrefix = new Vector();
   424                     m_namespacePrefix = new ArrayList<>();
   425                     m_namespaceURI = new Vector();
   425                     m_namespaceURI = new ArrayList<>();
   426                 }
   426                 }
   427                 m_namespacePrefix.addElement(prefix);
   427                 m_namespacePrefix.add(prefix);
   428                 m_namespaceURI.addElement(uri);
   428                 m_namespaceURI.add(uri);
   429 
   429 
   430                 if (m_firstElementURI == null)
   430                 if (m_firstElementURI == null)
   431                 {
   431                 {
   432                     if (prefix.equals(m_firstElementPrefix))
   432                     if (prefix.equals(m_firstElementPrefix))
   433                         m_firstElementURI = uri;
   433                         m_firstElementURI = uri;
  1090             {
  1090             {
  1091                 final int n = m_namespacePrefix.size();
  1091                 final int n = m_namespacePrefix.size();
  1092                 for (int i = 0; i < n; i++)
  1092                 for (int i = 0; i < n; i++)
  1093                 {
  1093                 {
  1094                     final String prefix =
  1094                     final String prefix =
  1095                         (String) m_namespacePrefix.elementAt(i);
  1095                         (String) m_namespacePrefix.get(i);
  1096                     final String uri = (String) m_namespaceURI.elementAt(i);
  1096                     final String uri = (String) m_namespaceURI.get(i);
  1097                     m_handler.startPrefixMapping(prefix, uri, false);
  1097                     m_handler.startPrefixMapping(prefix, uri, false);
  1098                 }
  1098                 }
  1099                 m_namespacePrefix = null;
  1099                 m_namespacePrefix = null;
  1100                 m_namespaceURI = null;
  1100                 m_namespaceURI = null;
  1101             }
  1101             }
  1163              * then the doecument doesn't start with an <html> tag, and isn't html
  1163              * then the doecument doesn't start with an <html> tag, and isn't html
  1164              */
  1164              */
  1165             final int max = m_namespacePrefix.size();
  1165             final int max = m_namespacePrefix.size();
  1166             for (int i = 0; i < max; i++)
  1166             for (int i = 0; i < max; i++)
  1167             {
  1167             {
  1168                 final String prefix = (String) m_namespacePrefix.elementAt(i);
  1168                 final String prefix = m_namespacePrefix.get(i);
  1169                 final String uri = (String) m_namespaceURI.elementAt(i);
  1169                 final String uri = m_namespaceURI.get(i);
  1170 
  1170 
  1171                 if (m_firstElementPrefix != null
  1171                 if (m_firstElementPrefix != null
  1172                     && m_firstElementPrefix.equals(prefix)
  1172                     && m_firstElementPrefix.equals(prefix)
  1173                     && !EMPTYSTRING.equals(uri))
  1173                     && !EMPTYSTRING.equals(uri))
  1174                 {
  1174                 {
  1192     /**
  1192     /**
  1193      * @param URI_and_localNames Vector a list of pairs of URI/localName
  1193      * @param URI_and_localNames Vector a list of pairs of URI/localName
  1194      * specified in the cdata-section-elements attribute.
  1194      * specified in the cdata-section-elements attribute.
  1195      * @see SerializationHandler#setCdataSectionElements(java.util.Vector)
  1195      * @see SerializationHandler#setCdataSectionElements(java.util.Vector)
  1196      */
  1196      */
  1197     public void setCdataSectionElements(Vector URI_and_localNames)
  1197     public void setCdataSectionElements(ArrayList<String> URI_and_localNames)
  1198     {
  1198     {
  1199         m_handler.setCdataSectionElements(URI_and_localNames);
  1199         m_handler.setCdataSectionElements(URI_and_localNames);
  1200     }
  1200     }
  1201     /**
  1201     /**
  1202      * @see ExtendedContentHandler#addAttributes(org.xml.sax.Attributes)
  1202      * @see ExtendedContentHandler#addAttributes(org.xml.sax.Attributes)