[jdom-commits] CVS Update: jdom/src/java/org/jdom/xpath
nobody
nobody at chimbo.servlets.com
Tue May 20 14:54:00 PDT 2003
****************************************
Date: Tue May 20, 2003 @15:54:00 MDT
Author:
Update of /home/cvs/jdom/src/java/org/jdom/xpath
In directory chimbo:/tmp/cvs-serv4155/src/java/org/jdom/xpath
Modified Files:
JaxenXPath.java
Log Message:
BIG CHANGE. Comments welcome!
Added two new interfaces, Parent and Child.
Parent has methods (* means new):
CVS int getChildCount();
Parent addContent(Child child);
CVS Parent addContent(Collection collection);
CVS Parent addContent(int index, Child child);
CVS Parent addContent(int index, Collection collection);
CVS List cloneContent();
List getContent();
List getContent(Filter filter);
CVS Child getContent(int index);
CVS List removeContent();
CVS List removeContent(Filter filter);
CVS Child removeContent(int index);
boolean removeContent(Child child);
Parent setContent(Child child);
Parent setContent(Collection collection);
CVS Parent setContent(int index, Child child);
CVS Parent setContent(int index, Collection collection);
Object clone();
Child has methods:
Child detach();
Document getDocument();
Parent getParent();
CVS 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.
-jh-
===================================================================
File: no file JaxenXPath.java Status: Needs Checkout
Working revision: 1.12 Tue May 20 21:54:00 2003
Repository revision: 1.12 /home/cvs/jdom/src/java/org/jdom/xpath/JaxenXPath.java,v
Existing Tags:
jdom_1_0_b9 (revision: 1.10)
More information about the jdom-commits
mailing list