You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ws.apache.org by ve...@apache.org on 2016/05/06 21:52:59 UTC

svn commit: r1742652 - in /webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/serializer: ElemContext.java SerializerBase.java ToStream.java XSLOutputAttributes.java

Author: veithen
Date: Fri May  6 21:52:59 2016
New Revision: 1742652

URL: http://svn.apache.org/viewvc?rev=1742652&view=rev
Log:
Remove unused code.

Modified:
    webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/serializer/ElemContext.java
    webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/serializer/SerializerBase.java
    webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/serializer/ToStream.java
    webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/serializer/XSLOutputAttributes.java

Modified: webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/serializer/ElemContext.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/serializer/ElemContext.java?rev=1742652&r1=1742651&r2=1742652&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/serializer/ElemContext.java (original)
+++ webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/serializer/ElemContext.java Fri May  6 21:52:59 2016
@@ -77,12 +77,6 @@ final class ElemContext
      */
     String m_elementURI = null;
 
-    /** If the element is in the cdata-section-names list
-     * then the value is true. If it is true the text children of the element
-     * should be output in CDATA section blocks. 
-     */
-    boolean m_isCdataSection;
-
     /** True if the current element has output escaping disabled.
      * This is true for SCRIPT and STYLE elements. 
      */
@@ -209,7 +203,6 @@ final class ElemContext
         frame.m_elementName = qName;
         frame.m_elementLocalName = localName;
         frame.m_elementURI = uri;
-        frame.m_isCdataSection = false;
         frame.m_startTagOpen = true;
 
         // is_Raw is already set in the HTML startElement() method

Modified: webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/serializer/SerializerBase.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/serializer/SerializerBase.java?rev=1742652&r1=1742651&r2=1742652&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/serializer/SerializerBase.java (original)
+++ webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/serializer/SerializerBase.java Fri May  6 21:52:59 2016
@@ -33,8 +33,6 @@ import org.apache.axiom.core.stream.seri
 import org.xml.sax.Attributes;
 import org.xml.sax.Locator;
 import org.xml.sax.SAXException;
-import org.xml.sax.SAXParseException;
-
 
 /**
  * This class acts as a base class for the XML "serializers"
@@ -997,7 +995,6 @@ public abstract class SerializerBase
     private void resetSerializerBase()
     {
     	this.m_attributes.clear();
-        this.m_CdataElems = null;
         this.m_cdataTagOpen = false;
         this.m_docIsEmpty = true;
     	this.m_doctypePublic = null;
@@ -1020,7 +1017,6 @@ public abstract class SerializerBase
     	this.m_sourceLocator = null;
     	this.m_standalone = null;
     	this.m_standaloneWasSpecified = false;
-        this.m_StringOfCDATASections = null;
     	this.m_transformer = null;
     	this.m_version = null;
     	// don't set writer to null, so that it might be re-used
@@ -1090,105 +1086,7 @@ public abstract class SerializerBase
     }
  
 
-    /** 
-     * 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;
-
-            StringBuffer buf = new StringBuffer();
-            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, add the URI to the vector
-                    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.Hashtable m_CdataElems = null;
-    private void addCDATAElement(String uri, String localName) 
-    {
-        if (m_CdataElems == null) {
-            m_CdataElems = new java.util.Hashtable();
-        }
-        
-        java.util.Hashtable h = (java.util.Hashtable) m_CdataElems.get(localName);
-        if (h == null) {
-            h = new java.util.Hashtable();
-            m_CdataElems.put(localName,h);
-        }
-        h.put(uri,uri);
-        
-    }
-    
-    
     /**
      * Return true if nothing has been sent to this result tree yet.
      * <p>
@@ -1202,60 +1100,6 @@ public abstract class SerializerBase
     }    
     
     /**
-     * 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();  
-                }
-            }
-
-            java.util.Hashtable h = (java.util.Hashtable) 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
@@ -1395,19 +1239,7 @@ public abstract class SerializerBase
         if (defaultVal)
             m_OutputPropsDefault.put(name,val);
         else {
-            if (OutputKeys.CDATA_SECTION_ELEMENTS.equals(name) && val != null) {
-                initCdataElems(val);
-                String oldVal = (String) m_OutputProps.get(name);
-                String newVal;
-                if (oldVal == null)
-                    newVal = oldVal + ' ' + val;
-                else
-                    newVal = val;
-                m_OutputProps.put(name,newVal);
-            }
-            else {
-                m_OutputProps.put(name,val);
-            }
+            m_OutputProps.put(name,val);
         }
         
 

Modified: webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/serializer/ToStream.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/serializer/ToStream.java?rev=1742652&r1=1742651&r2=1742652&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/serializer/ToStream.java (original)
+++ webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/serializer/ToStream.java Fri May  6 21:52:59 2016
@@ -30,8 +30,6 @@ 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 javax.xml.transform.ErrorListener;
 import javax.xml.transform.OutputKeys;
@@ -361,12 +359,6 @@ abstract public class ToStream extends S
 
             char first = getFirstCharLocName(name);
             switch (first) {
-            case 'c':
-                if (OutputKeys.CDATA_SECTION_ELEMENTS.equals(name)) {
-                    String cdataSectionNames = val;
-                    addCdataSectionElements(cdataSectionNames);
-                }
-                break;
             case 'd':
                 if (OutputKeys.DOCTYPE_SYSTEM.equals(name)) {
                     this.m_doctypeSystem = val;
@@ -1366,7 +1358,7 @@ abstract public class ToStream extends S
             startDocumentInternal();
         }
 
-        if (m_cdataStartCalled || m_elemContext.m_isCdataSection)
+        if (m_cdataStartCalled)
         {
             /* either due to startCDATA() being called or due to 
              * cdata-section-elements atribute, we need this as cdata
@@ -2551,13 +2543,6 @@ abstract public class ToStream extends S
                 throw new SAXException(e);
             }
 
-            /* whether Xalan or XSLTC, we have the prefix mappings now, so
-             * lets determine if the current element is specified in the cdata-
-             * section-elements list.
-             */
-            if (m_CdataElems != null)
-                m_elemContext.m_isCdataSection = isCdataSection();
-
             if (m_doIndent)
             {
                 m_isprevtext = false;
@@ -2624,141 +2609,6 @@ abstract public class ToStream extends S
     }
 
     /**
-     * Searches for the list of qname properties with the specified key in the
-     * property list. If the key is not found in this property list, the default
-     * property list, and its defaults, recursively, are then checked. The
-     * method returns <code>null</code> if the property is not found.
-     *
-     * @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
-     * 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.
-     */
-    private void setCdataSectionElements(String key, Properties props)
-    {
-
-        String s = props.getProperty(key);
-
-        if (null != s)
-        {
-            // Vector of URI/LocalName pairs
-            Vector v = new Vector();
-            int l = s.length();
-            boolean inCurly = false;
-            StringBuffer buf = new StringBuffer();
-
-            // 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 < l; i++)
-            {
-                char c = s.charAt(i);
-
-                if (Character.isWhitespace(c))
-                {
-                    if (!inCurly)
-                    {
-                        if (buf.length() > 0)
-                        {
-                            addCdataSectionElement(buf.toString(), v);
-                            buf.setLength(0);
-                        }
-                        continue;
-                    }
-                }
-                else if ('{' == c)
-                    inCurly = true;
-                else if ('}' == c)
-                    inCurly = false;
-
-                buf.append(c);
-            }
-
-            if (buf.length() > 0)
-            {
-                addCdataSectionElement(buf.toString(), v);
-                buf.setLength(0);
-            }
-            // call the official, public method to set the collected names
-            setCdataSectionElements(v);
-        }
-
-    }
-
-    /**
-     * Adds a URI/LocalName pair of strings to the list.
-     *
-     * @param URI_and_localName String of the form "{uri}local" or "local" 
-     * 
-     * @return a QName object
-     */
-    private void addCdataSectionElement(String URI_and_localName, Vector v)
-    {
-
-        StringTokenizer tokenizer =
-            new StringTokenizer(URI_and_localName, "{}", false);
-        String s1 = tokenizer.nextToken();
-        String s2 = tokenizer.hasMoreTokens() ? tokenizer.nextToken() : null;
-
-        if (null == s2)
-        {
-            // add null URI and the local name
-            v.addElement(null);
-            v.addElement(s1);
-        }
-        else
-        {
-            // add URI, then local name
-            v.addElement(s1);
-            v.addElement(s2);
-        }
-    }
-
-    /**
-     * Remembers the cdata sections specified in the cdata-section-elements.
-     * 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)
-     */
-    public void setCdataSectionElements(Vector 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 StringBuffer sb = new StringBuffer();
-                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.elementAt(i);
-                    final String localName =
-                        (String) URI_and_localNames.elementAt(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);
-    }
-
-    /**
      * Makes sure that the namespace URI for the given qualified attribute name
      * is declared.
      * @param ns the namespace URI
@@ -3415,24 +3265,4 @@ abstract public class ToStream extends S
         m_lineSep = eolChars;
         m_lineSepLen = eolChars.length;
     }
-
-    /**
-     * 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);
-    }
 }

Modified: webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/serializer/XSLOutputAttributes.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/serializer/XSLOutputAttributes.java?rev=1742652&r1=1742651&r2=1742652&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/serializer/XSLOutputAttributes.java (original)
+++ webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/serializer/XSLOutputAttributes.java Fri May  6 21:52:59 2016
@@ -20,8 +20,6 @@
  */
 package org.apache.axiom.core.stream.serializer;
 
-import java.util.Vector;
-
 /**
  * This interface has methods associated with the XSLT xsl:output attribues
  * specified in the stylesheet that effect the format of the document output.
@@ -103,27 +101,6 @@ interface XSLOutputAttributes
      */    
     public String getVersion();
 
-
-
-
-
-
-    /**
-     * Sets the value coming from the xsl:output cdata-section-elements
-     * stylesheet property.
-     * 
-     * This sets the elements whose text elements are to be output as CDATA
-     * sections.
-     * @param URI_and_localNames pairs of namespace URI and local names that
-     * identify elements whose text elements are to be output as CDATA sections.
-     * The namespace of the local element must be the given URI to match. The
-     * qName is not given because the prefix does not matter, only the namespace
-     * URI to which that prefix would map matters, so the prefix itself is not
-     * relevant in specifying which elements have their text to be output as
-     * CDATA sections.
-     */
-    public void setCdataSectionElements(Vector 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
      * in the output document.