Skip to Content.
Sympa Menu

xom-interest - Re: [XOM-interest] Text normalization [was: XPath support in XOM]

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: Elliotte Harold <elharo AT metalab.unc.edu>
  • To: Wolfgang Hoschek <whoschek AT lbl.gov>
  • Cc: xom-interest AT lists.ibiblio.org
  • Subject: Re: [XOM-interest] Text normalization [was: XPath support in XOM]
  • Date: Tue, 11 Jan 2005 05:32:03 -0500

Wolfgang Hoschek wrote:

Perhaps normalizeText(ParentNode) should take an extra parameter to tell whether an entire subtree should be normalized or just a part of it. That way a user could call it after all insert() and remove() calls on an given element, saving unnecessarily deep tree traversals. As in

public static void normalizeText(ParentNode node, int maxDepth)

For example normalizeText(node, 0) would just normalize the Texts that are direct children of a given node, whereas
normalizeText(node, Integer.MAX_VALUE) would recurse over the entire subtree.

Perhaps it's a gadget and not worth the extra API complexity. Perhaps it's useful. If you have an opinion either way, drop me a line.

I generally prefer simpler APIs. I think I'd just normalize the whole subtree.

--
Elliotte Rusty Harold elharo AT metalab.unc.edu
XML in a Nutshell 3rd Edition Just Published!
http://www.cafeconleche.org/books/xian3/
http://www.amazon.com/exec/obidos/ISBN=0596007647/cafeaulaitA/ref=nosim




Archive powered by MHonArc 2.6.24.

Top of Page