[jdom-interest] Common interfaces..

James Strachan james_strachan at yahoo.co.uk
Thu May 3 04:04:15 PDT 2001


> Not that anyone cares, but for the record, I remain
> completely against common interfaces/base classes for
> JDOM.
>
> I am quite willing to change my mind if someone can
> answer Jason's question: "What common methods and
> properties would these classes support?"
>
> For instance, I can't come up with a common interface
> for, say, CDATA and Attribute, other than that they
> both have an Element as a parent.

How about something like these?

http://dom4j.org/apidocs/org/dom4j/Node.html
http://dom4j.org/apidocs/org/dom4j/CDATA.html
http://dom4j.org/apidocs/org/dom4j/Attribute.html

A few ideas for methods could be...

* getParent()
* getDocument()
* accept(Visitor)
* return itself as a snippet of XML text.
* return the XPath 'string-value' of the node as per the XPath spec.
* return the XPath expression required to navigate to the node. (e.g.
"foo/bar/@name")
* evaluate XPath expressions relative to the node.

I'm sure there could be others.

James




_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com




More information about the jdom-interest mailing list