public class XOMUtil extends Object
Modifier and Type | Class and Description |
---|---|
static class |
XOMUtil.Normalizer
Standard XML algorithms for text and whitespace normalization (but not
for Unicode normalization); type safe enum.
|
Modifier and Type | Method and Description |
---|---|
static nu.xom.NodeFactory |
getIgnoreWhitespaceOnlyTextNodeFactory()
Returns a node factory that removes each
Text node that is
empty or consists of whitespace characters only (boundary whitespace). |
static nu.xom.NodeFactory |
getRedirectingNodeFactory(StreamingSerializer serializer)
Returns a node factory that redirects its input onto the output of a
streaming serializer.
|
public static nu.xom.NodeFactory getIgnoreWhitespaceOnlyTextNodeFactory()
Text
node that is
empty or consists of whitespace characters only (boundary whitespace).
This method fully preserves narrative Text
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.
public static nu.xom.NodeFactory getRedirectingNodeFactory(StreamingSerializer serializer)
The document returned on finishMakingDocument
will be empty.
serializer
- the streaming serializer to write toCopyright © 2018 JBoss by Red Hat. All rights reserved.