[jdom-commits] CVS Update: jdom/package

nobody nobody at chimbo.servlets.com
Tue May 20 14:53:59 PDT 2003

Date:   Tue May 20, 2003 @15:53:59 MDT

Update of /home/cvs/jdom/package
In directory chimbo:/tmp/cvs-serv4155/package

Modified Files:
Log Message:

BIG CHANGE. Comments welcome!

Added two new interfaces, Parent and Child.

Parent has methods (* means new):
CVS JDOMAbout.java int getChildCount();
Parent addContent(Child child);
CVS JDOMAbout.java Parent addContent(Collection collection);
CVS JDOMAbout.java Parent addContent(int index, Child child);
CVS JDOMAbout.java Parent addContent(int index, Collection collection);
CVS JDOMAbout.java List cloneContent();
List getContent();
List getContent(Filter filter);
CVS JDOMAbout.java Child getContent(int index);
CVS JDOMAbout.java List removeContent();
CVS JDOMAbout.java List removeContent(Filter filter);
CVS JDOMAbout.java Child removeContent(int index);
boolean removeContent(Child child);
Parent setContent(Child child);
Parent setContent(Collection collection);
CVS JDOMAbout.java Parent setContent(int index, Child child);
CVS JDOMAbout.java Parent setContent(int index, Collection collection);
Object clone();

Child has methods:
Child detach();
Document getDocument();
Parent getParent();
CVS JDOMAbout.java String getValue();
Object clone();

Parent is implemented by Document and Element.

Child is implemented by Comment, DocType, Element, EntityRef,
ProcessingInstruction, and Text (CDATA).

The new methods on Parent are pretty self explanatory. A few methods that
used to require List work are now on Parent itself for convenience. The
cloneContent() and removeContent() calls should be especially helpful.

The getValue() method in Child is defined to return the XPath 1.0 string value
of the element. The getText() methods in Element are left unchanged.

A subtle change is that getParent() now returns a Parent type which is its
immediate parent. Previously an item at the document level would return null
and you'd use getDocument() to get its Document.

In a similar vein, the protected setDocument() methods have been removed in
favor of just using setParent(). getDocument() remains as a potentially
recursive lookup method.

I renamed getChildren() to getChildElements() and renamed getChild() to
getChildElement(). Now that there's a real Child interface getChildren() is
even more confusing than it used to be. I deprecated the old forms. This
change will require a lot of recoding for people.

Also updated supporting files to use the new APIs.

Thanks to Brad's jdom-x experimental tree for lots of the ideas in here,
and thanks to Brad for pre-reviewing this change.


File: JDOMAbout.java   	Status: Up-to-date

   Working revision:	1.3	Tue May 20 21:53:45 2003
   Repository revision:	1.3	/home/cvs/jdom/package/JDOMAbout.java,v

   Existing Tags:
	jdom_1_0_b9              	(revision: 1.2)
	jdom_1_0_b8              	(revision: 1.2)
	jdom_prefilter           	(revision: 1.1)
	jdom_1_0_b7              	(revision: 1.1)

More information about the jdom-commits mailing list