You are viewing a plain text version of this content. The canonical link for it is here.
Posted to doxia-commits@maven.apache.org by vs...@apache.org on 2008/10/26 13:54:36 UTC

svn commit: r707986 - in /maven/doxia/doxia/trunk/doxia-modules: doxia-module-docbook-simple/src/main/java/org/apache/maven/doxia/module/docbook/ doxia-module-fo/src/main/java/org/apache/maven/doxia/module/fo/ doxia-module-xdoc/src/main/java/org/apache...

Author: vsiveton
Date: Sun Oct 26 05:54:36 2008
New Revision: 707986

URL: http://svn.apache.org/viewvc?rev=707986&view=rev
Log:
o UTF-8 is the default encoding for all xml based sinks
o added javadoc about UTF-8
o removed all XML processing instruction in some sinks

Modified:
    maven/doxia/doxia/trunk/doxia-modules/doxia-module-docbook-simple/src/main/java/org/apache/maven/doxia/module/docbook/DocBookSink.java
    maven/doxia/doxia/trunk/doxia-modules/doxia-module-fo/src/main/java/org/apache/maven/doxia/module/fo/FoSink.java
    maven/doxia/doxia/trunk/doxia-modules/doxia-module-xdoc/src/main/java/org/apache/maven/doxia/module/xdoc/XdocSink.java
    maven/doxia/doxia/trunk/doxia-modules/doxia-module-xdoc/src/test/java/org/apache/maven/doxia/module/xdoc/XdocSinkTest.java
    maven/doxia/doxia/trunk/doxia-modules/doxia-module-xhtml/src/main/java/org/apache/maven/doxia/module/xhtml/XhtmlSink.java

Modified: maven/doxia/doxia/trunk/doxia-modules/doxia-module-docbook-simple/src/main/java/org/apache/maven/doxia/module/docbook/DocBookSink.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-modules/doxia-module-docbook-simple/src/main/java/org/apache/maven/doxia/module/docbook/DocBookSink.java?rev=707986&r1=707985&r2=707986&view=diff
==============================================================================
--- maven/doxia/doxia/trunk/doxia-modules/doxia-module-docbook-simple/src/main/java/org/apache/maven/doxia/module/docbook/DocBookSink.java (original)
+++ maven/doxia/doxia/trunk/doxia-modules/doxia-module-docbook-simple/src/main/java/org/apache/maven/doxia/module/docbook/DocBookSink.java Sun Oct 26 05:54:36 2008
@@ -39,7 +39,9 @@
 import org.codehaus.plexus.util.FileUtils;
 
 /**
- * A doxia Sink which produces a <code>Docbook</code> model.
+ * Docbook Sink implementation.
+ * <br/>
+ * <b>Note</b>: The encoding used is UTF-8.
  *
  * @version $Id$
  * @since 1.0
@@ -66,9 +68,6 @@
     /** xmlMode. */
     private boolean xmlMode = false;
 
-    /** encoding. */
-    private String encoding = null;
-
     /** styleSheet. */
     private String styleSheet = null;
 
@@ -140,9 +139,11 @@
 
     private boolean skip;
 
-
     /**
-     * @param writer the default writer.
+     * Constructor, initialize the Writer.
+     *
+     * @param writer not null writer to write the result. <b>Should</b> be an UTF-8 Writer.
+     * You could use <code>newXmlWriter</code> methods from {@link org.codehaus.plexus.util.WriterFactory}.
      */
     public DocBookSink( Writer writer )
     {
@@ -232,20 +233,22 @@
      * Sets the encoding.
      *
      * @param enc the encoding to set.
+     * @deprecated since 1.0, this method as no more effect. The encoding is always UTF-8.
      */
     public void setEncoding( String enc )
     {
-        this.encoding = enc;
+        // nop
     }
 
     /**
-     * Returns the current encoding.
+     * Returns the UTF-8 encoding.
      *
-     * @return the current encoding.
+     * @return always return UTF-8.
+     * @deprecated since 1.0, this method as no more effect. The encoding is always UTF-8.
      */
     public String getEncoding()
     {
-        return encoding;
+        return "UTF-8";
     }
 
     /**
@@ -532,15 +535,6 @@
     {
         if ( xmlMode )
         {
-            markup( "<?xml version=\"1.0\"" );
-
-            if ( encoding != null )
-            {
-                markup( " encoding=\"" + encoding + "\"" );
-            }
-
-            markup( " ?>" );
-
             if ( styleSheet != null )
             {
                 markup( "<?xml-stylesheet type=\"text/css\" href=\"" + styleSheet + "\" ?>" );

Modified: maven/doxia/doxia/trunk/doxia-modules/doxia-module-fo/src/main/java/org/apache/maven/doxia/module/fo/FoSink.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-modules/doxia-module-fo/src/main/java/org/apache/maven/doxia/module/fo/FoSink.java?rev=707986&r1=707985&r2=707986&view=diff
==============================================================================
--- maven/doxia/doxia/trunk/doxia-modules/doxia-module-fo/src/main/java/org/apache/maven/doxia/module/fo/FoSink.java (original)
+++ maven/doxia/doxia/trunk/doxia-modules/doxia-module-fo/src/main/java/org/apache/maven/doxia/module/fo/FoSink.java Sun Oct 26 05:54:36 2008
@@ -34,7 +34,9 @@
 import org.apache.maven.doxia.util.HtmlTools;
 
 /**
- * A Doxia Sink that produces a FO model.
+ * FO Sink implementation.
+ * <br/>
+ * <b>Note</b>: The encoding used is UTF-8.
  *
  * @author ltheussl
  * @version $Id$
@@ -78,9 +80,10 @@
     private boolean verbatim;
 
     /**
-     * Constructor.
+     * Constructor, initialize the Writer.
      *
-     * @param writer The writer for writing the result.
+     * @param writer not null writer to write the result. <b>Should</b> be an UTF-8 Writer.
+     * You could use <code>newXmlWriter</code> methods from {@link org.codehaus.plexus.util.WriterFactory}.
      */
     public FoSink( Writer writer )
     {
@@ -972,8 +975,6 @@
      */
     public void beginDocument()
     {
-        writeln( "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" );
-
         writeStartTag( ROOT_TAG, "xmlns:" + getNameSpace(), "http://www.w3.org/1999/XSL/Format" );
 
         writeStartTag( LAYOUT_MASTER_SET_TAG, "" );

Modified: maven/doxia/doxia/trunk/doxia-modules/doxia-module-xdoc/src/main/java/org/apache/maven/doxia/module/xdoc/XdocSink.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-modules/doxia-module-xdoc/src/main/java/org/apache/maven/doxia/module/xdoc/XdocSink.java?rev=707986&r1=707985&r2=707986&view=diff
==============================================================================
--- maven/doxia/doxia/trunk/doxia-modules/doxia-module-xdoc/src/main/java/org/apache/maven/doxia/module/xdoc/XdocSink.java (original)
+++ maven/doxia/doxia/trunk/doxia-modules/doxia-module-xdoc/src/main/java/org/apache/maven/doxia/module/xdoc/XdocSink.java Sun Oct 26 05:54:36 2008
@@ -32,7 +32,9 @@
 import org.apache.maven.doxia.util.HtmlTools;
 
 /**
- * A doxia Sink which produces an xdoc model.
+ * Xdoc Sink implementation.
+ * <br/>
+ * <b>Note</b>: The encoding used is UTF-8.
  *
  * @author <a href="mailto:james@jamestaylor.org">James Taylor</a>
  * @version $Id$
@@ -56,7 +58,8 @@
     /**
      * Constructor, initialize the Writer.
      *
-     * @param writer The writer to write the result.
+     * @param writer not null writer to write the result. <b>Should</b> be an UTF-8 Writer.
+     * You could use <code>newXmlWriter</code> methods from {@link org.codehaus.plexus.util.WriterFactory}.
      */
     public XdocSink( Writer writer )
     {
@@ -87,8 +90,6 @@
 
         setHeadFlag( true );
 
-        write( "<?xml version=\"1.0\" ?>" + EOL );
-
         writeStartTag( DOCUMENT_TAG );
 
         writeStartTag( PROPERTIES_TAG );

Modified: maven/doxia/doxia/trunk/doxia-modules/doxia-module-xdoc/src/test/java/org/apache/maven/doxia/module/xdoc/XdocSinkTest.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-modules/doxia-module-xdoc/src/test/java/org/apache/maven/doxia/module/xdoc/XdocSinkTest.java?rev=707986&r1=707985&r2=707986&view=diff
==============================================================================
--- maven/doxia/doxia/trunk/doxia-modules/doxia-module-xdoc/src/test/java/org/apache/maven/doxia/module/xdoc/XdocSinkTest.java (original)
+++ maven/doxia/doxia/trunk/doxia-modules/doxia-module-xdoc/src/test/java/org/apache/maven/doxia/module/xdoc/XdocSinkTest.java Sun Oct 26 05:54:36 2008
@@ -72,7 +72,7 @@
     /** {@inheritDoc} */
     protected String getHeadBlock()
     {
-        return "<?xml version=\"1.0\" ?>" + EOL + "<document><properties></properties>";
+        return "<document><properties></properties>";
     }
 
     /** {@inheritDoc} */

Modified: maven/doxia/doxia/trunk/doxia-modules/doxia-module-xhtml/src/main/java/org/apache/maven/doxia/module/xhtml/XhtmlSink.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-modules/doxia-module-xhtml/src/main/java/org/apache/maven/doxia/module/xhtml/XhtmlSink.java?rev=707986&r1=707985&r2=707986&view=diff
==============================================================================
--- maven/doxia/doxia/trunk/doxia-modules/doxia-module-xhtml/src/main/java/org/apache/maven/doxia/module/xhtml/XhtmlSink.java (original)
+++ maven/doxia/doxia/trunk/doxia-modules/doxia-module-xhtml/src/main/java/org/apache/maven/doxia/module/xhtml/XhtmlSink.java Sun Oct 26 05:54:36 2008
@@ -32,7 +32,8 @@
 import org.codehaus.plexus.util.StringUtils;
 
 /**
- * Xhtml sink implementation. <br/>
+ * Xhtml sink implementation.
+ * <br/>
  * <b>Note</b>: The encoding used is UTF-8.
  *
  * @author Jason van Zyl
@@ -66,7 +67,10 @@
     // ----------------------------------------------------------------------
 
     /**
-     * @param writer
+     * Constructor, initialize the Writer.
+     *
+     * @param writer not null writer to write the result. <b>Should</b> be an UTF-8 Writer.
+     * You could use <code>newXmlWriter</code> methods from {@link org.codehaus.plexus.util.WriterFactory}.
      */
     public XhtmlSink( Writer writer )
     {