[jdom-interest] Still to do - Text 'merger'
Brenner, Mike
mikeb at mitre.org
Tue Apr 3 08:06:47 PDT 2012
1. Perhaps the nonrecursive version should be part of the API as an example of how to do building blocks for simple transformations.
2. The recursive version could be in CONTRIB, to show how easy recursive transformations are in jdom.
3. JOIN, to be compatible with scripting languages, (along with a separator parameter).
4. Neither the DOCUMENT nor the ROOT, but any element.
-----Original Message-----
From: jdom-interest-bounces at jdom.org [mailto:jdom-interest-bounces at jdom.org] On Behalf Of Rolf Lear
Sent: Tuesday, April 03, 2012 9:50 AM
To: Jdom interest
Subject: [jdom-interest] Still to do - Text 'merger'
Hi all.
I have been playing with a problem related to multiple-adjacent-text
content in Elements. For example:
Element root = new Element("Root");
root.addContent(new Text("Hello"));
root.addContent(new Text(" "));
root.addContent(new Text("World!"));
I think there is a useful concept of 'merging' consecutive Text items in
to one. The code is simple enough, and I have written it, and it works.
This is similar to the 'normalize' function of DOM's Node.
The questions are:
1. Should the code be part of the JDOM API? Is it useful?
2. The way I have it now is as a method on Element, which, for example,
you call root.runTheMergeMethod() and it *recursively* scans the Element
(and child Elements) for consecutive Text items and merges them. Should the
method be recursive, or should it be at the current element only. Perhaps
there should be two versions, one is recursive, the other is not.
3. What should the methods be called?
4. Should it be accessible through the JDOM Document too, or just the root
element?
Ideas?
Rolf
_______________________________________________
To control your jdom-interest membership:
http://www.jdom.org/mailman/options/jdom-interest/youraddr@yourhost.com
More information about the jdom-interest
mailing list