Altova DiffDog 2025 Professional Edition

Comparison Options for Whitespace Characters

Home Prev Top Next

Whitespace characters are any of the following: space, tab, carriage return, and line feed. You can change the comparison options for whitespace characters from the Tools | Comparison Options menu.

dd_whitespace_comparison

Compare as is

When the Compare as is option is enabled, Text A is considered equal to Text B if characters in the two strings (including whitespace characters) match exactly. Whitespace characters are relevant for comparison.

 

Normalize

If the Normalize option is enabled, then the texts are compared after whitespace has been normalized in both texts. When whitespace is normalized, every sequence of consecutive whitespace characters is replaced by a single space character. Additionally, leading and trailing whitespace characters are trimmed for each line of text, that is, they are removed.

 

Note the following points about XML comparisons:

 

Leading and trailing whitespace characters inside element and attribute values are trimmed.

If an element has child elements, then, in Text View, whitespace between child elements counts as a difference, whereas in Grid View it does not.

 

Strip all

If the Strip all option is enabled, then the texts are compared after stripping whitespace characters from both texts. In XML comparisons in both Text View and Grid View, even whitespace characters outside elements will not count as a difference.

 

Examples

The following table illustrates differences when comparing text with each option, using Text or Word comparison.

 

Text A

Text B

As is

Normalize

Strip

"a"

"a "

not equal

equal

equal

"a"

" a"

not equal

equal

equal

"a a"

"a  a"

not equal

equal

equal

 

The following table illustrates differences when comparing text with each option, using XML comparison.

 

Text A

Text B

As is

Normalize

Strip

<?xml version="1.0"

<?xml   version="1.0"

equal

equal

equal

<book id="1">

<book id=" 1 ">

not equal

equal

equal

<author>Mark Twain</author>

<author>Mark   Twain</author>

not equal

equal

equal

 

© 2018-2024 Altova GmbH