xerces-j-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stanimir Stamenkov <sta...@myrealbox.com>
Subject Re: XMLSerializer Writer Constructor
Date Tue, 26 Jul 2005 15:50:04 GMT
/Stephen Kestle/:

> Well you can always wrap it!

Why should I suffer from unnecessary encoding (done by the 
serializer) then decoding (on my part), further handling character 
references generated during the first encoding phase (eventually)?

> Why make something hard to use for people 
> who are learning in favour of what should be exceptional (and advanced!) 
> usage.  But then, if you had to make a WriterOutputStream, you'd have to 
> wonder why it hasn't been done before (as far as I can see).

Seems I'm not following you here. Why one should make a 
'WriterOutputStream'?

> If you're 
> serializing an object, you're about to make it external to the system - 
> and there's no good reason to use a Character stream for this (which 
> will export in the default encoding, unless you make it a stream of some 
> sort...).

The serialized form really depends on the needs.

> Most developers will expect it to return encoded data that is valid, 
> never realising that their code is fragile and will break when someone 
> puts some accidental value on a web screen.  I can't see how this isn't 
> broken - the serializer slaps a header on it which claims it's encoded - 
> but it isn't!
> 
> When Date was found to be non-transportable, Sun deprecated a whole lot 
> of stuff.  Please follow common java conventions (both Writer vs Stream, 
> and deprecation) and do the same.

I think the above is not really relevant and AFAIK the 'date', 
'month', 'year', etc. stuff in 'Date' is deperecated because these 
are not calculated reliably, not that they are non-transportable.

> In Summary: you are technically correct, but think about the social 
> [developer] impact of maintaining an "I'm right" stance.  End developers 
> surely can't realistically complain about having to make a non-standard 
> WriterOutputStream for a non-standard operation.  Even the advanced 
> users who would use this would have seen noob code that had to be 
> cleaned up (as I have had to do)
> 
> But I am interested to know if there is a use case for this.  Although I 
> highly suspect that most use cases would be broken.

Again, if one needs to serialize to a byte stream then he needs to 
use the 'OutputStream' argument constructor - why should he create 
an 'WriterOutputSream' and pass it to the 'Writer' argument 
constructor, loosing the extra care the serializer does when writing 
to a byte stream?

-- 
Stanimir


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


Mime
View raw message