It seems to me then that if you intend on supporting both APIs you'll have
to have the duplicate code at least until the point where both APIs can be
merged on a common interface.

In other words, since SAX1 and SAX2 changed their class names in the
interfaces, and didn't provide a means for translating between SAX1 to SAX2,
then you have to maintain that seperation (via duplicated code) until
there's a point that you find that the interfaces allow you to start using
one or the other by method calls to the one passing arguments containing
values of the other.  This is confusing, I know - I'm confusing myself.
Let's try an example:

- SAX1 -
startElement(String, AttributeList)
- SAX2 - 
startElement(String, String, String, Attributes)

these have to be kept seperate because as you pointed out, unless you commit
to one particular implementation you can't "merge" the interfaces.

- SAX1 -
characters(char[], int, int)
- SAX2 -
characters(char[], int, int)

these are the same, so they can be interchanged without regard to underlying
implementation.

So perhaps you have to deal with the start elements seperately (duplicated
code), but when it comes to characters you can use the same code.  This
code-sharing is applicable to any method in which you can devise how to
translate SAX1 information into a SAX2 structure without having to create
implementation-specific SAX/DOM containers.

Sorry I don't see a better solution.

Brion

-----Original Message-----
From: Jason Rizer [mailto:[EMAIL PROTECTED]
Sent: Tuesday, June 19, 2001 12:37 PM
To: [EMAIL PROTECTED]
Subject: RE: Is there any implementation nuetral way to create an
Attribut es?


Brion,

The only problem with that approach is that while I'm
currently only testing with xerces and sun I'd like to
be able to support any other parser (SAX1 or SAX2)
which I might encounter.  I should have mentioned
this.  Thanks for taking the time to reply.

-Jason


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to