normalize method

void normalize({
  1. Predicate<XmlText>? trimWhitespace,
  2. Predicate<XmlText>? collapseWhitespace,
})

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 returns true, leading and trailing whitespace in text nodes are removed.
  • If the predicate collapseWhitespace returns true, 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);