XmlSerializerInputFormatter Class

Summary

This class handles deserialization of input XML data to strongly-typed objects using [System.Xml.Serialization.XmlSerializer]()

Syntax

public class XmlSerializerInputFormatter : InputFormatter, IInputFormatter

GitHub

View on GitHub

class Microsoft.AspNet.Mvc.Xml.XmlSerializerInputFormatter

Constructors

Microsoft.AspNet.Mvc.Xml.XmlSerializerInputFormatter.XmlSerializerInputFormatter()

Initializes a new instance of XmlSerializerInputFormatter.

public XmlSerializerInputFormatter()

Properties

MaxDepth()

Indicates the acceptable input XML depth.

Return type:System.Int32
public int MaxDepth { get; set; }
WrapperProviderFactories()

Gets the list of [Microsoft.AspNet.Mvc.Xml.IWrapperProviderFactory](Microsoft.AspNet.Mvc.Xml.IWrapperProviderFactory.yml) to provide the wrapping type for de-serialization.

Return type:System.Collections.Generic.IList{Microsoft.AspNet.Mvc.Xml.IWrapperProviderFactory}
public IList<IWrapperProviderFactory> WrapperProviderFactories { get; }
XmlDictionaryReaderQuotas()

The quotas include - DefaultMaxDepth, DefaultMaxStringContentLength, DefaultMaxArrayLength, DefaultMaxBytesPerRead, DefaultMaxNameTableCharCount

Return type:System.Xml.XmlDictionaryReaderQuotas
public XmlDictionaryReaderQuotas XmlDictionaryReaderQuotas { get; }

Methods

CanReadType(System.Type)
Arguments:
  • type (System.Type) –
Return type:

System.Boolean

protected override bool CanReadType(Type type)
CreateSerializer(System.Type)

Called during deserialization to get the [System.Xml.Serialization.XmlSerializer]().

Arguments:
  • type (System.Type) –
Return type:

System.Xml.Serialization.XmlSerializer

Returns:

The [System.Xml.Serialization.XmlSerializer]() used during deserialization.

protected virtual XmlSerializer CreateSerializer(Type type)
CreateXmlReader(System.IO.Stream, System.Text.Encoding)

Called during deserialization to get the [System.Xml.XmlReader]().

Arguments:
  • readStream (System.IO.Stream) – The [System.IO.Stream]() from which to read.
  • encoding (System.Text.Encoding) – The [System.Text.Encoding]() used to read the stream.
Return type:

System.Xml.XmlReader

Returns:

The [System.Xml.XmlReader]() used during deserialization.

protected virtual XmlReader CreateXmlReader(Stream readStream, Encoding encoding)
GetCachedSerializer(System.Type)

Gets the cached serializer or creates and caches the serializer for the given type.

Arguments:
  • type (System.Type) –
Return type:

System.Xml.Serialization.XmlSerializer

Returns:

The [System.Xml.Serialization.XmlSerializer]() instance.

protected virtual XmlSerializer GetCachedSerializer(Type type)
GetSerializableType(System.Type)

Gets the type to which the XML will be deserialized.

Arguments:
  • declaredType (System.Type) – The declared type.
Return type:

System.Type

Returns:

The type to which the XML will be deserialized.

protected virtual Type GetSerializableType(Type declaredType)
ReadRequestBodyAsync(Microsoft.AspNet.Mvc.InputFormatterContext)

Reads the input XML.

Arguments:
Return type:

System.Threading.Tasks.Task{System.Object}

Returns:

Task which reads the input.

public override Task<object> ReadRequestBodyAsync(InputFormatterContext context)