Class DiffXConfig
This class acts as a container for a set of properties that can be applied to the main components of Diff-X such as the:
- The
XMLRecorderimplementations, - The
DiffXAlgorithmimplementations, - and the
DiffXFormatterimplementations.
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:
- 10 May 2010
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate TextGranularityDefines the text granularity for this configuration.private booleanIndicates whether the namespaces should be handled or ignored.private booleanRequired for backward compatibility only.private booleanIndicates whether difference in prefixes should be reported.private WhiteSpaceProcessingDefines the whitespace for this configuration. -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new configuration for Diff-X.DiffXConfig(TextGranularity granularity) Creates a new configuration for Diff-X.DiffXConfig(WhiteSpaceProcessing whitespace, TextGranularity granularity) Creates a new configuration for Diff-X. -
Method Summary
Modifier and TypeMethodDescriptionReturns the granularity of text diffing for this configuration.Returns the granularity of text diffing for this configuration.booleanIndicates whether the differences in white spaces should be ignored or not.booleanIndicates whether the Diff-X takes namespaces into account.booleanIndicates whether the white spaces are preserved or not.booleanReturns whether the differences in prefixes are reported.voidsetGranularity(TextGranularity granularity) Sets the granularity of text diffing for this configuration.voidsetIgnoreWhiteSpace(boolean ignore) Deprecated.voidsetNamespaceAware(boolean aware) Sets whether Diff-X should take namespaces into account.voidsetPreserveWhiteSpace(boolean preserve) Deprecated.usesetWhiteSpaceProcessinginsteadvoidsetReportPrefixDifferences(boolean report) Sets whether the Diff-X should report differences in prefixes.voidsetWhiteSpaceProcessing(WhiteSpaceProcessing whitespace) Sets the white space processing for this configuration.
-
Field Details
-
isNamespaceAware
private boolean isNamespaceAwareIndicates whether the namespaces should be handled or ignored. -
reportPrefixDifferences
private boolean reportPrefixDifferencesIndicates whether difference in prefixes should be reported. -
whitespace
Defines the whitespace for this configuration. -
preserveWhiteSpace
private boolean preserveWhiteSpaceRequired for backward compatibility only. -
granularity
Defines the text granularity for this configuration.
-
-
Constructor Details
-
DiffXConfig
public DiffXConfig()Creates a new configuration for Diff-X. -
DiffXConfig
Creates a new configuration for Diff-X.- Parameters:
granularity- The granularity of text diffing.
-
DiffXConfig
Creates a new configuration for Diff-X.- Parameters:
whitespace- How whitespace should be processed.granularity- The granularity of text diffing.
-
-
Method Details
-
setGranularity
Sets the granularity of text diffing for this configuration.- Parameters:
granularity- the text granularity of text diffing for this configuration.
-
setWhiteSpaceProcessing
Sets the white space processing for this configuration.- Parameters:
whitespace- the white space processing for this configuration.
-
setNamespaceAware
public void setNamespaceAware(boolean aware) Sets whether 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
falseand the differences in prefixes will be automatically reported.- Parameters:
aware-trueto preserve the white spaces;falseotherwise.
-
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
falseand then the processor becomes namespace aware.- Parameters:
report-trueto report differences in prefixes;falseto ignore them.
-
isNamespaceAware
public boolean isNamespaceAware()Indicates whether the Diff-X takes namespaces into account.- Returns:
trueto preserve the white spaces;falseotherwise.
-
isReportPrefixDifferences
public boolean isReportPrefixDifferences()Returns whether the differences in prefixes are reported.- Returns:
trueto report differences in prefixes;falseto ignore them.
-
getGranularity
Returns the granularity of text diffing for this configuration.- Returns:
- the text granularity of text diffing for this configuration.
-
getWhiteSpaceProcessing
Returns the granularity of text diffing for this configuration.- Returns:
- the text granularity of text diffing for this configuration.
-
isIgnoreWhiteSpace
public boolean isIgnoreWhiteSpace()Indicates whether the differences in white spaces should be ignored or not.- Returns:
trueto ignore differences in white spaces;falseotherwise.
-
isPreserveWhiteSpace
public boolean isPreserveWhiteSpace()Indicates whether the white spaces are preserved or not.- Returns:
trueto preserve the white spaces;falseotherwise.
-
setIgnoreWhiteSpace
Deprecated.usesetWhiteSpaceProcessinginsteadSets whether the differences in white spaces should be ignored or not.- Parameters:
ignore-trueto ignore differences in white spaces;falseotherwise.
-
setPreserveWhiteSpace
Deprecated.usesetWhiteSpaceProcessinginsteadSets whether the white spaces should be preserved or not.- Parameters:
preserve-trueto preserve the white spaces;falseotherwise.
-
setWhiteSpaceProcessinginstead