[jdom-interest] Deprecating some XMLOutputter constructors

guru at stinky.com guru at stinky.com
Tue Jun 19 17:02:26 PDT 2001


> This was a problem with the terminology used.  We had called it getTextTrim
> but in the case of mixed content, we were in fact normalizing in a somewhat
> non standard way.  We believe that trim should just be string.trim on the
> current node and the getNormalizedText should do what this means in the xml
> sense.  So that's where all this came from.  I don't remember the date but
> it should be documented in the archives and in the Element change logs.

Oh!  I didn't realize getNormalizedText() had been added.

I think there should still be a setTrim() method in addition to
setNormalize() (hey, I think I just resolved the ordering naming
problem!), to parallel Element.

I remember a patch (by Brad Morgan) being inserted into XMLOutputter
that stripped interior whitespace.  I just checked, and it's still in
there!  This is probably a bug.  At best it's redundant. 

Hmm... Opened a can of worms here...

Turns out XMLOutputter is using StringTokenizer to normalize.  This
means it's using " \t\n\r\f" instead of just " \t\n\r".  It's also a
little less efficient.  Unfortunately, it can't just call
Element.getNormalizedText(), since that method (a) expands CDATA into
text, and (b) doesn't deal with other nested elements.

I just fixed it, I think.  I'll post a patch soon.

-- 
Alex Chaffee                       mailto:alex at jguru.com
jGuru - Java News and FAQs         http://www.jguru.com/alex/
Creator of Gamelan                 http://www.gamelan.com/
Founder of Purple Technology       http://www.purpletech.com/
Curator of Stinky Art Collective   http://www.stinky.com/



More information about the jdom-interest mailing list