OxygenXMLDiff 4.0 API

ro.sync.diff.api
Class DiffOptions

java.lang.Object
  extended by ro.sync.diff.api.DiffOptions

public class DiffOptions
extends java.lang.Object

Holds options needed to decide which diff algorithm and which diff options will be used.


Field Summary
static int AUTO
          The algorithm is automatically chosen based on content type, text length, options etc.
static int CHARACTERS_COMPARE
          Algorithm based on characters comparison.
static int LINES_COMPARE
          Algorithm based on line by line comparison.
static int SYNTAX_AWARE
          Algorithm based on comparing the syntax tokens.
static int WORDS_COMPARE
          Algorithm based on words comparison.
static int XML_ACCURATE
          XML accurate diff based on Sasha and Zhang algorithm.
static int XML_FAST
          Fast XML hybrid heuristic algorithm.
 
Constructor Summary
DiffOptions()
          Default constructor for default options.
DiffOptions(int algorithm, boolean ignoreWhitespaces, int maxNumberOfDiffs, boolean ignorePI, boolean ignoreComments, boolean ignoreCDATA, boolean ignoreDOCTYPE, boolean ignoreText, boolean ignoreAttributesOrder, boolean ignorePrefixes, boolean ignoreNamespaces, boolean ignoreNamespaceDeclarations, boolean ignoreEntities, boolean mergeAdjacentDifferences, boolean markEndTagsAsDifferent, boolean ignoreStateOfEmptyElements)
          Constructor.
 
Method Summary
 int getAlgorithm()
           
 int getMaxNumberOfDiffs()
           
 boolean isIgnoreAttributesOrder()
           
 boolean isIgnoreCDATA()
           
 boolean isIgnoreComments()
           
 boolean isIgnoreDOCTYPE()
           
 boolean isIgnoreEntities()
           
 boolean isIgnoreNamespaceDeclarations()
           
 boolean isIgnoreNamespaces()
           
 boolean isIgnorePI()
           
 boolean isIgnorePrefixes()
           
 boolean isIgnoreStateOfEmptyElements()
           
 boolean isIgnoreText()
           
 boolean isIgnoreWhitespaces()
           
 boolean isMarkEndTagsAsDifferent()
           
 boolean isMergeAdjacentDifferences()
           
 void setAlgorithm(int algorithm)
           
 void setIgnoreAttributesOrder(boolean ignoreAttributesOrder)
           
 void setIgnoreCDATA(boolean ignoreCDATA)
           
 void setIgnoreComments(boolean ignoreComments)
           
 void setIgnoreDOCTYPE(boolean ignoreDOCTYPE)
           
 void setIgnoreEntities(boolean ignoreEntities)
           
 void setIgnoreNamespaceDeclarations(boolean ignoreNamespaceDeclarations)
           
 void setIgnoreNamespaces(boolean ignoreNamespaces)
           
 void setIgnorePI(boolean ignorePI)
           
 void setIgnorePrefixes(boolean ignorePrefixes)
           
 void setIgnoreStateOfEmptyElements(boolean ignoreStateOfEmptyElements)
           
 void setIgnoreText(boolean ignoreText)
           
 void setIgnoreWhitespaces(boolean ignoreWhitespaces)
           
 void setMarkEndTagsAsDifferent(boolean markEndTagsAsDifferent)
           
 void setMaxNumberOfDiffs(int maxNumberOfDiffs)
           
 void setMergeAdjacentDifferences(boolean mergeAdjacentDifferences)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

AUTO

public static final int AUTO
The algorithm is automatically chosen based on content type, text length, options etc.

See Also:
Constant Field Values

CHARACTERS_COMPARE

public static final int CHARACTERS_COMPARE
Algorithm based on characters comparison.

See Also:
Constant Field Values

WORDS_COMPARE

public static final int WORDS_COMPARE
Algorithm based on words comparison.

See Also:
Constant Field Values

LINES_COMPARE

public static final int LINES_COMPARE
Algorithm based on line by line comparison.

See Also:
Constant Field Values

SYNTAX_AWARE

public static final int SYNTAX_AWARE
Algorithm based on comparing the syntax tokens.

See Also:
Constant Field Values

XML_FAST

public static final int XML_FAST
Fast XML hybrid heuristic algorithm.

See Also:
Constant Field Values

XML_ACCURATE

public static final int XML_ACCURATE
XML accurate diff based on Sasha and Zhang algorithm.

See Also:
Constant Field Values
Constructor Detail

DiffOptions

public DiffOptions(int algorithm,
                   boolean ignoreWhitespaces,
                   int maxNumberOfDiffs,
                   boolean ignorePI,
                   boolean ignoreComments,
                   boolean ignoreCDATA,
                   boolean ignoreDOCTYPE,
                   boolean ignoreText,
                   boolean ignoreAttributesOrder,
                   boolean ignorePrefixes,
                   boolean ignoreNamespaces,
                   boolean ignoreNamespaceDeclarations,
                   boolean ignoreEntities,
                   boolean mergeAdjacentDifferences,
                   boolean markEndTagsAsDifferent,
                   boolean ignoreStateOfEmptyElements)
Constructor.

Parameters:
algorithm - The used algorithm, one of the constants:
ignoreWhitespaces - true if differences consisting only in whitespaces should be ignored.
maxNumberOfDiffs - The maximum number of modifications you are interested in. If the document contain a larger number of differences the diff will only signal that they are different and stop after reaching the limit.
ignorePI - true if processing instructions should be ignored. It applies when using XML aware algorithms.
ignoreComments - true if comments should be ignored. It applies when using XML aware algorithms.
ignoreCDATA - true if CDATA sections should be ignored. It applies when using XML aware algorithms.
ignoreDOCTYPE - true if DOCTYPE sections should be ignored. It applies when using XML aware algorithms.
ignoreText - true if differences in the text content should be ignored. It applies when using XML aware algorithms.
ignoreAttributesOrder - true if the order of the attributes should be ignored. It applies when using XML aware algorithms.
ignorePrefixes - true if the prefixes should be ignored. Even if this is set the comparing takes into account the namespacea. It applies when using XML aware algorithms.
ignoreNamespaces - true if namespaces should be ignored. It applies when using XML aware algorithms.
ignoreNamespaceDeclarations - true if the namespace declaration ("xmlns" attributes) should be ignored. It applies when using XML aware algorithms.
ignoreEntities - true if entity content should be ignored. It applies when using XML aware algorithms.
mergeAdjacentDifferences - true if adjacent differences should be merged and present as a single difference. Applies when using XML aware algorithms.
markEndTagsAsDifferent - true if end tags with the same name for elements that are different in other sense will be shown as different also. It applies when using XML aware algorithms.
ignoreStateOfEmptyElements - true if sequences representing empty elements like
<a/> and <a></a>
will be considered identical. It applies when using XML aware algorithms.

DiffOptions

public DiffOptions()
Default constructor for default options.

Method Detail

getAlgorithm

public int getAlgorithm()
Returns:
Returns The used algorithm, one of the constants:

setAlgorithm

public void setAlgorithm(int algorithm)
Parameters:
algorithm - The algorithm to use, one of the constants:

getMaxNumberOfDiffs

public int getMaxNumberOfDiffs()
Returns:
Returns The maximum number of modifications you are interested in. If the document contain a larger number of differences the diff will only signal that they are different and stop after reaching the limit.

setMaxNumberOfDiffs

public void setMaxNumberOfDiffs(int maxNumberOfDiffs)
Parameters:
maxNumberOfDiffs - The maximum number of modifications you are interested in. If the document contain a larger number of differences the diff will only signal that they are different and stop after reaching the limit.

isIgnoreWhitespaces

public boolean isIgnoreWhitespaces()
Returns:
Returns true if differences consisting only in whitespaces will be ignored.

setIgnoreWhitespaces

public void setIgnoreWhitespaces(boolean ignoreWhitespaces)
Parameters:
ignoreWhitespaces - true if differences consisting only in whitespaces should be ignored.

isIgnorePI

public boolean isIgnorePI()
Returns:
Returns true if processing instructions are ignored. It applies when using XML aware algorithms.

setIgnorePI

public void setIgnorePI(boolean ignorePI)
Parameters:
ignorePI - true if processing instructions should be ignored. It applies when using XML aware algorithms.

isIgnoreComments

public boolean isIgnoreComments()
Returns:
Returns true if comments are be ignored. It applies when using XML aware algorithms.

setIgnoreComments

public void setIgnoreComments(boolean ignoreComments)
Parameters:
ignoreComments - true if comments should be ignored. It applies when using XML aware algorithms.

isIgnoreCDATA

public boolean isIgnoreCDATA()
Returns:
Returns true if CDATA sections are ignored. It applies when using XML aware algorithms.

setIgnoreCDATA

public void setIgnoreCDATA(boolean ignoreCDATA)
Parameters:
ignoreCDATA - true if CDATA sections should be ignored. It applies when using XML aware algorithms.

isIgnoreDOCTYPE

public boolean isIgnoreDOCTYPE()
Returns:
Returns true if DOCTYPE sections are ignored. It applies when using XML aware algorithms.

setIgnoreDOCTYPE

public void setIgnoreDOCTYPE(boolean ignoreDOCTYPE)
Parameters:
ignoreDOCTYPE - true if DOCTYPE sections should be ignored. It applies when using XML aware algorithms.

isIgnoreText

public boolean isIgnoreText()
Returns:
Returns code>true if differences in the text content is ignored. It applies when using XML aware algorithms.

setIgnoreText

public void setIgnoreText(boolean ignoreText)
Parameters:
ignoreText - code>true if differences in the text content should be ignored. It applies when using XML aware algorithms.

isIgnoreAttributesOrder

public boolean isIgnoreAttributesOrder()
Returns:
Returns true if the order of the attributes is ignored. It applies when using XML aware algorithms.

setIgnoreAttributesOrder

public void setIgnoreAttributesOrder(boolean ignoreAttributesOrder)
Parameters:
ignoreAttributesOrder - true if the order of the attributes should be ignored. It applies when using XML aware algorithms.

isIgnorePrefixes

public boolean isIgnorePrefixes()
Returns:
Returns code>true if the prefixes are ignored. Even if this is set the comparing takes into account the namespaces. It applies when using XML aware algorithms.

setIgnorePrefixes

public void setIgnorePrefixes(boolean ignorePrefixes)
Parameters:
ignorePrefixes - code>true if the prefixes should be ignored. Even if this is set the comparing takes into account the namespaces. It applies when using XML aware algorithms.

isIgnoreNamespaces

public boolean isIgnoreNamespaces()
Returns:
Returns true if namespaces are ignored. It applies when using XML aware algorithms.

setIgnoreNamespaces

public void setIgnoreNamespaces(boolean ignoreNamespaces)
Parameters:
ignoreNamespaces - true if namespaces should be ignored. It applies when using XML aware algorithms.

isIgnoreNamespaceDeclarations

public boolean isIgnoreNamespaceDeclarations()
Returns:
Returns true if the namespace declarations ("xmlns" attributes) are ignored. It applies when using XML aware algorithms.

setIgnoreNamespaceDeclarations

public void setIgnoreNamespaceDeclarations(boolean ignoreNamespaceDeclarations)
Parameters:
ignoreNamespaceDeclarations - true if the namespace declarations ("xmlns" attributes) should be ignored. It applies when using XML aware algorithms.

isIgnoreEntities

public boolean isIgnoreEntities()
Returns:
Returns true if entity content is ignored. It applies when using XML aware algorithms.

setIgnoreEntities

public void setIgnoreEntities(boolean ignoreEntities)
Parameters:
ignoreEntities - true if entity content should be ignored. It applies when using XML aware algorithms.

isIgnoreStateOfEmptyElements

public boolean isIgnoreStateOfEmptyElements()
Returns:
Returns true if sequences representing empty elements like
<a/> and <a></a>
are considered identical. It applies when using XML aware algorithms.

setIgnoreStateOfEmptyElements

public void setIgnoreStateOfEmptyElements(boolean ignoreStateOfEmptyElements)
Parameters:
ignoreStateOfEmptyElements - true if sequences representing empty elements like
<a/> and <a></a>
will be considered identical. It applies when using XML aware algorithms.

isMergeAdjacentDifferences

public boolean isMergeAdjacentDifferences()
Returns:
Returns true if adjacent differences are merged and present as a single difference. It applies when using XML aware algorithms.

setMergeAdjacentDifferences

public void setMergeAdjacentDifferences(boolean mergeAdjacentDifferences)
Parameters:
mergeAdjacentDifferences - true if adjacent differences should be merged and present as a single difference. It applies when using XML aware algorithms.

isMarkEndTagsAsDifferent

public boolean isMarkEndTagsAsDifferent()
Returns:
Returns true if end tags with the same name for elements that are different in other sense are shown as different also. It applies when using XML aware algorithms.

setMarkEndTagsAsDifferent

public void setMarkEndTagsAsDifferent(boolean markEndTagsAsDifferent)
Parameters:
markEndTagsAsDifferent - true if end tags with the same name for elements that are different in other sense will be shown as different also. It applies when using XML aware algorithms.

OxygenXMLDiff 4.0 API

© Copyright SyncRO Soft SRL 2002 - 2011.