Author: ltheussl
Date: Thu Apr  7 13:45:20 2011
New Revision: 1089880

URL: http://svn.apache.org/viewvc?rev=1089880&view=rev
Log:
[DOXIA-403] correct example usage

Modified:
    
maven/doxia/doxia/trunk/doxia-modules/doxia-module-fo/src/site/xdoc/usage.xml

Modified: 
maven/doxia/doxia/trunk/doxia-modules/doxia-module-fo/src/site/xdoc/usage.xml
URL: 
http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-modules/doxia-module-fo/src/site/xdoc/usage.xml?rev=1089880&r1=1089879&r2=1089880&view=diff
==============================================================================
--- 
maven/doxia/doxia/trunk/doxia-modules/doxia-module-fo/src/site/xdoc/usage.xml 
(original)
+++ 
maven/doxia/doxia/trunk/doxia-modules/doxia-module-fo/src/site/xdoc/usage.xml 
Thu Apr  7 13:45:20 2011
@@ -44,13 +44,14 @@ under the License.
 
       <source>
 import java.io.File;
-import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
 import java.io.FileReader;
-import java.io.FileWriter;
 import java.io.IOException;
+import java.io.OutputStream;
 
 import org.apache.maven.doxia.module.apt.AptParser;
 import org.apache.maven.doxia.module.fo.FoSink;
+import org.apache.maven.doxia.module.fo.FoSinkFactory;
 import org.apache.maven.doxia.parser.ParseException;
 
 
@@ -65,11 +66,16 @@ public class Apt2FO
                 new File( "resources", "test.apt" ) );
 
             // Create FO sink:
-            FoSink fosink = new FoSink( new FileWriter(
-                new File( "output", "test.fo" ) ) );
+            OutputStream out = new FileOutputStream(
+                new File( "output", "test.fo" ) );
+            FoSinkFactory factory = new FoSinkFactory();
+            FoSink fosink = (FoSink) factory.createSink( out );
 
+            // parse apt to fo:
+            fosink.beginDocument();
             AptParser parser = new AptParser();
             parser.parse( source, fosink );
+            fosink.endDocument();
 
             // close streams
             fosink.close();
@@ -79,10 +85,6 @@ public class Apt2FO
         {
             e.printStackTrace();
         }
-        catch ( FileNotFoundException e )
-        {
-            e.printStackTrace();
-        }
         catch ( IOException e )
         {
             e.printStackTrace();


Reply via email to