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

rpcee rpcee at operamail.com
Tue Oct 23 07:55:39 PDT 2001

Firstly, to implement arbitrary processing of a given element, I defined an 

   public interface IElementProcessor {
      Object apply(Element e);
   so that I can do
      return (List) new XPathProcessor(myXPath).apply(e);

   I'd rather say:
      return (List) e.apply(new XPathProcessor(myXPath));
   or e.apply(customValidator) etc

   ie have a public Object apply(IElementProcessor processor) method in 

   Also perhaps another one which throws JDOMException

   (actually writing it down makes it seem a matter of taste rather than 
something for an api!)

Secondly, I know I can output to a DOM, but I was wondering about an 
implementation of DOM that delegates to a JDOM structure; ie create a wrapper 
round JDOM Document that can be passed to a method expecting an 
org.w3c.dom.Node but actually manipulates the JDOM document; I've a feeling 
this would be (a) much work (b) pointless because I'd end up creating lots of 
little Node/NodeList wrapper objects, and may as well use DOMOutputter. 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?

Thanks, Richard

More information about the jdom-interest mailing list