[jdom-interest] interface q (but not the usual one)

rpcee rpcee at operamail.com
Wed Oct 24 02:06:58 PDT 2001


>> I also
>> have a requirement to treat some proprietary structures as
>> XML (it's a simple
>> mapping); I guess I would be unable to make JDOM the common
>> API because the
>> interface and implementation are not separated(?) Is there another
>> possibility, other than using DOM or a home grown interface?
>
>Not sure what you mean here.

What I would like is:
  an interface called say IElement which contains all (or relevant) public 
methods in org.jdom.Element, possibly same for Attribute etc
  org.jdom.Element or a subclass thereof to implement that interface.

then I can have other proprietary classes implement IElement, and have common 
code to manipulate both JDOM and other structures, eg:

  public void doSomethingWith(IElement anElement)
  {
    List children = anElement.getChildren();
    // do other JDOM like things on anElement
  }

I'm not interested in using for example JDOM serialisation etc (except for 
concrete JDOM classes), so I don't think I'm looking for any fundamental 
change to JDOM. I guess I can subclass Element and use factories to do this? 
I've just got Brett's book, so maybe I'll find some time to read it.

I'm not trying to open the old interfaces debate:) I still want the concrete 
classes and constructors etc. I'd just like to have code that works with JDOM 
able to work with some other stuff too.

Thanks, Richard




More information about the jdom-interest mailing list