[XOM-interest] makeWhiteSpaceInElementContent

Elliotte Rusty Harold elharo at metalab.unc.edu
Wed Jan 14 11:41:56 EST 2004


Does anyone actually need the makeWhiteSpaceInElementContent method 
in NodeFactory? Or, another way of asking the question, does anyone 
actually need to distinguish between ignorabole and non-ignorable 
space? More technically, does anyone actually need to distinguish 
between white space that appears where the DTD says #PCDATA is 
permitted (or where no declaration applies) and white space where the 
DTD says #PCDATA is not permitted?

Currently the XOM model does not distinguish between white space in 
element content and regular white space, only the NodeFactory does. 
It occurred to me yesterday that probably the only reason I did that 
was for symmetry with SAX, which distinguishes them. However, SAX can 
just as easily use the makeText() call for ignoreableWhiteSpace() as 
it can makeWhiteSpaceInElementContent(). Indeed, the default 
implementation of makeWhiteSpaceInElementContent just calls 
makeText() anyway.

In my experience, most programmers who want to distinguish white 
space in element content form other white space don't really want to 
do that. What they really want to eliminate is boundary white space, 
regardless of what the DTD says or whether there's a DTD. This could 
still be done with an appropriate NodeFactory subclass, just as it is 
done now.

One other thing: if I remove makeWhiteSpaceInElementContent now it 
would be easy to put it back in later if a need arises. If I keep it 
in for 1.0, then it's basically not possible to remove it later. 
Leaving it out now while I'm uncertain about it feels like the more 
conservative approach.

-- 

   Elliotte Rusty Harold
   elharo at metalab.unc.edu
   Effective XML (Addison-Wesley, 2003)
   http://www.cafeconleche.org/books/effectivexml
   http://www.amazon.com/exec/obidos/ISBN%3D0321150406/ref%3Dnosim/cafeaulaitA



More information about the XOM-interest mailing list