Table of Contents

Class XmlWriterDecoratorExtensions

Namespace
Cuemon.Xml
Assembly
Cuemon.Xml.dll

Extension methods for the XmlWriter class hidden behind the IDecorator<T> interface.

public static class XmlWriterDecoratorExtensions
Inheritance
XmlWriterDecoratorExtensions

Methods

WriteEncapsulatingElementIfNotNull<T>(IDecorator<XmlWriter>, T, XmlQualifiedEntity, Action<XmlWriter, T>)

Writes the specified value with the delegate nodeWriter to the enclosed XmlWriter of the specified decorator. If elementName is not null, then the delegate nodeWriter is called from within an encapsulating Start- and End-element.

public static void WriteEncapsulatingElementIfNotNull<T>(this IDecorator<XmlWriter> decorator, T value, XmlQualifiedEntity elementName, Action<XmlWriter, T> nodeWriter)

Parameters

decorator IDecorator<XmlWriter>

The IDecorator{XmlWriter} to extend.

value T

The object to serialize.

elementName XmlQualifiedEntity

The optional fully qualified name of the element.

nodeWriter Action<XmlWriter, T>

The delegate node writer.

Type Parameters

T

The type of the object to serialize.

Exceptions

ArgumentNullException

decorator cannot be null.

WriteObject(IDecorator<XmlWriter>, Object, Type, Action<XmlFormatterOptions>)

Serializes the specified value into an XML format of the enclosed XmlWriter of the specified decorator.

public static void WriteObject(this IDecorator<XmlWriter> decorator, object value, Type objectType, Action<XmlFormatterOptions> setup = null)

Parameters

decorator IDecorator<XmlWriter>

The IDecorator{XmlWriter} to extend.

value Object

The object to serialize.

objectType Type

The type of the object to serialize.

setup Action<XmlFormatterOptions>

The XmlFormatterOptions which may be configured.

Exceptions

ArgumentNullException

decorator cannot be null.

WriteObject<T>(IDecorator<XmlWriter>, T, Action<XmlFormatterOptions>)

Serializes the specified value into an XML format of the enclosed XmlWriter of the specified decorator.

public static void WriteObject<T>(this IDecorator<XmlWriter> decorator, T value, Action<XmlFormatterOptions> setup = null)

Parameters

decorator IDecorator<XmlWriter>

The IDecorator{XmlWriter} to extend.

value T

The object to serialize.

setup Action<XmlFormatterOptions>

The XmlFormatterOptions which may be configured.

Type Parameters

T

The type of the object to serialize.

Exceptions

ArgumentNullException

decorator cannot be null.

WriteStartElement(IDecorator<XmlWriter>, XmlQualifiedEntity)

Writes the specified start tag and associates it with the given elementName of the enclosed XmlWriter of the specified decorator.

public static void WriteStartElement(this IDecorator<XmlWriter> decorator, XmlQualifiedEntity elementName)

Parameters

decorator IDecorator<XmlWriter>

The IDecorator{XmlWriter} to extend.

elementName XmlQualifiedEntity

The fully qualified name of the element.

Exceptions

ArgumentNullException

decorator cannot be null.

WriteXmlRootElement<T>(IDecorator<XmlWriter>, T, Action<XmlWriter, T, XmlQualifiedEntity>, XmlQualifiedEntity)

Writes the XML root element to the enclosed XmlWriter of the specified decorator.

public static void WriteXmlRootElement<T>(this IDecorator<XmlWriter> decorator, T value, Action<XmlWriter, T, XmlQualifiedEntity> treeWriter, XmlQualifiedEntity rootEntity = null)

Parameters

decorator IDecorator<XmlWriter>

The IDecorator{XmlWriter} to extend.

value T

The object to serialize.

treeWriter Action<XmlWriter, T, XmlQualifiedEntity>

The delegate used to write the XML hierarchy.

rootEntity XmlQualifiedEntity

The optional XmlQualifiedEntity that will provide the name of the root element.

Type Parameters

T

The type of the object to serialize.

Exceptions

ArgumentNullException

decorator cannot be null.

See Also