Class XmlWriterExtensions
Extension methods for the System.Xml.XmlWriter.
Inheritance
Namespace: Cuemon.Serialization.Xml
Assembly: Cuemon.Serialization.Xml.dll
Syntax
public static class XmlWriterExtensions
Methods
| Improve this DocWriteEncapsulatingElementIfNotNull<T>(XmlWriter, T, XmlQualifiedEntity, Action<XmlWriter, T>)
Writes the specified value
with the delegate nodeWriter
.
If elementName
is not null, then the delegate nodeWriter
is called from within an encapsulating Start- and End-element.
Declaration
public static void WriteEncapsulatingElementIfNotNull<T>(this XmlWriter writer, T value, XmlQualifiedEntity elementName, Action<XmlWriter, T> nodeWriter)
Parameters
Type | Name | Description |
---|---|---|
System.Xml.XmlWriter | writer | The writer used in the serialization process. |
T | value | The object to serialize. |
XmlQualifiedEntity | elementName | The optional fully qualified name of the element. |
System.Action<System.Xml.XmlWriter, T> | nodeWriter | The delegate node writer. |
Type Parameters
Name | Description |
---|---|
T | The type of the object to serialize. |
WriteObject(XmlWriter, Object, Type, Action<XmlSerializerSettings>)
Serializes the specified value
into an XML format.
Declaration
public static void WriteObject(this XmlWriter writer, object value, Type objectType, Action<XmlSerializerSettings> setup = null)
Parameters
Type | Name | Description |
---|---|---|
System.Xml.XmlWriter | writer | The writer used in the serialization process. |
System.Object | value | The object to serialize. |
System.Type | objectType | The type of the object to serialize. |
System.Action<XmlSerializerSettings> | setup | The XmlSerializerSettings which need to be configured. |
WriteObject<T>(XmlWriter, T, Action<XmlSerializerSettings>)
Serializes the specified value
into an XML format.
Declaration
public static void WriteObject<T>(this XmlWriter writer, T value, Action<XmlSerializerSettings> setup = null)
Parameters
Type | Name | Description |
---|---|---|
System.Xml.XmlWriter | writer | The writer used in the serialization process. |
T | value | The object to serialize. |
System.Action<XmlSerializerSettings> | setup | The XmlSerializerSettings which need to be configured. |
Type Parameters
Name | Description |
---|---|
T | The type of the object to serialize. |
WriteStartElement(XmlWriter, XmlQualifiedEntity)
Writes the specified start tag and associates it with the given elementName
.
Declaration
public static void WriteStartElement(this XmlWriter writer, XmlQualifiedEntity elementName)
Parameters
Type | Name | Description |
---|---|---|
System.Xml.XmlWriter | writer | The writer used in the serialization process. |
XmlQualifiedEntity | elementName | The fully qualified name of the element. |
WriteXmlRootElement<T>(XmlWriter, T, Action<XmlWriter, T, XmlQualifiedEntity>, XmlQualifiedEntity)
Writes the XML root element to an existing writer
.
Declaration
public static void WriteXmlRootElement<T>(this XmlWriter writer, T value, Action<XmlWriter, T, XmlQualifiedEntity> treeWriter, XmlQualifiedEntity rootEntity = null)
Parameters
Type | Name | Description |
---|---|---|
System.Xml.XmlWriter | writer | The writer used in the serialization process. |
T | value | The object to serialize. |
System.Action<System.Xml.XmlWriter, T, XmlQualifiedEntity> | treeWriter | The delegate used to write the XML hierarchy. |
XmlQualifiedEntity | rootEntity | The optional XmlQualifiedEntity that will provide the name of the root element. |
Type Parameters
Name | Description |
---|---|
T | The type of the object to serialize. |