[jdom-interest] XMLOutputter patch

Bradley S. Huffman hip at a.cs.okstate.edu
Tue Nov 27 12:44:47 PST 2001


Alex Rosen writes:

> But I think we wanted to wait for
> the Text node implementation before merging this in to the main branch. Is
> that still true? Any progress on the Text node implementation?

I have Text node done for the code in the jdom branch. If I remember right
though, didn't everyone want to add the changes for Text node to be in jdom-wip
only and leave the jdom branch as is for now?  Anyway, I haven't touch
jdom-wip yet but can get to it this week and send you the patches.

As for your original post about speedups to XMLOutputter, I have a new version
of XMLOutputter that is hopefully cleanup, faster, and has easier to understand
logic than the current. Your post about using buffered writers gave me another
idea for speedups.  It goes something like this: currently with newline and
normalization alot of energy is spent moving/converting characters back and
forth, such as String->char[]->String, etc, etc. This is to handle
normalization, check for all whitespace content, do character escaping, and
so on.  However things like escaping a character only depend on the current
char, while normalization only depends on the current and the previous char,
so you should only need to scan/convert the content once (or at least alot 
few times than currently), like right before printing.

I guess anothor way to put this is view the whole document as a stream of
char and all we need do is tell the writer (I guess filter would be a 
better term) when to turn on/off normalization, trimming, escaping, etc.
and let it handle it (do as little preprocessing on our part as we can get
away with).

If anyone else is interested, it should be wrapped up by the end of the week.
I would like someone with some good tests to compare it against the current
XMLOutputter to see if my changes are a worthwhile speedup or would better 
in the proverbal bit-bucket.

Brad



More information about the jdom-interest mailing list