Skip to Content.
Sympa Menu

xom-interest - [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: Wolfgang Hoschek <whoschek AT lbl.gov>
  • To: xom-interest AT lists.ibiblio.org
  • Subject: [XOM-interest] Serialize parentless Text nodes
  • Date: Tue, 28 Jun 2005 14:43:10 -0700

Can we please allow parentless Text nodes in Serializer?

I'd need this for the impl of the XQuery/XPath2.0 serialization draft spec. [Admittedly that spec is rather useless for most practical purposes.] Anyway, the fix won't hurt: add a parent == null check in Serializer.isBoundaryWhitespace(), similar to the one that was introduced a while ago for parentless elements:


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
}







Archive powered by MHonArc 2.6.24.

Top of Page