xerces-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andy Clark <an...@apache.org>
Subject Re: Serializers: Do They Work?
Date Mon, 17 Jan 2000 21:40:57 GMT
Assaf Arkin wrote:
> They have no right to complain, but they will and I don't want to answer
> them. Throwing IllegalStateException solves that in an elegant way.

I would disagree with this solution as being elegant. My
personal opinion is that objects should not start off in an
unusable state. Requiring the programmer to have explicit
knowledge of what needs to be done in order to get the
object into a usable state is asking for trouble. Also, the
default action of throwing an exception is a problem because
you can't know that your program is in a usable state until
runtime. While we can't perform compile time checks, we can
make the object safe by default construction.

> I was rather hoping that people will use the OutputFormat to do that for
> the time being. OutputFormat will also take the system/public ids from
> the document type in DOM Level 2.

Yes, but if you assume that the DOM tree that you are 
handed is DOM Level 2 and attempt to call the method (when
it's really a DOM Level 1 implementation), you will get a 
runtime exception thrown by the VM. At least the reflection 
makes it work before (and after) the W3C interfaces become 
standard and while they're being adopted.

> I don't think reflection is a good way. Besides I can always cast it to
> the proper Xerces type as a temporary solution.

Should we assume that the DOM tree handed to the serializers
is always going to be from Xerces? I would vote for allowing
everyone to use our serializers, regardless of whether they
use our DOM implementation.

> Because it has no way of knowing what is external and what is internal.
> The DOM serializer simply dumps everything. The only solution is for the
> DOM serializer to not print anything, which is what I think I'll do
> after I get it to print correctly.

I agree with not printing anything.

-- 
Andy Clark * IBM, JTC - Silicon Valley * andyc@apache.org

Mime
View raw message