[jdom-commits] CVS update: jdom/src/java/org/jdom/output
cvs at jools.org
cvs at jools.org
Fri Jan 25 10:42:52 PST 2002
Date: Friday January 25, 2002 @ 13:42
Author: cvs
Update of /home/cvspublic/jdom/src/java/org/jdom/output
In directory jools.org:/tmp/cvs-serv5717/output
Modified Files:
XMLOutputter.java
Log Message:
Integrating two large sets of patches from Brad Huffman. Here's
the first patch set, in his words:
--
I finished working on a version that uses a AttributeList and ContentList
that phil suggested (and alex seemed to like).
ftp://a.cs.okstate.edu/pub/hip/jdom-filter-v2.zip
While no blazing speed improvements, it did make the code smaller and a lot
easier to understand.
To summarize:
1. AttributeList is a extension of AbstractList for holding attributes.
It contains all the verifications and checks (namespace, duplicates).
2. ContentList is a extension of AbstractList for holding Element or
Document content (depending on the constructor).
It also contains all the verifications and checks (including a single
root element).
3. Both maintain the contact that a failure leaves things unchanged.
4. Both use a ArrayList as a backing list, but it is not created
until the first call to add(Object).
5. The above implies no need for attributeCount(), nodeCount(),
getAttribute(int), getContent(int), since getAttributes() and
getContent() don't create content.
6. FilterList is now also extension of AbstractList. The constructors
are FilterList(List,Filter), FilterList(List,Comparator),
FilterList(List,Filter,Comparator).
7. Filter now only needs 3 methods - canAdd(Object), canRemove(Object),
matches(Object).
8. FilterList, Filter, ElementFilter are moved to org.jdom.filter since
one doesn't need to know to use JDOM core.
Personally, I was sceptical at first, but I do like this incarnation the
best. It a lot easier to understand and just as fast as what's currently
in the repository.
--
Here's the follow-on patch set, again in his words:
--
Okay, here hopefully is the final incarnation. It should address most
of everyones concerns from last time.
ftp://a.cs.okstate.edu/pub/hip/jdom-filter-v3.zip
Changes since last time:
1. FilterList and FilterListIterator moved inner to classes of
ContentList giving them access to it's instance variables
for future optimizations.
2. Remove unused methods from AttributeList and ContentList.
3. Made sure all Exceptions have a useful message.
4. Class protected AttributeList, ContentList, etc.
--
Here's my high-level summary of the public API change. This'll be handy
for the CHANGES file:
* Added ability for a Document to have a detached root, with an ISE
thrown in case of read from such a Document.
* Added a public method Document.detachRootElement()
* Limited the public Filter-related classes to just Filter.
* XMLOutputter now has a Format inner class
* XMLOutputter has changed the escape*() methods to be public
* XMLOutputter has added the following public methods:
outputString(List list)
outputString(String str)
outputString(Text text)
output(List list, OutputStream out)
output(List list, Writer out)
Last notes:
* No getContent(Filter) method is yet exposed.
* The org.jdom.filter package will not need to be used afterall.
* I fixed a few little issues (mostly Javadoc) I found in the code
and did some whitespace reformatting.
A few of the jdom-test cases now fail, but most appear to have a good
explanation. Specifically, handling null parameters is a little
different now. Hopefully the author (Phil?) can verify my reading.
The code seems to work on a few tiny little real-life tests, but it's 2:37am
and I'm not doing any more tonight. There's a lot of changes in this check-in
so keep your eyes open and please report anything unusual you notice!
And thanks, Brad!
-jh-
===================================================================
File: no file XMLOutputter.java Status: Needs Checkout
Working revision: 1.69 Fri Jan 25 18:42:52 2002
Repository revision: 1.69 /home/cvspublic/jdom/src/java/org/jdom/output/XMLOutputter.java,v
Existing Tags:
jdom_prefilter (revision: 1.66)
jdom_1_0_b7 (revision: 1.62)
jdom_1_0_b6 (revision: 1.35)
start (revision: 1.1.1.1)
jdom (branch: 1.1.1)
More information about the jdom-commits
mailing list