Class XmlReaderUtility
This utility class is designed to make System.Xml.XmlReader related operations easier to work with.
Inheritance
Namespace: Cuemon.Xml
Assembly: Cuemon.Xml.dll
Syntax
public static class XmlReaderUtility
Methods
| Improve this DocChunk(XmlReader)
Creates and returns a chunked sequence of System.Xml.XmlReader objects with a maximum of 128 XML node elements located on a depth of 1.
Declaration
public static IEnumerable<XmlReader> Chunk(XmlReader reader)
Parameters
Type | Name | Description |
---|---|---|
System.Xml.XmlReader | reader | The System.Xml.XmlReader object that contains the XML data to chunk into smaller System.Xml.XmlReader objects for a batch run or similar. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<System.Xml.XmlReader> | An sequence of System.Xml.XmlReader objects that contains no more than 128 XML node elements from the |
Chunk(XmlReader, Int32, Action<XmlWriterSettings>)
Creates and returns a chunked sequence of System.Xml.XmlReader objects with a maximum of the specified size
of XML node elements located on a depth of 1.
Declaration
public static IEnumerable<XmlReader> Chunk(XmlReader reader, int size, Action<XmlWriterSettings> setup = null)
Parameters
Type | Name | Description |
---|---|---|
System.Xml.XmlReader | reader | The System.Xml.XmlReader object that contains the XML data to chunk into smaller System.Xml.XmlReader objects for a batch run or similar. |
System.Int32 | size | The amount of XML node elements allowed per System.Xml.XmlReader object. Default is 128 XML node element. |
System.Action<System.Xml.XmlWriterSettings> | setup | The System.Xml.XmlWriterSettings which need to be configured. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<System.Xml.XmlReader> | An sequence of System.Xml.XmlReader objects that contains no more than the specified |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
|
System.ArgumentException | The System.Xml.XmlReader.Read() method of the |
CreateSettings(Action<XmlReaderSettings>)
Specifies a set of features to support the System.Xml.XmlReader object.
Declaration
public static XmlReaderSettings CreateSettings(Action<XmlReaderSettings> setup = null)
Parameters
Type | Name | Description |
---|---|---|
System.Action<System.Xml.XmlReaderSettings> | setup |
Returns
Type | Description |
---|---|
System.Xml.XmlReaderSettings | A System.Xml.XmlReaderSettings instance that specifies a set of features to support the System.Xml.XmlReader object. |
Remarks
The following table shows the overridden initial property values for an instance of System.Xml.XmlReaderSettings.
The initial property values can be viewed here: https://msdn.microsoft.com/EN-US/library/2ycwc04f(v=VS.110,d=hv.2).aspx
Property | Initial Value |
---|---|
System.Xml.XmlReaderSettings.DtdProcessing | System.Xml.DtdProcessing.Ignore |
MoveToFirstElement(XmlReader)
Moves the reader
object to the first element.
Declaration
public static bool MoveToFirstElement(XmlReader reader)
Parameters
Type | Name | Description |
---|---|---|
System.Xml.XmlReader | reader | The System.Xml.XmlReader object that contains the XML data. |
Returns
Type | Description |
---|---|
System.Boolean |
|
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
|
System.ArgumentException | The System.Xml.XmlReader.Read() method of the |