Skip to Content.
Sympa Menu

xom-interest - Re: [XOM-interest] Serialize parentless Text nodes

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] Serialize parentless Text nodes
  • Date: Sun, 24 Jul 2005 13:50:04 -0400

Wolfgang Hoschek wrote:

private boolean isBoundaryWhitespace(Text text) {

// if (getIndent() <= 0) return false; // WH moved to write (Text) (better inlining)

// XXX check this without getValue
// if (!"".equals(text.getValue().trim())) return false;
if (text.getValue().trim().length() > 0) return false; // WH
ParentNode parent = text.getParent();
if (parent == null) return false; // WH allow parentless text

... and so on
}

I'm looking at this now. It's simple enough to implement, but I'm not sure I know yet what ti should. Specifically, in the case when the parent node is null, what should and should not be boundary whitespace? The solution you propose would assert that parentless text nodes are never boundary whitespace. The alternative would be to assert that all white space only parentless text nodes are boundary whitespace.

This only matters when indenting, but then the problem only comes up in the first place when indenting. I'm not sure which way to go here. Anyone want to argue this one way or the other?

--
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