Table of Contents

Class XmlReaderDecoratorExtensions

Namespace
Cuemon.Xml
Assembly
Cuemon.Xml.dll

Extension methods for the System.Xml.XmlReader class hidden behind the IDecorator<T> interface.

public static class XmlReaderDecoratorExtensions
Inheritance
Object
XmlReaderDecoratorExtensions

Methods

Chunk(IDecorator<XmlReader>, Int32, Action<XmlWriterSettings>)

Creates and returns a sequence of chunked System.Xml.XmlReader instances from the enclosed System.Xml.XmlReader of the specified decorator with a maximum of the specified size of XML node elements located on a depth of 1.

public static IEnumerable<XmlReader> Chunk(this IDecorator<XmlReader> decorator, int size = 128, Action<XmlWriterSettings> setup = null)

Parameters

decorator IDecorator<XmlReader>

The IDecorator{XmlReader} to extend.

size Int32

The amount of XML node elements allowed per System.Xml.XmlReader object. Default is 128 XML node element.

setup Action<XmlWriterSettings>

The System.Xml.XmlWriterSettings which may be configured.

Returns

IEnumerable<XmlReader>

An sequence of System.Xml.XmlReader instances that contains no more than the specified size of XML node elements from the enclosed System.Xml.XmlReader of the specified decorator.

Exceptions

System.ArgumentNullException

decorator is null.

ArgumentException

The System.Xml.XmlReader.Read method of the enclosed System.Xml.XmlReader of the specified decorator object has already been called.

MoveToFirstElement(IDecorator<XmlReader>)

Moves the enclosed System.Xml.XmlReader of the specified decorator to the first element.

public static bool MoveToFirstElement(this IDecorator<XmlReader> decorator)

Parameters

decorator IDecorator<XmlReader>

The IDecorator{XmlReader} to extend.

Returns

Boolean

true if an element exists (the reader moves to the first element), otherwise, false (the reader has reached System.Xml.XmlReader.EOF).

Exceptions

System.ArgumentNullException

decorator is null.

ArgumentException

The System.Xml.XmlReader.Read method of the enclosed System.Xml.XmlReader of the specified decorator object has already been called.

ToHierarchy(IDecorator<XmlReader>)

Converts the XML hierarchy of the enclosed System.Xml.XmlReader of the specified decorator into an IHierarchy<T>.

public static IHierarchy<DataPair> ToHierarchy(this IDecorator<XmlReader> decorator)

Parameters

decorator IDecorator<XmlReader>

The IDecorator{XmlReader} to extend.

Returns

IHierarchy<DataPair>

An IHierarchy{DataPair} implementation.

Exceptions

System.ArgumentNullException

decorator cannot be null.

See Also