com.topologi.diffx.config
Class DiffXConfig

java.lang.Object
  extended bycom.topologi.diffx.config.DiffXConfig

public final class DiffXConfig
extends Object

The configuration to use with a DiffX operation.

This class acts as a container for a set of properties that can be applied to the main components of Diffx such as the:

In order to produce the correct results, the configuration must be applied throughout the three steps of processing.

There is an illegal state in this configuration, if the the diffx is not namespace aware it cannot not report the differences in the prefixes. Therefore it is impossible to set both flags to false.

The set methods for those flags will ensure that this situation does not occur. The general rule is that the flag being set takes precedence.

Note that it simply mimics SAX2 which cannot have the features http://xml.org/sax/features/namespaces and http://xml.org/sax/features/namespace-prefixes both set to false.

Version:
15 April 2004
Author:
Christophe Lauret
See Also:
XMLRecorder, DiffXAlgorithm, DiffXFormatter

Constructor Summary
DiffXConfig()
          Creates a new configuration for DiffX
 
Method Summary
 boolean isIgnoreWhiteSpace()
          Indicates whether the differences in white spaces should be ignored or not.
 boolean isNamespaceAware()
          Indicates whether the Diff-X takes namespaces into account.
 boolean isPreserveWhiteSpace()
          Indicates whether the white spaces are preserved or not.
 boolean isReportPrefixDifferences()
          Returns whether the differences in prefixes are reported.
 void setIgnoreWhiteSpace(boolean ignore)
          Sets whether the differences in white spaces should be ignored or not.
 void setNamespaceAware(boolean aware)
          Sets whether the Diff-X should take namespaces into account.
 void setPreserveWhiteSpace(boolean preserve)
          Sets whether the white spaces should be preserved or not.
 void setReportPrefixDifferences(boolean report)
          Sets whether the Diff-X should report differences in prefixes.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DiffXConfig

public DiffXConfig()
Creates a new configuration for DiffX

Method Detail

setIgnoreWhiteSpace

public void setIgnoreWhiteSpace(boolean ignore)
Sets whether the differences in white spaces should be ignored or not.

Parameters:
ignore - true to ignore differences in white spaces; false otherwise.

setPreserveWhiteSpace

public void setPreserveWhiteSpace(boolean preserve)
Sets whether the white spaces should be preserved or not.

Parameters:
preserve - true to preserve the white spaces; false otherwise.

setNamespaceAware

public void setNamespaceAware(boolean aware)
Sets whether the Diff-X should take namespaces into account.

It is more efficient to disable namespace processing when the XML to compare are not expected to use any namespace.

In order to avoid an illegal state, if this flag is set to false and the differences in prefixes will be automatically reported.

Parameters:
aware - true to preserve the white spaces; false otherwise.

setReportPrefixDifferences

public void setReportPrefixDifferences(boolean report)
Sets whether the Diff-X should report differences in prefixes.

In order to avoid an illegal state, if this flag is set to false and then the processor becomes namespace aware.

Parameters:
report - true to report differences in prefixes; false to ignore them.

isIgnoreWhiteSpace

public boolean isIgnoreWhiteSpace()
Indicates whether the differences in white spaces should be ignored or not.

Returns:
true to ignore differences in white spaces; false otherwise.

isPreserveWhiteSpace

public boolean isPreserveWhiteSpace()
Indicates whether the white spaces are preserved or not.

Returns:
true to preserve the white spaces; false otherwise.

isNamespaceAware

public boolean isNamespaceAware()
Indicates whether the Diff-X takes namespaces into account.

Returns:
true to preserve the white spaces; false otherwise.

isReportPrefixDifferences

public boolean isReportPrefixDifferences()
Returns whether the differences in prefixes are reported.

Returns:
true to report differences in prefixes; false to ignore them.