Loading login details...

[1 of 9] Whitespace differences

Whitespace differences

Whitespace handling is important because you can get a lot of unexpected changes unless whitespace changes are ignored. In XML, whitespace is significant so often needs to be stripped out before comparison - and DeltaXML can do this for you.

If your XML document references a DTD or a schema, then the parser will be able to identify ignorable whitespace between elements and this will be stripped out by DeltaXML Core before comparison.

Note that in these examples, the output is always pretty-printed so it is not precisely accurate in terms of the delta generated. But you can see the effect of changing how the whitespace in the input files is handled in these examples:

  • click ORIGINAL to return to the original example. You will almost always want to ignore whitespace between elements. Check or uncheck the 'Preserve Whitespace' box to see the effect of this.
  • click TEXT WHITESPACE to see how you can suppress changes in whitespace within text in the same way.
  • click IMPORTANT WHITESPACE to see how you can control this with the xml:space="preserve" attribute. When whitespace is stripped, any elements with this attribute will have whitespace preserved.

Configuration Options

Preserve Whitespace

DeltaXML Input and Output

Document 1 Document 2
DeltaXML: Idle
loading...
1 of 9