Class XmlStreamConverter
This utility class is designed to make XML System.IO.Stream related conversions easier to work with.
Inheritance
Namespace: Cuemon.Xml
Assembly: Cuemon.Xml.dll
Syntax
public static class XmlStreamConverter
Methods
| Improve this DocChangeEncoding(Stream, Encoding)
Converts the entire XML System.IO.Stream object from the resolved source encoding to the specified target encoding, preserving any preamble sequences.
Declaration
public static Stream ChangeEncoding(Stream source, Encoding targetEncoding)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | source | The System.IO.Stream to apply the conversion to. |
System.Text.Encoding | targetEncoding | The target encoding format. |
Returns
Type | Description |
---|---|
System.IO.Stream | A System.IO.Stream object containing the results of converting bytes from the resolved source encoding to the specified targetEncoding. |
ChangeEncoding(Stream, Encoding, PreambleSequence)
Converts the entire XML System.IO.Stream object from the resolved encoding of source
to the specified encoding.
If an encoding cannot be resolved from source
, UTF-8 encoding is assumed.
Declaration
public static Stream ChangeEncoding(Stream source, Encoding targetEncoding, PreambleSequence sequence)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | source | The System.IO.Stream to apply the conversion to. |
System.Text.Encoding | targetEncoding | The target encoding format. |
PreambleSequence | sequence | Determines whether too keep or remove any preamble sequences. |
Returns
Type | Description |
---|---|
System.IO.Stream | A System.IO.Stream object containing the results of converting bytes from the resolved source encoding to the specified targetEncoding. |
ChangeEncoding(Stream, Encoding, Boolean)
Converts the entire XML System.IO.Stream object from the resolved encoding of source
to the specified encoding.
If an encoding cannot be resolved from source
, UTF-8 encoding is assumed.
Declaration
public static Stream ChangeEncoding(Stream source, Encoding targetEncoding, bool omitXmlDeclaration)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | source | The System.IO.Stream to apply the conversion to. |
System.Text.Encoding | targetEncoding | The target encoding format. |
System.Boolean | omitXmlDeclaration | if set to |
Returns
Type | Description |
---|---|
System.IO.Stream | A System.IO.Stream object containing the results of converting bytes from the resolved source encoding to the specified targetEncoding. |
ChangeEncoding(Stream, Encoding, Encoding, PreambleSequence)
Converts the entire XML System.IO.Stream object from one encoding to another.
Declaration
public static Stream ChangeEncoding(Stream source, Encoding sourceEncoding, Encoding targetEncoding, PreambleSequence sequence)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | source | The System.IO.Stream to apply the conversion to. |
System.Text.Encoding | sourceEncoding | The source encoding format. |
System.Text.Encoding | targetEncoding | The target encoding format. |
PreambleSequence | sequence | Determines whether too keep or remove any preamble sequences. |
Returns
Type | Description |
---|---|
System.IO.Stream | A System.IO.Stream object containing the results of converting bytes from sourceEncoding to targetEncoding. |
ChangeEncoding(Stream, Encoding, Encoding, PreambleSequence, Boolean)
Converts the entire XML System.IO.Stream object from one encoding to another.
Declaration
public static Stream ChangeEncoding(Stream source, Encoding sourceEncoding, Encoding targetEncoding, PreambleSequence sequence, bool omitXmlDeclaration)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | source | The System.IO.Stream to apply the conversion to. |
System.Text.Encoding | sourceEncoding | The source encoding format. |
System.Text.Encoding | targetEncoding | The target encoding format. |
PreambleSequence | sequence | Determines whether too keep or remove any preamble sequences. |
System.Boolean | omitXmlDeclaration | if set to |
Returns
Type | Description |
---|---|
System.IO.Stream | A System.IO.Stream object containing the results of converting bytes from sourceEncoding to targetEncoding. |
ChangeEncoding(Stream, Encoding, Encoding, Boolean)
Converts the entire XML System.IO.Stream object from one encoding to another.
Declaration
public static Stream ChangeEncoding(Stream source, Encoding sourceEncoding, Encoding targetEncoding, bool omitXmlDeclaration)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | source | The System.IO.Stream to apply the conversion to. |
System.Text.Encoding | sourceEncoding | The source encoding format. |
System.Text.Encoding | targetEncoding | The target encoding format. |
System.Boolean | omitXmlDeclaration | if set to |
Returns
Type | Description |
---|---|
System.IO.Stream | A System.IO.Stream object containing the results of converting bytes from sourceEncoding to targetEncoding. |