xmlunit-core : Org.XmlUnit.Diff Namespace

ElementSelectors Class

Common ElementSelector implementations.

Syntax

public static class ElementSelectors

Remarks

Documentation for this section has not yet been entered.

Requirements

Namespace: Org.XmlUnit.Diff
Assembly: xmlunit-core (in xmlunit-core.dll)
Assembly Versions: 2.10.0.241

Members

See Also: Inherited members from object.

Public Methods

static
And (params ElementSelector[]) : ElementSelector
Accepts two elements if all of the given ElementSelectors do.
static
ByName (System.Xml.XmlElement, System.Xml.XmlElement) : bool
Elements with the same local name (and namespace URI - if any) can be compared.
static
ByNameAndAllAttributes (Predicate<System.Xml.XmlAttribute>) : ElementSelector
Elements with the same local name (and namespace URI - if any) and attribute values for all attributes can be compared.
static
ByNameAndAllAttributes (System.Xml.XmlElement, System.Xml.XmlElement) : bool
Elements with the same local name (and namespace URI - if any) and attribute values for all attributes can be compared.
static
ByNameAndAttributes (params string[]) : ElementSelector
Elements with the same local name (and namespace URI - if any) and attribute values for the given attribute names can be compared.
static
ByNameAndAttributes (params System.Xml.XmlQualifiedName[]) : ElementSelector
Elements with the same local name (and namespace URI - if any) and attribute values for the given attribute names can be compared.
static
ByNameAndAttributesControlNS (params string[]) : ElementSelector
Elements with the same local name (and namespace URI - if any) and attribute values for the given attribute names can be compared.
static
ByNameAndText (System.Xml.XmlElement, System.Xml.XmlElement) : bool
Elements with the same local name (and namespace URI - if any) and nested text (if any) can be compared.
static
ByXPath (string, ElementSelector) : ElementSelector
Selects two elements as matching if the child elements selected via XPath match using the given childSelector.
static
ByXPath (string, IDictionary<string, string>, ElementSelector) : ElementSelector
Selects two elements as matching if the child elements selected via XPath match using the given childSelector.
static
ConditionalBuilder () : ElementSelectors.IConditionalSelectorBuilder
Allows to build complex ElementSelectors by combining simpler blocks.
static
ConditionalSelector (Predicate<System.Xml.XmlElement>, ElementSelector) : ElementSelector
Applies the wrapped ElementSelector's logic if and only if the control element matches the given predicate.
static
Default (System.Xml.XmlElement, System.Xml.XmlElement) : bool
Always returns true, i.e. each element can be compared to each other element.
static
Not (ElementSelector) : ElementSelector
Negates another ElementSelector
static
Or (params ElementSelector[]) : ElementSelector
Accepts two elements if at least one of the given ElementSelectors does.
static
SelectorForElementNamed (string, ElementSelector) : ElementSelector
Applies the wrapped ElementSelector's logic if and only if the control element has the given (local) name.
static
SelectorForElementNamed (System.Xml.XmlQualifiedName, ElementSelector) : ElementSelector
Applies the wrapped ElementSelector's logic if and only if the control element has the given name.
static
Xor (ElementSelector, ElementSelector) : ElementSelector
Accepts two elements if exactly on of the given ElementSelectors does.

Member Details

And Method

Accepts two elements if all of the given ElementSelectors do.

Syntax

public static ElementSelector And (params ElementSelector[] selectors)

Parameters

selectors
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.Diff
Assembly: xmlunit-core (in xmlunit-core.dll)
Assembly Versions: 2.10.0.241

ByName Method

Elements with the same local name (and namespace URI - if any) can be compared.

Syntax

public static bool ByName (System.Xml.XmlElement controlElement, System.Xml.XmlElement testElement)

Parameters

controlElement
Documentation for this section has not yet been entered.
testElement
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.Diff
Assembly: xmlunit-core (in xmlunit-core.dll)
Assembly Versions: 2.10.0.241

ByNameAndAllAttributes Method

Elements with the same local name (and namespace URI - if any) and attribute values for all attributes can be compared.

Syntax

public static ElementSelector ByNameAndAllAttributes (Predicate<System.Xml.XmlAttribute> attributeFiler)

Parameters

attributeFiler
Documentation for this section has not yet been entered.

Returns

Documentation for this section has not yet been entered.

Remarks

since XMLUnit 2.10.0

Requirements

Namespace: Org.XmlUnit.Diff
Assembly: xmlunit-core (in xmlunit-core.dll)
Assembly Versions: 2.10.0.241

ByNameAndAllAttributes Method

Elements with the same local name (and namespace URI - if any) and attribute values for all attributes can be compared.

Syntax

public static bool ByNameAndAllAttributes (System.Xml.XmlElement controlElement, System.Xml.XmlElement testElement)

Parameters

controlElement
Documentation for this section has not yet been entered.
testElement
Documentation for this section has not yet been entered.

Returns

Documentation for this section has not yet been entered.

Remarks

This ElementSelector doesn't know anything about a potentially configured attribute filter so may also compare attributes that are excluded from comparison by the filter. Use the ByNameAndAllAttributes(Predicate) passing in your attribute filter if this causes problems.

Requirements

Namespace: Org.XmlUnit.Diff
Assembly: xmlunit-core (in xmlunit-core.dll)
Assembly Versions: 2.10.0.241

ByNameAndAttributes Method

Elements with the same local name (and namespace URI - if any) and attribute values for the given attribute names can be compared.

Syntax

public static ElementSelector ByNameAndAttributes (params string[] attribs)

Parameters

attribs
Documentation for this section has not yet been entered.

Returns

Documentation for this section has not yet been entered.

Remarks

Attributes are only searched for in the null namespace.

Requirements

Namespace: Org.XmlUnit.Diff
Assembly: xmlunit-core (in xmlunit-core.dll)
Assembly Versions: 2.10.0.241

ByNameAndAttributes Method

Elements with the same local name (and namespace URI - if any) and attribute values for the given attribute names can be compared.

Syntax

public static ElementSelector ByNameAndAttributes (params System.Xml.XmlQualifiedName[] attribs)

Parameters

attribs
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.Diff
Assembly: xmlunit-core (in xmlunit-core.dll)
Assembly Versions: 2.10.0.241

ByNameAndAttributesControlNS Method

Elements with the same local name (and namespace URI - if any) and attribute values for the given attribute names can be compared.

Syntax

public static ElementSelector ByNameAndAttributesControlNS (params string[] attribs)

Parameters

attribs
Documentation for this section has not yet been entered.

Returns

Documentation for this section has not yet been entered.

Remarks

Namespace URIs of attributes are those of the attributes on the control element or the null namespace if they don't exist.

Requirements

Namespace: Org.XmlUnit.Diff
Assembly: xmlunit-core (in xmlunit-core.dll)
Assembly Versions: 2.10.0.241

ByNameAndText Method

Elements with the same local name (and namespace URI - if any) and nested text (if any) can be compared.

Syntax

public static bool ByNameAndText (System.Xml.XmlElement controlElement, System.Xml.XmlElement testElement)

Parameters

controlElement
Documentation for this section has not yet been entered.
testElement
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.Diff
Assembly: xmlunit-core (in xmlunit-core.dll)
Assembly Versions: 2.10.0.241

ByXPath Method

Selects two elements as matching if the child elements selected via XPath match using the given childSelector.

Syntax

public static ElementSelector ByXPath (string xpath, ElementSelector childSelector)

Parameters

xpath
XPath expression applied in the context of the elements to chose from that selects the children to compare.
childSelector
ElementSelector to apply to the selected children.

Returns

an ElementSelector

Remarks

The xpath expression should yield elements. Two elements match if a DefaultNodeMatcher applied to the selected children finds matching pairs for all children.

Requirements

Namespace: Org.XmlUnit.Diff
Assembly: xmlunit-core (in xmlunit-core.dll)
Assembly Versions: 2.10.0.241

ByXPath Method

Selects two elements as matching if the child elements selected via XPath match using the given childSelector.

Syntax

public static ElementSelector ByXPath (string xpath, IDictionary<string, string> prefix2Uri, ElementSelector childSelector)

Parameters

xpath
XPath expression applied in the context of the elements to chose from that selects the children to compare.
prefix2Uri
provides prefix mapping for namespace prefixes used inside the xpath expression. Maps from prefix to namespace URI
childSelector
ElementSelector to apply to the selected children.

Returns

Documentation for this section has not yet been entered.

Remarks

The xpath expression should yield elements. Two elements match if a DefaultNodeMatcher applied to the selected children finds matching pairs for all children.

Requirements

Namespace: Org.XmlUnit.Diff
Assembly: xmlunit-core (in xmlunit-core.dll)
Assembly Versions: 2.10.0.241

ConditionalBuilder Method

Allows to build complex ElementSelectors by combining simpler blocks.

Syntax

public static ElementSelectors.IConditionalSelectorBuilder ConditionalBuilder ()

Returns

Documentation for this section has not yet been entered.

Remarks

All pairs created by the when*/thenUse pairs are evaluated in order until one returns true, finally the default, if any, is consulted.

Requirements

Namespace: Org.XmlUnit.Diff
Assembly: xmlunit-core (in xmlunit-core.dll)
Assembly Versions: 2.10.0.241

ConditionalSelector Method

Applies the wrapped ElementSelector's logic if and only if the control element matches the given predicate.

Syntax

public static ElementSelector ConditionalSelector (Predicate<System.Xml.XmlElement> predicate, ElementSelector es)

Parameters

predicate
Documentation for this section has not yet been entered.
es
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.Diff
Assembly: xmlunit-core (in xmlunit-core.dll)
Assembly Versions: 2.10.0.241

Default Method

Always returns true, i.e. each element can be compared to each other element.

Syntax

public static bool Default (System.Xml.XmlElement controlElement, System.Xml.XmlElement testElement)

Parameters

controlElement
Documentation for this section has not yet been entered.
testElement
Documentation for this section has not yet been entered.

Returns

Documentation for this section has not yet been entered.

Remarks

Generally this means elements will be compared in document order.

Requirements

Namespace: Org.XmlUnit.Diff
Assembly: xmlunit-core (in xmlunit-core.dll)
Assembly Versions: 2.10.0.241

Not Method

Negates another ElementSelector

Syntax

public static ElementSelector Not (ElementSelector es)

Parameters

es
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.Diff
Assembly: xmlunit-core (in xmlunit-core.dll)
Assembly Versions: 2.10.0.241

Or Method

Accepts two elements if at least one of the given ElementSelectors does.

Syntax

public static ElementSelector Or (params ElementSelector[] selectors)

Parameters

selectors
Documentation for this section has not yet been entered.

Returns

Documentation for this section has not yet been entered.

Remarks

There is an important difference between using ElementSelectors#Or to combine multiple ElementSelectors and using DefaultNodeMatcher's constructor with multiple ElementSelectors:

Consider ElementSelectors e1 and e2 and two control and test nodes each. Assume e1 would match the first control node to the second test node and vice versa if used alone, while e2 would match the nodes in order (the first control node to the first test and so on).

ElementSelectors#Or creates a combined ElementSelector that is willing to match the first control node to both of the test nodes - and the same for the second control node. Since nodes are compared in order when possible the result will be the same as running e2 alone.

DefaultNodeMatcher with two ElementSelectors will consult the ElementSelectors separately and only invoke e2 if there are any nodes not matched by e1 at all. In this case the result will be the same as running e1 alone.

Requirements

Namespace: Org.XmlUnit.Diff
Assembly: xmlunit-core (in xmlunit-core.dll)
Assembly Versions: 2.10.0.241

SelectorForElementNamed Method

Applies the wrapped ElementSelector's logic if and only if the control element has the given (local) name.

Syntax

public static ElementSelector SelectorForElementNamed (string expectedName, ElementSelector es)

Parameters

expectedName
Documentation for this section has not yet been entered.
es
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.Diff
Assembly: xmlunit-core (in xmlunit-core.dll)
Assembly Versions: 2.10.0.241

SelectorForElementNamed Method

Applies the wrapped ElementSelector's logic if and only if the control element has the given name.

Syntax

public static ElementSelector SelectorForElementNamed (System.Xml.XmlQualifiedName expectedName, ElementSelector es)

Parameters

expectedName
Documentation for this section has not yet been entered.
es
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.Diff
Assembly: xmlunit-core (in xmlunit-core.dll)
Assembly Versions: 2.10.0.241

Xor Method

Accepts two elements if exactly on of the given ElementSelectors does.

Syntax

public static ElementSelector Xor (ElementSelector es1, ElementSelector es2)

Parameters

es1
Documentation for this section has not yet been entered.
es2
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.Diff
Assembly: xmlunit-core (in xmlunit-core.dll)
Assembly Versions: 2.10.0.241