normalize method
Puts all child nodes into a "normalized" form, that is no text nodes in the sub-tree are empty and there are no adjacent text nodes.
- If the predicate
trimWhitespace
returnstrue
, leading and trailing whitespace in text nodes are removed. - If the predicate
collapseWhitespace
returnstrue
, consecutive whitespace in text nodes are replace with a single space-character.
Implementation
void normalize({
Predicate<XmlText>? trimWhitespace,
Predicate<XmlText>? collapseWhitespace,
}) =>
XmlNormalizer(
trimWhitespace: trimWhitespace,
collapseWhitespace: collapseWhitespace,
).visit(this);