[jdom-interest] setText() to replace children?

Elliotte Rusty Harold elharo at metalab.unc.edu
Wed Jul 11 07:19:58 PDT 2001


At 8:53 AM -0400 7/11/01, bob mcwhirter wrote:


>But, there is obviously a call from some folks to have a recursive-esque
>getText() functionality.
>
>So, maybe a getXPathText(), or a getText(boolean recurse).
>

I think an extra method like this should be part of an XPath API, not part of the core classes, unless we were to revise the entire core API to follow the XPath data model (which frankly would make the answers to a lot of these questions more obvious.)  But the XPath specific functionality should all be in one place. I do think the getText() method makes more sense in the case of mixed content returning the XPath value of the element, or something very close to it. If we can't do that, then we should throw an exception if the element contains anything other than text nodes. No hidden errors!
-- 

+-----------------------+------------------------+-------------------+
| Elliotte Rusty Harold | elharo at metalab.unc.edu | Writer/Programmer |
+-----------------------+------------------------+-------------------+ 
|          The XML Bible, 2nd Edition (Hungry Minds, 2001)           |
|              http://www.ibiblio.org/xml/books/bible2/              |
|   http://www.amazon.com/exec/obidos/ISBN=0764547607/cafeaulaitA/   |
+----------------------------------+---------------------------------+
|  Read Cafe au Lait for Java News:  http://www.cafeaulait.org/      | 
|  Read Cafe con Leche for XML News: http://www.ibiblio.org/xml/     |
+----------------------------------+---------------------------------+



More information about the jdom-interest mailing list