public final class DiffXConfig extends Object
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:
XMLRecorder
implementations,DiffXAlgorithm
implementations,DiffXFormatter
implementations.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
.
XMLRecorder
,
DiffXAlgorithm
,
DiffXFormatter
Constructor and Description |
---|
DiffXConfig()
Creates 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.
|
Modifier and Type | Method and Description |
---|---|
TextGranularity |
getGranularity()
Returns the granularity of text diffing for this configuration.
|
WhiteSpaceProcessing |
getWhiteSpaceProcessing()
Returns the granularity of text diffing for this configuration.
|
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 |
setGranularity(TextGranularity granularity)
Sets the granularity of text diffing for this configuration.
|
void |
setIgnoreWhiteSpace(boolean ignore)
Deprecated.
use
setWhiteSpaceProcessing instead |
void |
setNamespaceAware(boolean aware)
Sets whether Diff-X should take namespaces into account.
|
void |
setPreserveWhiteSpace(boolean preserve)
Deprecated.
use
setWhiteSpaceProcessing instead |
void |
setReportPrefixDifferences(boolean report)
Sets whether the Diff-X should report differences in prefixes.
|
void |
setWhiteSpaceProcessing(WhiteSpaceProcessing whitespace)
Sets the white space processing for this configuration.
|
public DiffXConfig()
public DiffXConfig(TextGranularity granularity)
granularity
- The granularity of text diffing.public DiffXConfig(WhiteSpaceProcessing whitespace, TextGranularity granularity)
whitespace
- How whitespace should be processed.granularity
- The granularity of text diffing.public void setGranularity(TextGranularity granularity)
granularity
- the text granularity of text diffing for this configuration.public void setWhiteSpaceProcessing(WhiteSpaceProcessing whitespace)
whitespace
- the white space processing for this configuration.public void setNamespaceAware(boolean aware)
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.
aware
- true
to preserve the white spaces;
false
otherwise.public void setReportPrefixDifferences(boolean report)
In order to avoid an illegal state, if this flag is set to false
and then the processor becomes namespace aware.
report
- true
to report differences in prefixes;
false
to ignore them.public boolean isNamespaceAware()
true
to preserve the white spaces;
false
otherwise.public boolean isReportPrefixDifferences()
true
to report differences in prefixes;
false
to ignore them.public TextGranularity getGranularity()
public WhiteSpaceProcessing getWhiteSpaceProcessing()
public boolean isIgnoreWhiteSpace()
true
to ignore differences in white spaces;
false
otherwise.public boolean isPreserveWhiteSpace()
true
to preserve the white spaces;
false
otherwise.@Deprecated public void setIgnoreWhiteSpace(boolean ignore)
setWhiteSpaceProcessing
insteadignore
- true
to ignore differences in white spaces;
false
otherwise.@Deprecated public void setPreserveWhiteSpace(boolean preserve)
setWhiteSpaceProcessing
insteadpreserve
- true
to preserve the white spaces;
false
otherwise.Copyright © 2007-2019. All Rights Reserved.