Skip to Content.
Sympa Menu

xom-interest - Re: [XOM-interest] CanonicalXMLSerializer exceptions

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: Elliotte Rusty Harold <elharo AT metalab.unc.edu>
  • To: Janek Bogucki <janekdb AT yahoo.co.uk>, xom-interest <xom-interest AT lists.ibiblio.org>
  • Cc:
  • Subject: Re: [XOM-interest] CanonicalXMLSerializer exceptions
  • Date: Mon, 10 Nov 2003 20:34:25 -0500

At 2:25 PM +0000 11/10/03, Janek Bogucki wrote:

Then you get this heirarchy:

Serializer
|
+ ConfigurableSerializer
|
+ CanonicalXMLSerializer

This is an improvement as the inappropriate setter methods do not exist on CanonicalXMLSerializer
and any method expecting a Serializer will not be surprised by IllegalArgumentExceptions.

That makes some sense, but it's not like the methods in Serializer don't belong there; and I don't like adding excess classes to the core API. I think a lot of developers would end up either complaining about not having enough options in Serializer (if they don't notice ConfigurableSerializer) or complaining about having to always type "Configurable". I think prefer just the one Serializer class.

An alternative would be to make Serializer and CanonicalXMLSerializer immutable by setting all
configuration via the constructor, possibly using a parameter object to keep the API uncluttered.

There are two many different options to pass them all to one constructor, and a parameter object seems like an unnecessary extra class. Configuration is clearly part of the nature of the Serializer. I don't want to hide it off somewhere else. And especially if you do want to transmit multiple documents over the same stream, it's useful to be able to modify the Serializer.
--

Elliotte Rusty Harold
elharo AT metalab.unc.edu
Effective XML (Addison-Wesley, 2003)
http://www.cafeconleche.org/books/effectivexml
http://www.amazon.com/exec/obidos/ISBN%3D0321150406/ref%3Dnosim/cafeaulaitA




Archive powered by MHonArc 2.6.24.

Top of Page