Hi All,
I needed a few suggestions on a recent "Eureka whisper[not really a
shout]" I had, well, out of my bathtub.
W3C defines specific methods witihn a SA ContentHandler like
startElement(), endElement() etc... that would be called back when
elements are encountered within the XML Document.
User overrides these methods to define the logic within each of these
callback methods.
As an alternative, what if the User defines explicit methods like
public void startEmployee() [simplified here- ignoting namespace
mappings]
public void endEmployee()
public void onEmptyAdddress()
public void onAttr_Employee_Name() [this is just illustrative of the
attributes scenario.]
Advantage
-----------------
Cleaner separation of logic.
<<add here>>
Disadvantages
---------------------
No Clear contract.
<<add here>>
This is only an ilustrative subset of the functionalty.
What do you folks think of this ? Is this a better alternative ?
rgds,
Menon
Raymond DeCampo - 10 Aug 2005 15:47 GMT
Ramkumar Menon wrote:
> Hi All,
>
[quoted text clipped - 33 lines]
> rgds,
> Menon
You could easily implement a compliant SAX content handler that uses
reflection to give you the described behavior. Why don't you try it and
let us know how it goes? The real test is in using the new interface of
course. Even better, you could think up a snazzy acronym and release
the source on sourceforge. :-)
Ray

Signature
XML is the programmer's duct tape.