Re: (output) encoding support in doxia-sink-api

2008-11-07 Thread Vincent Siveton
Hi,

2008/11/7 Hervé BOUTEMY [EMAIL PROTECTED]:
 Hi folks,

 For the next 1.0-beta-1 version, 2 methods have been added to SinkFactory
 interface to improve encoding support:
 - Sink createSink( File outputDir, String outputName, String encoding )
 - Sink createSink( Writer writer )
 See [1] for the full interface.

+1


 I worked with Vincent to implement output encoding in Doxia, and we faced
 problems that lead us think that forcing a fixed encoding was the right
 approach to have something simple and reliable: with UTF-8 as this fixed
 encoding, this didn't limit end-users from any country in the world.

 But now, I'm convinced it's not the right approach and API:
 1. some formats need to output the encoding (like HTML, or XML): we need an
 encoding parameter, as we can't get it from a Writer instance

see also DOXIA-185

 2. some formats embed images, like RTF or PDF, then need direct stream access
 to write binary data

 Then I think Sink createSink( Writer writer ) should be removed.

I prefer deprecated for backward compatibility issue.

 Or if we want an API without filename, this method could be transformed into
 Sink createSink( OutputStream output ) + Sink createSink( OutputStream
 output, String encoding ).

+1

Thanks Hervé for that.

Vincent

 Any objection or idea?

 Hervé

 [1]
 http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-sink-api/src/main/java/org/apache/maven/doxia/sink/SinkFactory.java?view=markup



Re: (output) encoding support in doxia-sink-api

2008-11-07 Thread Vincent Siveton
Hi Benjamin

2008/11/7 Benjamin Bentmann [EMAIL PROTECTED]:

[SNIP]

 It might however be convenient to create an AbstractTextSinkFactory from
 which all/most text-based sinks could inherit. For instance,
 XhtmlSinkFactory and XdocSinkFactory look pretty much the same. In more
 detail, how about

+1 too

Vincent


Re: (output) encoding support in doxia-sink-api

2008-11-07 Thread Vincent Siveton
Other comments which maybe related to this thread:

* Parser needs at least 2 parsing: one for macro and another one for
processing, and now a third one to validate XML (DOXIA-263)
* Sink uses some time StringWriter to play with the writed content and
to create a valid content (DOXIA-177)

So, maybe it will more easy to have directly String in input/output
instead of stream.

Cheers,

Vincent


2008/11/7 Vincent Siveton [EMAIL PROTECTED]:
 Hi,

 2008/11/7 Hervé BOUTEMY [EMAIL PROTECTED]:
 Hi folks,

 For the next 1.0-beta-1 version, 2 methods have been added to SinkFactory
 interface to improve encoding support:
 - Sink createSink( File outputDir, String outputName, String encoding )
 - Sink createSink( Writer writer )
 See [1] for the full interface.

 +1


 I worked with Vincent to implement output encoding in Doxia, and we faced
 problems that lead us think that forcing a fixed encoding was the right
 approach to have something simple and reliable: with UTF-8 as this fixed
 encoding, this didn't limit end-users from any country in the world.

 But now, I'm convinced it's not the right approach and API:
 1. some formats need to output the encoding (like HTML, or XML): we need an
 encoding parameter, as we can't get it from a Writer instance

 see also DOXIA-185

 2. some formats embed images, like RTF or PDF, then need direct stream access
 to write binary data

 Then I think Sink createSink( Writer writer ) should be removed.

 I prefer deprecated for backward compatibility issue.

 Or if we want an API without filename, this method could be transformed into
 Sink createSink( OutputStream output ) + Sink createSink( OutputStream
 output, String encoding ).

 +1

 Thanks Hervé for that.

 Vincent

 Any objection or idea?

 Hervé

 [1]
 http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-sink-api/src/main/java/org/apache/maven/doxia/sink/SinkFactory.java?view=markup




Re: (output) encoding support in doxia-sink-api

2008-11-07 Thread Benjamin Bentmann

Vincent Siveton wrote:


Then I think Sink createSink( Writer writer ) should be removed.


I prefer deprecated for backward compatibility issue.


The source code says @since 1.0-beta-1, i.e. this method was never 
part of a released Doxia version, right? Then we should be able to 
safely removed it. Having both @since 1.0-beta-1 and @deprecated 
since 1.0-beta-1 on a method would be quite strange ;-)



Benjamin


Re: (output) encoding support in doxia-sink-api

2008-11-07 Thread Vincent Siveton
2008/11/7 Benjamin Bentmann [EMAIL PROTECTED]:
 Vincent Siveton wrote:

 Then I think Sink createSink( Writer writer ) should be removed.

 I prefer deprecated for backward compatibility issue.

 The source code says @since 1.0-beta-1, i.e. this method was never part of
 a released Doxia version, right? Then we should be able to safely removed
 it. Having both @since 1.0-beta-1 and @deprecated since 1.0-beta-1 on a
 method would be quite strange ;-)

mmh seems logical  :)

Vincent


 Benjamin