Package nux.xom.pool
Class XOMUtil
- java.lang.Object
-
- nux.xom.pool.XOMUtil
-
public class XOMUtil extends Object
Various utilities avoiding redundant code in several classes.- Version:
- $Revision: 1.159 $, $Date: 2006/03/24 01:17:26 $
- Author:
- whoschek.AT.lbl.DOT.gov, $Author: hoschek3 $
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
XOMUtil.Normalizer
Standard XML algorithms for text and whitespace normalization (but not for Unicode normalization); type safe enum.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static nu.xom.NodeFactory
getIgnoreWhitespaceOnlyTextNodeFactory()
Returns a node factory that removes eachText
node that is empty or consists of whitespace characters only (boundary whitespace).
-
-
-
Method Detail
-
getIgnoreWhitespaceOnlyTextNodeFactory
public static nu.xom.NodeFactory getIgnoreWhitespaceOnlyTextNodeFactory()
Returns a node factory that removes eachText
node that is empty or consists of whitespace characters only (boundary whitespace). This method fully preserves narrativeText
containing whitespace along with other characters.Otherwise this factory behaves just like the standard
NodeFactory
.Ignoring whitespace-only nodes reduces memory footprint for documents that are heavily pretty printed and indented, i.e. human-readable. Remember that without such a factory, every whitespace sequence occurring between element tags generates a mostly useless Text node.
Finally, note that this method's whitespace pruning is appropriate for many, but not all XML use cases (round-tripping). For example, the blank between
<p><strong>Hello</strong> <em>World!</em></p>
will be removed, which might not be what you want. This is because this method does not look across multiple Text nodes.- Returns:
- a node factory
-
-