xmlunit-core : Org.XmlUnit.Diff Namespace

DefaultComparisonFormatter Class

Formatter methods for a Comparison Object.

Syntax

public class DefaultComparisonFormatter : IComparisonFormatter

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.7.1.175

Members

See Also: Inherited members from object.

Public Constructors

Documentation for this section has not yet been entered.

Public Methods

GetDescription (Comparison) : string
Return a short String of the Comparison including the XPath and the shorten value of the effected control and test Node.
GetDetails (Comparison.Detail, ComparisonType, bool) : string
Return the xml node from Detail#Target as formatted String.

Protected Methods

AppendAttribute (System.Text.StringBuilder, System.Xml.XmlAttribute)
Formats a placeholder for an attribute for GetShortString.
AppendComment (System.Text.StringBuilder, System.Xml.XmlComment)
Formats a comment for GetShortString.
AppendDocumentElementIndication (System.Text.StringBuilder, System.Xml.XmlDocument)
Appends a short indication of the document's root element like "<ElementName...>" for GetShortString.
AppendDocumentType (System.Text.StringBuilder, System.Xml.XmlDocumentType) : bool
Appends the XML DOCTYPE for GetShortString or AppendFullDocumentHeader if present.
AppendDocumentXmlDeclaration (System.Text.StringBuilder, System.Xml.XmlDeclaration) : bool
Appends the XML declaration for GetShortString or AppendFullDocumentHeader if it contains non-default values.
AppendElement (System.Text.StringBuilder, System.Xml.XmlElement)
Formats a placeholder for an element for GetShortString.
AppendFullDocumentHeader (System.Text.StringBuilder, System.Xml.XmlDocument)
Appends the XML declaration and DOCTYPE if present as well as the document's root element for GetFullFormattedXml.
AppendProcessingInstruction (System.Text.StringBuilder, System.Xml.XmlProcessingInstruction)
Formats a processing instruction for GetShortString.
AppendText (System.Text.StringBuilder, System.Xml.XmlCharacterData)
Formats a text or CDATA node for GetShortString.
AppendXPath (System.Text.StringBuilder, string)
Appends the XPath information for GetShortString if present.
CreateXmlWriter (System.Text.StringBuilder, int) : System.Xml.XmlWriter
Create a default Writer to format a XML-Node to a String.
GetFormattedNodeXml (System.Xml.XmlNode, bool) : string
Formats a node with the help of XmlWriter.
GetFullFormattedXml (System.Xml.XmlNode, ComparisonType, bool) : string
Formats the node using a format suitable for the node type and comparison.
GetShortString (System.Xml.XmlNode, string, ComparisonType) : string
Return a string representation for GetShortString that describes the "thing" that has been compared so users know how to locate it.
GetValue (object, ComparisonType) : object
May alter the display of a comparison value for GetShortString based on the comparison type.
NodeType (System.Xml.XmlNodeType) : string
Provides a display text for the constant values of the XmlNodeType enum.

Extension Methods

static
Singleton<T> (this T) : IEnumerable<T>
An enumerable containing a single element.

Member Details

DefaultComparisonFormatter Constructor

Documentation for this section has not yet been entered.

Syntax

public DefaultComparisonFormatter ()

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.7.1.175

AppendAttribute Method

Formats a placeholder for an attribute for GetShortString.

Syntax

protected virtual void AppendAttribute (System.Text.StringBuilder sb, System.Xml.XmlAttribute aNode)

Parameters

sb
the builder to append to
aNode
the attribute

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.7.1.175

AppendComment Method

Formats a comment for GetShortString.

Syntax

protected virtual void AppendComment (System.Text.StringBuilder sb, System.Xml.XmlComment aNode)

Parameters

sb
the builder to append to
aNode
the comment

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.7.1.175

AppendDocumentElementIndication Method

Appends a short indication of the document's root element like "<ElementName...>" for GetShortString.

Syntax

protected virtual void AppendDocumentElementIndication (System.Text.StringBuilder sb, System.Xml.XmlDocument doc)

Parameters

sb
the builder to append to
doc
the XML document node

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.7.1.175

AppendDocumentType Method

Appends the XML DOCTYPE for GetShortString or AppendFullDocumentHeader if present.

Syntax

protected virtual bool AppendDocumentType (System.Text.StringBuilder sb, System.Xml.XmlDocumentType type)

Parameters

sb
the builder to append to
type
the document type

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.7.1.175

AppendDocumentXmlDeclaration Method

Appends the XML declaration for GetShortString or AppendFullDocumentHeader if it contains non-default values.

Syntax

protected virtual bool AppendDocumentXmlDeclaration (System.Text.StringBuilder sb, System.Xml.XmlDeclaration dec)

Parameters

sb
the builder to append to
dec
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.7.1.175

AppendElement Method

Formats a placeholder for an element for GetShortString.

Syntax

protected virtual void AppendElement (System.Text.StringBuilder sb, System.Xml.XmlElement aNode)

Parameters

sb
the builder to append to
aNode
the element

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.7.1.175

AppendFullDocumentHeader Method

Appends the XML declaration and DOCTYPE if present as well as the document's root element for GetFullFormattedXml.

Syntax

protected virtual void AppendFullDocumentHeader (System.Text.StringBuilder sb, System.Xml.XmlDocument doc)

Parameters

sb
the builder to append to
doc
the document to format

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.7.1.175

AppendProcessingInstruction Method

Formats a processing instruction for GetShortString.

Syntax

protected virtual void AppendProcessingInstruction (System.Text.StringBuilder sb, System.Xml.XmlProcessingInstruction instr)

Parameters

sb
the builder to append to
instr
the processing instruction

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.7.1.175

AppendText Method

Formats a text or CDATA node for GetShortString.

Syntax

protected virtual void AppendText (System.Text.StringBuilder sb, System.Xml.XmlCharacterData aNode)

Parameters

sb
the builder to append to
aNode
the text or CDATA node

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.7.1.175

AppendXPath Method

Appends the XPath information for GetShortString if present.

Syntax

protected virtual void AppendXPath (System.Text.StringBuilder sb, string xpath)

Parameters

sb
the builder to append to
xpath
the xpath to append, if any

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.7.1.175

CreateXmlWriter Method

Create a default Writer to format a XML-Node to a String.

Syntax

protected virtual System.Xml.XmlWriter CreateXmlWriter (System.Text.StringBuilder sb, int numberOfBlanksToIndent)

Parameters

sb
StringBuilder to wrap as writer
numberOfBlanksToIndent
the number of spaces which is used for indent the XML-structure

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.7.1.175

GetDescription Method

Return a short String of the Comparison including the XPath and the shorten value of the effected control and test Node.

Syntax

public string GetDescription (Comparison difference)

Parameters

difference
Documentation for this section has not yet been entered.

Returns

Documentation for this section has not yet been entered.

Remarks

In general the String will look like "Expected X 'Y' but was 'Z' - comparing A to B" where A and B are the result of invoking GetShortString on the target and XPath of the control and test details of the comparison. A is the description of the comparison and B and C are the control and test values (passed through GetValue) respectively.

For missing attributes the string has a slightly different format.

Requirements

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

GetDetails Method

Return the xml node from Detail#Target as formatted String.

Syntax

public string GetDetails (Comparison.Detail difference, ComparisonType type, bool formatXml)

Parameters

difference
Documentation for this section has not yet been entered.
type
The implementation can return different details depending on the ComparisonType.
formatXml
set this to true if the Comparison was generated with DiffBuilder#IgnoreWhitespace.

Returns

Documentation for this section has not yet been entered.

Remarks

Delegates to GetFullFormattedXml unless the Comparison.Detail's Target is null.

Requirements

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

GetFormattedNodeXml Method

Formats a node with the help of XmlWriter.

Syntax

protected virtual string GetFormattedNodeXml (System.Xml.XmlNode nodeToConvert, bool formatXml)

Parameters

nodeToConvert
the node to format
formatXml
true if the Comparison was generated with IgnoreWhitespace - this affects the indentation of the generated output

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.7.1.175

GetFullFormattedXml Method

Formats the node using a format suitable for the node type and comparison.

Syntax

protected virtual string GetFullFormattedXml (System.Xml.XmlNode node, ComparisonType type, bool formatXml)

Parameters

node
the node to format
type
the comparison type
formatXml
true if the Comparison was generated with IgnoreWhitespace - this affects the indentation of the generated output

Returns

Documentation for this section has not yet been entered.

Remarks

The implementation outputs the document prolog and start element for Document and DocumentType nodes and may elect to format the node's parent element rather than just the node depending on the node and comparison type. It delegates to AppendFullDocumentHeader or GetFormattedNodeXml.

Requirements

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

GetShortString Method

Return a string representation for GetShortString that describes the "thing" that has been compared so users know how to locate it.

Syntax

protected virtual string GetShortString (System.Xml.XmlNode node, string xpath, ComparisonType type)

Parameters

node
the node to describe
xpath
xpath of the node if applicable
type
the comparison type

Returns

Documentation for this section has not yet been entered.

Remarks

Examples are "<bar ...> at /foo[1]/bar[1]" for a comparison of elements or "<!-- Comment Text --> at /foo[2]/comment()[1]" for a comment.

This implementation dispatches to several AppendX methods based on the comparison type or the type of the node.

Requirements

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

GetValue Method

May alter the display of a comparison value for GetShortString based on the comparison type.

Syntax

protected virtual object GetValue (object value, ComparisonType type)

Parameters

value
the value to display
type
the comparison type

Returns

Documentation for this section has not yet been entered.

Remarks

This implementation returns value unless it is a comparison of node types in which case the numeric value (one of the values of the XmlNodeType enum) is mapped to a more useful string.

Requirements

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

NodeType Method

Provides a display text for the constant values of the XmlNodeType enum.

Syntax

protected virtual string NodeType (System.Xml.XmlNodeType type)

Parameters

type
the node type

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.7.1.175