You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by mr...@apache.org on 2006/10/15 23:56:29 UTC

svn commit: r464300 - in /xerces/java/trunk/src/org/apache/xml/serialize: Encodings.java HTMLSerializer.java HTMLdtd.java IndentPrinter.java OutputFormat.java Printer.java

Author: mrglavas
Date: Sun Oct 15 14:56:26 2006
New Revision: 464300

URL: http://svn.apache.org/viewvc?view=rev&rev=464300
Log:
JIRA Issue #1197:
http://issues.apache.org/jira/browse/XERCESJ-1197

Various code cleanup. Patch thanks to Nathan Beyer.

Modified:
    xerces/java/trunk/src/org/apache/xml/serialize/Encodings.java
    xerces/java/trunk/src/org/apache/xml/serialize/HTMLSerializer.java
    xerces/java/trunk/src/org/apache/xml/serialize/HTMLdtd.java
    xerces/java/trunk/src/org/apache/xml/serialize/IndentPrinter.java
    xerces/java/trunk/src/org/apache/xml/serialize/OutputFormat.java
    xerces/java/trunk/src/org/apache/xml/serialize/Printer.java

Modified: xerces/java/trunk/src/org/apache/xml/serialize/Encodings.java
URL: http://svn.apache.org/viewvc/xerces/java/trunk/src/org/apache/xml/serialize/Encodings.java?view=diff&rev=464300&r1=464299&r2=464300
==============================================================================
--- xerces/java/trunk/src/org/apache/xml/serialize/Encodings.java (original)
+++ xerces/java/trunk/src/org/apache/xml/serialize/Encodings.java Sun Oct 15 14:56:26 2006
@@ -15,17 +15,14 @@
  * limitations under the License.
  */
 
-
 package org.apache.xml.serialize;
 
-
 import java.io.UnsupportedEncodingException;
 import java.util.Hashtable;
 import java.util.Locale;
 
 import org.apache.xerces.util.EncodingMap;
 
-
 /**
  * Provides information about encodings. Depends on the Java runtime
  * to provides writers for the different encodings, but can be used
@@ -73,14 +70,14 @@
         // need to convert it to upper case:
         encoding = encoding.toUpperCase(Locale.ENGLISH);
         String jName = EncodingMap.getIANA2JavaMapping(encoding);
-        if(jName == null) {
+        if (jName == null) {
             // see if the encoding passed in is a Java encoding name.
-            if(allowJavaNames ) {
+            if (allowJavaNames) {
                 EncodingInfo.testJavaEncodingName(encoding);
-                if((eInfo = (EncodingInfo)_encodings.get(encoding)) != null) 
+                if ((eInfo = (EncodingInfo)_encodings.get(encoding)) != null) 
                     return eInfo;
                 // is it known to be unicode-compliant?
-                int i=0;
+                int i = 0;
                 for(; i<UNICODE_ENCODINGS.length; i++) {
                     if(UNICODE_ENCODINGS[i].equalsIgnoreCase(encoding)) {
                         eInfo = new EncodingInfo(EncodingMap.getJava2IANAMapping(encoding), encoding, LAST_PRINTABLE_UNICODE);
@@ -92,9 +89,8 @@
                 }
                 _encodings.put(encoding, eInfo); 
                 return eInfo;
-            } else {
-                throw new UnsupportedEncodingException(encoding);
             }
+            throw new UnsupportedEncodingException(encoding);
         }
         if ((eInfo = (EncodingInfo)_encodings.get(jName)) != null)
             return eInfo;

Modified: xerces/java/trunk/src/org/apache/xml/serialize/HTMLSerializer.java
URL: http://svn.apache.org/viewvc/xerces/java/trunk/src/org/apache/xml/serialize/HTMLSerializer.java?view=diff&rev=464300&r1=464299&r2=464300
==============================================================================
--- xerces/java/trunk/src/org/apache/xml/serialize/HTMLSerializer.java (original)
+++ xerces/java/trunk/src/org/apache/xml/serialize/HTMLSerializer.java Sun Oct 15 14:56:26 2006
@@ -626,8 +626,6 @@
     protected void startDocument( String rootTagName )
         throws IOException
     {
-        StringBuffer buffer;
-
         // Not supported in HTML/XHTML, but we still have to switch
         // out of DTD mode.
         _printer.leaveDTD();
@@ -848,10 +846,8 @@
     protected void characters( String text )
         throws IOException
     {
-        ElementState state;
-
         // HTML: no CDATA section
-        state = content();
+        content();
         super.characters( text );
     }
 
@@ -869,15 +865,10 @@
         // XXX  Apparently Netscape doesn't like if we escape the URI
         //      using %nn, so we leave it as is, just remove any quotes.
         index = uri.indexOf( "\"" );
-        if ( index >= 0 )
+        if ( index >= 0 ) {
             return uri.substring( 0, index );
-        else
-            return uri;
+        }
+        return uri;
     }
 
-
 }
-
-
-
-

Modified: xerces/java/trunk/src/org/apache/xml/serialize/HTMLdtd.java
URL: http://svn.apache.org/viewvc/xerces/java/trunk/src/org/apache/xml/serialize/HTMLdtd.java?view=diff&rev=464300&r1=464299&r2=464300
==============================================================================
--- xerces/java/trunk/src/org/apache/xml/serialize/HTMLdtd.java (original)
+++ xerces/java/trunk/src/org/apache/xml/serialize/HTMLdtd.java Sun Oct 15 14:56:26 2006
@@ -15,12 +15,10 @@
  * limitations under the License.
  */
 
-
 // Aug 21, 2000:
 //   Fixed bug in isElement and made HTMLdtd public.
 //   Contributed by Eric SCHAEFFER" <es...@posterconseil.com>
 
-
 package org.apache.xml.serialize;
 
 import org.apache.xerces.dom.DOMMessageFormatter;
@@ -31,7 +29,6 @@
 import java.util.Hashtable;
 import java.util.Locale;
 
-
 /**
  * Utility class for accessing information specific to HTML documents.
  * The HTML DTD is expressed as three utility function groups. Two methods
@@ -322,10 +319,10 @@
 
         initialize();
         value = _byName.get( name );
-        if ( value != null && value instanceof Integer )
+        if ( value != null && value instanceof Integer ) {
             return ( (Integer) value ).intValue();
-        else
-            return -1;
+        }
+        return -1;
     }
 
 
@@ -461,10 +458,10 @@
         Integer flags;
 
         flags = (Integer) _elemDefs.get( name.toUpperCase(Locale.ENGLISH) );
-        if ( flags == null )
+        if ( flags == null ) {
             return false;
-        else
-            return ( ( flags.intValue() & flag ) == flag );
+        }
+        return ( ( flags.intValue() & flag ) == flag );
     }
 
 

Modified: xerces/java/trunk/src/org/apache/xml/serialize/IndentPrinter.java
URL: http://svn.apache.org/viewvc/xerces/java/trunk/src/org/apache/xml/serialize/IndentPrinter.java?view=diff&rev=464300&r1=464299&r2=464300
==============================================================================
--- xerces/java/trunk/src/org/apache/xml/serialize/IndentPrinter.java (original)
+++ xerces/java/trunk/src/org/apache/xml/serialize/IndentPrinter.java Sun Oct 15 14:56:26 2006
@@ -121,8 +121,8 @@
             flushLine( false );
             _writer = _docWriter;
             return _dtdWriter.toString();
-        } else
-            return null;
+        }
+        return null;
     }
     
     

Modified: xerces/java/trunk/src/org/apache/xml/serialize/OutputFormat.java
URL: http://svn.apache.org/viewvc/xerces/java/trunk/src/org/apache/xml/serialize/OutputFormat.java?view=diff&rev=464300&r1=464299&r2=464300
==============================================================================
--- xerces/java/trunk/src/org/apache/xml/serialize/OutputFormat.java (original)
+++ xerces/java/trunk/src/org/apache/xml/serialize/OutputFormat.java Sun Oct 15 14:56:26 2006
@@ -171,30 +171,24 @@
 
 
     /**
-     * Ture if the XML declaration should be ommited;
+     * True if the XML declaration should be ommited;
      */
     private boolean _omitXmlDeclaration = false;
 
 
     /**
-     * Ture if the DOCTYPE declaration should be ommited;
+     * True if the DOCTYPE declaration should be ommited;
      */
     private boolean _omitDoctype = false;
 
 
     /**
-     * Ture if comments should be ommited;
+     * True if comments should be ommited;
      */
     private boolean _omitComments = false;
 
 
     /**
-     * Ture if the comments should be ommited;
-     */
-    private boolean _stripComments = false;
-
-
-    /**
      * True if the document type should be marked as standalone.
      */
     private boolean _standalone = false;
@@ -336,7 +330,7 @@
      * Returns the version for this output method.
      * If no version was specified, will return null
      * and the default version number will be used.
-     * If the serializerr does not support that particular
+     * If the serializer does not support that particular
      * version, it should default to a supported version.
      *
      * @return The specified method version, or null
@@ -825,10 +819,10 @@
     public char getLastPrintable()
     {
         if ( getEncoding() != null &&
-             ( getEncoding().equalsIgnoreCase( "ASCII" ) ) )
+             ( getEncoding().equalsIgnoreCase( "ASCII" ) ) ) {
             return 0xFF;
-        else
-            return 0xFFFF;
+        }
+        return 0xFFFF;
     }
 
 

Modified: xerces/java/trunk/src/org/apache/xml/serialize/Printer.java
URL: http://svn.apache.org/viewvc/xerces/java/trunk/src/org/apache/xml/serialize/Printer.java?view=diff&rev=464300&r1=464299&r2=464300
==============================================================================
--- xerces/java/trunk/src/org/apache/xml/serialize/Printer.java (original)
+++ xerces/java/trunk/src/org/apache/xml/serialize/Printer.java Sun Oct 15 14:56:26 2006
@@ -149,12 +149,12 @@
     {
         // Only works if we're going out of DTD mode.
         if ( _writer == _dtdWriter ) {
-	    flushLine( false );
+            flushLine( false );
 
 			_writer = _docWriter;
             return _dtdWriter.toString();
-        } else
-            return null;
+        }
+        return null;
     }
 
 



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xerces.apache.org
For additional commands, e-mail: commits-help@xerces.apache.org