Package net.datenwerke.eximport.nuxlets
Class XOMUtil
java.lang.Object
net.datenwerke.eximport.nuxlets.XOMUtil
Various utilities avoiding redundant code in several classes.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classStandard XML algorithms for text and whitespace normalization (but not for Unicode normalization); type safe enum. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic NodeFactoryReturns a node factory that removes eachnode that is empty or consists of whitespace characters only (boundary whitespace).invalid reference
nu.xom.Text
-
Constructor Details
-
XOMUtil
public XOMUtil()
-
-
Method Details
-
getIgnoreWhitespaceOnlyTextNodeFactory
public static NodeFactory getIgnoreWhitespaceOnlyTextNodeFactory()Returns a node factory that removes eachnode that is empty or consists of whitespace characters only (boundary whitespace). This method fully preserves narrativeinvalid reference
nu.xom.TextTextcontaining whitespace along with other characters.Otherwise this factory behaves just like the standard
.invalid reference
NodeFactoryIgnoring 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
-