xmlunit-core : Org.XmlUnit.Builder Namespace

DiffBuilder Class

DiffBuilder to create a Diff instance.

Syntax

public class DiffBuilder : IDifferenceEngineConfigurer<DiffBuilder>

Remarks

Valid inputs for control and test are all objects supported by Input#From(object).

Requirements

Namespace: Org.XmlUnit.Builder
Assembly: xmlunit-core (in xmlunit-core.dll)
Assembly Versions: 2.9.2.240

Members

See Also: Inherited members from object.

Public Methods

Build () : Org.XmlUnit.Diff.Diff
Compare the Test-XML (WithTest(Object)) with the Control-XML (Ccompare(Object)) and return the collected differences in a Diff object.
CheckForIdentical () : DiffBuilder
check test source with the control source for identically.
CheckForSimilar () : DiffBuilder
check test source with the control source for similarity.
static
Compare (object) : DiffBuilder
Create a DiffBuilder from all kind of types supported by Input#From(object).
IgnoreComments () : DiffBuilder
Will remove all comment-Tags "<!-- Comment -->" from test- and control-XML before comparing.
IgnoreCommentsUsingXSLTVersion (string) : DiffBuilder
Will remove all comment-Tags "<!-- Comment -->" from test- and control-XML before comparing.
IgnoreElementContentWhitespace () : DiffBuilder
Ignore element content whitespace by removing all text nodes solely consisting of whitespace.
IgnoreWhitespace () : DiffBuilder
Ignore whitespace by removing all empty text nodes and trimming the non-empty ones.
NormalizeWhitespace () : DiffBuilder
Normalize Text-Elements by removing all empty text nodes and normalizing the non-empty ones.
WithAttributeFilter (Predicate<System.Xml.XmlAttribute>) : DiffBuilder
Registers a filter for attributes.
WithComparisonController (Org.XmlUnit.Diff.ComparisonController) : DiffBuilder
Replace the {@link ComparisonControllers#Default} with your own ComparisonController.
WithComparisonFormatter (Org.XmlUnit.Diff.IComparisonFormatter) : DiffBuilder
Sets a non-default formatter for the differences found.
WithComparisonListeners (params Org.XmlUnit.Diff.ComparisonListener[]) : DiffBuilder
Registers listeners that are notified of each comparison.
WithDifferenceEvaluator (Org.XmlUnit.Diff.DifferenceEvaluator) : DiffBuilder
Provide your own custom {@link DifferenceEvaluator} implementation.
WithDifferenceListeners (params Org.XmlUnit.Diff.ComparisonListener[]) : DiffBuilder
Registers listeners that are notified of each comparison with outcome other than ComparisonResult#EQUAL.
WithNamespaceContext (IDictionary<string, string>) : DiffBuilder
Establish a namespace context mapping from URI to prefix that will be used in Comparison.Detail.XPath.
WithNodeFilter (Predicate<System.Xml.XmlNode>) : DiffBuilder
Registers a filter for nodes.
WithNodeMatcher (Org.XmlUnit.Diff.INodeMatcher) : DiffBuilder
Sets the strategy for selecting nodes to compare.
WithTest (object) : DiffBuilder
Set the Test-Source from all kind of types supported by Input#From(object).

Extension Methods

static
Singleton<T> (this T) : IEnumerable<T>
An enumerable containing a single element.
static
WithPlaceholderSupport<D> (this D) : D
Adds placeholder support to an IDifferenceEngineConfigurer.
static
WithPlaceholderSupportChainedAfter<D> (this D, Org.XmlUnit.Diff.DifferenceEvaluator) : D
Adds placeholder support to an IDifferenceEngineConfigurer considering an additional DifferenceEvaluator.
static
WithPlaceholderSupportUsingDelimiters<D> (this D, string, string) : D
Adds placeholder support to an IDifferenceEngineConfigurer.
static
WithPlaceholderSupportUsingDelimiters<D> (this D, string, string, string, string, string) : D
Adds placeholder support to an IDifferenceEngineConfigurer.
static
WithPlaceholderSupportUsingDelimitersChainedAfter<D> (this D, string, string, Org.XmlUnit.Diff.DifferenceEvaluator) : D
Adds placeholder support to an IDifferenceEngineConfigurer considering an additional DifferenceEvaluator.
static
WithPlaceholderSupportUsingDelimitersChainedAfter<D> (this D, string, string, string, string, string, Org.XmlUnit.Diff.DifferenceEvaluator) : D
Adds placeholder support to an IDifferenceEngineConfigurer considering an additional DifferenceEvaluator.

Member Details

Build Method

Compare the Test-XML (WithTest(Object)) with the Control-XML (Ccompare(Object)) and return the collected differences in a Diff object.

Syntax

public Org.XmlUnit.Diff.Diff Build ()

Returns

Documentation for this section has not yet been entered.

Remarks

Documentation for this section has not yet been entered.

Requirements

Namespace: Org.XmlUnit.Builder
Assembly: xmlunit-core (in xmlunit-core.dll)
Assembly Versions: 2.9.2.240

CheckForIdentical Method

check test source with the control source for identically.

Syntax

public DiffBuilder CheckForIdentical ()

Returns

Documentation for this section has not yet been entered.

Remarks

This is the Default.

Requirements

Namespace: Org.XmlUnit.Builder
Assembly: xmlunit-core (in xmlunit-core.dll)
Assembly Versions: 2.9.2.240

CheckForSimilar Method

check test source with the control source for similarity.

Syntax

public DiffBuilder CheckForSimilar ()

Returns

Documentation for this section has not yet been entered.

Remarks

Example for Similar: The XML node "<a>Text</a>" and "<a><![CDATA[Text]]></a>" are similar and the Test will not fail.

The rating, if a node is similar, will be done by the DifferenceEvaluators#Default.

Default is {@link #CheckForIdentical()}.

Requirements

Namespace: Org.XmlUnit.Builder
Assembly: xmlunit-core (in xmlunit-core.dll)
Assembly Versions: 2.9.2.240

Compare Method

Create a DiffBuilder from all kind of types supported by Input#From(object).

Syntax

public static DiffBuilder Compare (object control)

Parameters

control
the expected reference document.

Returns

Documentation for this section has not yet been entered.

Remarks

Documentation for this section has not yet been entered.

Requirements

Namespace: Org.XmlUnit.Builder
Assembly: xmlunit-core (in xmlunit-core.dll)
Assembly Versions: 2.9.2.240

IgnoreComments Method

Will remove all comment-Tags "<!-- Comment -->" from test- and control-XML before comparing.

Syntax

public DiffBuilder IgnoreComments ()

Returns

Documentation for this section has not yet been entered.

Remarks

Documentation for this section has not yet been entered.

Requirements

Namespace: Org.XmlUnit.Builder
Assembly: xmlunit-core (in xmlunit-core.dll)
Assembly Versions: 2.9.2.240

IgnoreCommentsUsingXSLTVersion Method

Will remove all comment-Tags "<!-- Comment -->" from test- and control-XML before comparing.

Syntax

public DiffBuilder IgnoreCommentsUsingXSLTVersion (string xsltVersion)

Parameters

xsltVersion
use this version for the stylesheet

Returns

Documentation for this section has not yet been entered.

Remarks

since XMLUnit 2.5.0

Requirements

Namespace: Org.XmlUnit.Builder
Assembly: xmlunit-core (in xmlunit-core.dll)
Assembly Versions: 2.9.2.240

IgnoreElementContentWhitespace Method

Ignore element content whitespace by removing all text nodes solely consisting of whitespace.

Syntax

public DiffBuilder IgnoreElementContentWhitespace ()

Returns

Documentation for this section has not yet been entered.

Remarks

since XMLUnit 2.6.0

Requirements

Namespace: Org.XmlUnit.Builder
Assembly: xmlunit-core (in xmlunit-core.dll)
Assembly Versions: 2.9.2.240

IgnoreWhitespace Method

Ignore whitespace by removing all empty text nodes and trimming the non-empty ones.

Syntax

public DiffBuilder IgnoreWhitespace ()

Returns

Documentation for this section has not yet been entered.

Remarks

If you only want to remove text nodes consisting solely of whitespace (AKA element content whitespace) but leave all other text nodes alone you should use ignoreElementContentWhitespace instead.

Requirements

Namespace: Org.XmlUnit.Builder
Assembly: xmlunit-core (in xmlunit-core.dll)
Assembly Versions: 2.9.2.240

NormalizeWhitespace Method

Normalize Text-Elements by removing all empty text nodes and normalizing the non-empty ones.

Syntax

public DiffBuilder NormalizeWhitespace ()

Returns

Documentation for this section has not yet been entered.

Remarks

"normalized" in this context means all whitespace characters are replaced by space characters and consecutive whitespace characters are collapsed.

Requirements

Namespace: Org.XmlUnit.Builder
Assembly: xmlunit-core (in xmlunit-core.dll)
Assembly Versions: 2.9.2.240

WithAttributeFilter Method

Registers a filter for attributes.

Syntax

public DiffBuilder WithAttributeFilter (Predicate<System.Xml.XmlAttribute> attributeFilter)

Parameters

attributeFilter
Documentation for this section has not yet been entered.

Returns

Documentation for this section has not yet been entered.

Remarks

Only attributes for which the predicate returns true are part of the comparison. By default all attributes are considered.

The "special" namespace, namespace-location and schema-instance-type attributes can not be ignored this way. If you want to suppress comparison of them you'll need to implement Org.XmlUnit.Diff.DifferenceEvaluator

Requirements

Namespace: Org.XmlUnit.Builder
Assembly: xmlunit-core (in xmlunit-core.dll)
Assembly Versions: 2.9.2.240

WithComparisonController Method

Replace the {@link ComparisonControllers#Default} with your own ComparisonController.

Syntax

public DiffBuilder WithComparisonController (Org.XmlUnit.Diff.ComparisonController comparisonController)

Parameters

comparisonController
Documentation for this section has not yet been entered.

Returns

Documentation for this section has not yet been entered.

Remarks

Documentation for this section has not yet been entered.

Requirements

Namespace: Org.XmlUnit.Builder
Assembly: xmlunit-core (in xmlunit-core.dll)
Assembly Versions: 2.9.2.240

WithComparisonFormatter Method

Sets a non-default formatter for the differences found.

Syntax

public DiffBuilder WithComparisonFormatter (Org.XmlUnit.Diff.IComparisonFormatter formatter)

Parameters

formatter
Documentation for this section has not yet been entered.

Returns

Documentation for this section has not yet been entered.

Remarks

Documentation for this section has not yet been entered.

Requirements

Namespace: Org.XmlUnit.Builder
Assembly: xmlunit-core (in xmlunit-core.dll)
Assembly Versions: 2.9.2.240

WithComparisonListeners Method

Registers listeners that are notified of each comparison.

Syntax

public DiffBuilder WithComparisonListeners (params Org.XmlUnit.Diff.ComparisonListener[] comparisonListeners)

Parameters

comparisonListeners
Documentation for this section has not yet been entered.

Returns

Documentation for this section has not yet been entered.

Remarks

Documentation for this section has not yet been entered.

Requirements

Namespace: Org.XmlUnit.Builder
Assembly: xmlunit-core (in xmlunit-core.dll)
Assembly Versions: 2.9.2.240

WithDifferenceEvaluator Method

Provide your own custom {@link DifferenceEvaluator} implementation.

Syntax

public DiffBuilder WithDifferenceEvaluator (Org.XmlUnit.Diff.DifferenceEvaluator differenceEvaluator)

Parameters

differenceEvaluator
Documentation for this section has not yet been entered.

Returns

Documentation for this section has not yet been entered.

Remarks

This overwrites the Default DifferenceEvaluator.

If you want use your custom DifferenceEvaluator in combination with the default or another DifferenceEvaluator you should use DifferenceEvaluators#Chain() or DifferenceEvaluators#First() to combine them:

Requirements

Namespace: Org.XmlUnit.Builder
Assembly: xmlunit-core (in xmlunit-core.dll)
Assembly Versions: 2.9.2.240

WithDifferenceListeners Method

Registers listeners that are notified of each comparison with outcome other than ComparisonResult#EQUAL.

Syntax

public DiffBuilder WithDifferenceListeners (params Org.XmlUnit.Diff.ComparisonListener[] comparisonListeners)

Parameters

comparisonListeners
Documentation for this section has not yet been entered.

Returns

Documentation for this section has not yet been entered.

Remarks

Documentation for this section has not yet been entered.

Requirements

Namespace: Org.XmlUnit.Builder
Assembly: xmlunit-core (in xmlunit-core.dll)
Assembly Versions: 2.9.2.240

WithNamespaceContext Method

Establish a namespace context mapping from URI to prefix that will be used in Comparison.Detail.XPath.

Syntax

public DiffBuilder WithNamespaceContext (IDictionary<string, string> ctx)

Parameters

ctx
Documentation for this section has not yet been entered.

Returns

Documentation for this section has not yet been entered.

Remarks

Without a namespace context (or with an empty context) the XPath expressions will only use local names for elements and attributes.

Requirements

Namespace: Org.XmlUnit.Builder
Assembly: xmlunit-core (in xmlunit-core.dll)
Assembly Versions: 2.9.2.240

WithNodeFilter Method

Registers a filter for nodes.

Syntax

public DiffBuilder WithNodeFilter (Predicate<System.Xml.XmlNode> nodeFilter)

Parameters

nodeFilter
Documentation for this section has not yet been entered.

Returns

Documentation for this section has not yet been entered.

Remarks

Only nodes for which the predicate returns true are part of the comparison. By default nodes that are neither document types nor XML declarations are considered.

Requirements

Namespace: Org.XmlUnit.Builder
Assembly: xmlunit-core (in xmlunit-core.dll)
Assembly Versions: 2.9.2.240

WithNodeMatcher Method

Sets the strategy for selecting nodes to compare.

Syntax

public DiffBuilder WithNodeMatcher (Org.XmlUnit.Diff.INodeMatcher nodeMatcher)

Parameters

nodeMatcher
Documentation for this section has not yet been entered.

Returns

Documentation for this section has not yet been entered.

Remarks

Example with org.xmlunit.diff.DefaultNodeMatcher: .WithNodeMatcher(new DefaultNodeMatcher(ElementSelectors.ByNameAndText))

Requirements

Namespace: Org.XmlUnit.Builder
Assembly: xmlunit-core (in xmlunit-core.dll)
Assembly Versions: 2.9.2.240

WithTest Method

Set the Test-Source from all kind of types supported by Input#From(object).

Syntax

public DiffBuilder WithTest (object test)

Parameters

test
the test document which must be compared with the control document.

Returns

Documentation for this section has not yet been entered.

Remarks

Documentation for this section has not yet been entered.

Requirements

Namespace: Org.XmlUnit.Builder
Assembly: xmlunit-core (in xmlunit-core.dll)
Assembly Versions: 2.9.2.240