On Oct 27, 2005, at 06:29, Manuel Mall wrote:
Some more on this example:
Actually something like:
character=" "/><fo:character character=
" "/>word2<fo:character character=" "/>word3<fo:character
currently causes an exception!
I think I see the problem (don't know if you've seen it that way):
fop.fo.flow.Character overrides FONode.charIterator(), which returns
a OneCharIterator over its own character. If remove() is called from
within a RecursiveCharIterator for the surrounding block, the spaces
surrounding the linefeed get recognized as discardable whitespace.
The superclass throws an UnsupportedOperationException, because
OneCharIterator doesn't have an implementation for remove(). This may
be the reason the example didn't work properly.
The problem can be solved by a slight modification to OneCharIterator:
* add a constructor with Character parameter (and member)
* add a remove() implementation which makes Character's parent remove
it from its list of child nodes
Tested locally (very quickly), and seems to work nicely. If I get the
chance to commit it in the next few days, I'll do so myself, but if
you want to have a go, it's a pretty easy fix (adds up to about 10-15
LOC incl. javadocs :-))