[jdom-interest] getMixedContent -> getContent
Tom Bradford
bradford at dbxmlgroup.com
Wed Jun 27 09:54:43 PDT 2001
Brett McLaughlin wrote:
> I don't like getContents()... I think getContent() is OK, personally. I also
> think getChildren() isn't too bad... I guess I'm just used to it though.
Or how about this (totally of the top of my head):
public interface Content {
public static final Object All = null;
public static final Element[] Elements = new Element[0];
... etc for the rest of the types ...
}
then have a method like (it assumes the content list is called list):
Object getContent(Object type) {
if ( type == Content.Any )
return list;
else
return list.toArray(type);
}
Then you can make calls like:
Element[] elems = (Element[])elem.getContent(Content.Elements);
or
Object[] objs = (Object[])elem.getContent(Content.All);
--
Tom Bradford --- The dbXML Project --- http://www.dbxml.org/
We store your XML data a hell of a lot better than /dev/null
More information about the jdom-interest
mailing list