Partager via


XmlSerializationWriter Class

Microsoft Silverlight will reach end of support after October 2021. Learn more.

This API supports the .NET Framework infrastructure and is not intended to be used directly from your code.

Abstract class used for controlling serialization by the XmlSerializer class.

Inheritance Hierarchy

System.Object
  System.Xml.Serialization.XmlSerializationGeneratedCode
    System.Xml.Serialization.XmlSerializationWriter

Namespace:  System.Xml.Serialization
Assembly:  System.Xml.Serialization (in System.Xml.Serialization.dll)

Syntax

'Declaration
Public MustInherit Class XmlSerializationWriter _
    Inherits XmlSerializationGeneratedCode
public abstract class XmlSerializationWriter : XmlSerializationGeneratedCode

The XmlSerializationWriter type exposes the following members.

Constructors

  Name Description
Protected method XmlSerializationWriter Initializes a new instance of the XmlSerializationWriter class.

Top

Properties

  Name Description
Protected property EscapeName Gets or sets a value that indicates whether the EncodeName method is used to write valid XML.
Protected property Writer Gets the XmlWriter that is being used by the XmlSerializationWriter.
Protected property XmlNamespaces Gets or sets a list of XML qualified name objects that contain the namespaces and prefixes used to produce qualified names in XML documents.

Top

Methods

  Name Description
Protected method CreateChoiceIdentifierValueException Creates an InvalidOperationException that indicates an unexpected name for an element that adheres to an XML Schema choice element declaration.
Protected method CreateInvalidAnyTypeException(Object) Creates an InvalidOperationException that indicates the XmlAnyElementAttribute has been invalidly applied to a member; only members that are of type XmlNode, or derived from XmlNode, are valid.
Protected method CreateInvalidAnyTypeException(Type) Creates an InvalidOperationException that indicates the XmlAnyElementAttribute has been invalidly applied to a member; only members that are of type XmlNode, or derived from XmlNode, are valid.
Protected method CreateInvalidChoiceIdentifierValueException Creates an InvalidOperationException that indicates a failure while writing an array where an XML Schema choice element declaration is applied.
Protected method CreateInvalidEnumValueException Creates an InvalidOperationException for an invalid enumeration value.
Protected method CreateMismatchChoiceException Creates an InvalidOperationException that indicates that a value for an XML element does not match an enumeration type.
Protected method CreateUnknownAnyElementException Creates an InvalidOperationException that indicates that an XML element that should adhere to the XML Schema any element declaration cannot be processed.
Protected method CreateUnknownTypeException(Object) Creates an InvalidOperationException that indicates that a type being serialized is not being used in a valid manner or is unexpectedly encountered.
Protected method CreateUnknownTypeException(Type) Creates an InvalidOperationException that indicates that a type being serialized is not being used in a valid manner or is unexpectedly encountered.
Public method Equals(Object) Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected method Finalize Allows an object to try to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.)
Protected methodStatic member FromByteArrayBase64 Processes a base-64 byte array.
Protected methodStatic member FromByteArrayHex Produces a string from an input hexadecimal byte array.
Protected methodStatic member FromChar Produces a string from an input Char.
Protected methodStatic member FromDate Produces a string from a DateTime object.
Protected methodStatic member FromDateTime Produces a string from an input DateTime.
Protected methodStatic member FromEnum(Int64, array<String[], array<Int64[]) Produces a string that consists of delimited identifiers that represent the enumeration members that have been set.
Protected methodStatic member FromEnum(Int64, array<String[], array<Int64[], String) Takes a numeric enumeration value and the names and constants from the enumerator list for the enumeration and returns a string that consists of delimited identifiers that represent the enumeration members that have been set.
Protected methodStatic member FromTime Produces a string from a DateTime object.
Protected methodStatic member FromXmlName Encodes a valid XML name by replacing characters that are not valid with escape sequences.
Protected methodStatic member FromXmlNCName Encodes a valid XML local name by replacing characters that are not valid with escape sequences.
Protected methodStatic member FromXmlNmToken Encodes an XML name.
Protected methodStatic member FromXmlNmTokens Encodes a space-delimited sequence of XML names into a single XML name.
Protected method FromXmlQualifiedName(XmlQualifiedName) Returns an XML qualified name, with invalid characters replaced by escape sequences.
Protected method FromXmlQualifiedName(XmlQualifiedName, Boolean) Produces a string that can be written as an XML qualified name, with invalid characters replaced by escape sequences.
Public method GetHashCode Serves as a hash function for a particular type. (Inherited from Object.)
Public method GetType Gets the Type of the current instance. (Inherited from Object.)
Protected method InitCallbacks Initializes instances of the XmlSerializationWriteCallback delegate to serialize SOAP-encoded XML data.
Protected method MemberwiseClone Creates a shallow copy of the current Object. (Inherited from Object.)
Protected method TopLevelElement Initializes object references only while serializing a SOAP-encoded SOAP message.
Public method ToString Returns a string that represents the current object. (Inherited from Object.)
Protected method WriteAttribute(String, array<Byte[]) Instructs an XmlWriter object to write an XML attribute that has no namespace specified for its name.
Protected method WriteAttribute(String, String) Instructs the XmlWriter to write an XML attribute that has no namespace specified for its name.
Protected method WriteAttribute(String, String, array<Byte[]) Instructs an XmlWriter object to write an XML attribute.
Protected method WriteAttribute(String, String, String) Writes an XML attribute.
Protected method WriteAttribute(String, String, String, String) Writes an XML attribute where the namespace prefix is provided manually.
Protected method WriteElementQualifiedName(String, XmlQualifiedName) Writes an XML element with a specified qualified name in its body.
Protected method WriteElementQualifiedName(String, String, XmlQualifiedName) Writes an XML element with a specified qualified name in its body.
Protected method WriteElementQualifiedName(String, XmlQualifiedName, XmlQualifiedName) Writes an XML element with a specified qualified name in its body.
Protected method WriteElementQualifiedName(String, String, XmlQualifiedName, XmlQualifiedName) Writes an XML element with a specified qualified name in its body.
Protected method WriteElementString(String, String) Writes an XML element with a specified value in its body.
Protected method WriteElementString(String, String, String) Writes an XML element with a specified value in its body.
Protected method WriteElementString(String, String, XmlQualifiedName) Writes an XML element with a specified value in its body.
Protected method WriteElementString(String, String, String, XmlQualifiedName) Writes an XML element with a specified value in its body.
Protected method WriteElementStringRaw(String, array<Byte[]) Writes an XML element with a specified value in its body.
Protected method WriteElementStringRaw(String, String) Writes an XML element with a specified value in its body.
Protected method WriteElementStringRaw(String, array<Byte[], XmlQualifiedName) Writes an XML element with a specified value in its body.
Protected method WriteElementStringRaw(String, String, array<Byte[]) Writes an XML element with a specified value in its body.
Protected method WriteElementStringRaw(String, String, String) Writes an XML element with a specified value in its body.
Protected method WriteElementStringRaw(String, String, XmlQualifiedName) Writes an XML element with a specified value in its body.
Protected method WriteElementStringRaw(String, String, array<Byte[], XmlQualifiedName) Writes an XML element with a specified value in its body.
Protected method WriteElementStringRaw(String, String, String, XmlQualifiedName) Writes an XML element with a specified value in its body.
Protected method WriteEmptyTag(String) Writes an XML element whose body is empty.
Protected method WriteEmptyTag(String, String) Writes an XML element whose body is empty.
Protected method WriteEndElement() Writes a <closing> element tag.
Protected method WriteEndElement(Object) Writes a <closing> element tag.
Protected method WriteNamespaceDeclarations Infrastructure. Writes namespace declaration attributes.
Protected method WriteNullableQualifiedNameEncoded Writes an XML element whose body contains a valid XML qualified name. XmlWriter inserts an xsi:nil='true' attribute if the string's value is nulla null reference (Nothing in Visual Basic).
Protected method WriteNullableQualifiedNameLiteral Writes an XML element whose body contains a valid XML qualified name. XmlWriter inserts an xsi:nil='true' attribute if the string's value is nulla null reference (Nothing in Visual Basic).
Protected method WriteNullableStringEncoded Writes an XML element that contains a string as the body. XmlWriter inserts an xsi:nil='true' attribute if the string's value is nulla null reference (Nothing in Visual Basic).
Protected method WriteNullableStringEncodedRaw(String, String, array<Byte[], XmlQualifiedName) Writes a byte array as the body of an XML element. XmlWriter inserts an xsi:nil='true' attribute if the string's value is nulla null reference (Nothing in Visual Basic).
Protected method WriteNullableStringEncodedRaw(String, String, String, XmlQualifiedName) Writes an XML element that contains a string as the body. XmlWriter inserts an xsi:nil='true' attribute if the string's value is nulla null reference (Nothing in Visual Basic).
Protected method WriteNullableStringLiteral Writes an XML element that contains a string as the body. XmlWriter inserts an xsi:nil='true' attribute if the string's value is nulla null reference (Nothing in Visual Basic).
Protected method WriteNullableStringLiteralRaw(String, String, array<Byte[]) Writes a byte array as the body of an XML element. XmlWriter inserts an xsi:nil='true' attribute if the string's value is nulla null reference (Nothing in Visual Basic).
Protected method WriteNullableStringLiteralRaw(String, String, String) Writes an XML element that contains a string as the body. XmlWriter inserts a xsi:nil='true' attribute if the string's value is nulla null reference (Nothing in Visual Basic).
Protected method WriteNullTagEncoded(String) Writes an XML element with an xsi:nil='true' attribute.
Protected method WriteNullTagEncoded(String, String) Writes an XML element with an xsi:nil='true' attribute.
Protected method WriteNullTagLiteral(String) Writes an XML element with an xsi:nil='true' attribute.
Protected method WriteNullTagLiteral(String, String) Writes an XML element with an xsi:nil='true' attribute.
Protected method WriteSerializable(IXmlSerializable, String, String, Boolean) Writes an object that uses custom XML formatting as an XML element.
Protected method WriteSerializable(IXmlSerializable, String, String, Boolean, Boolean) Instructs XmlNode to write an object that uses custom XML formatting as an XML element.
Protected method WriteStartDocument Writes the XML declaration if the writer is positioned at the start of an XML document.
Protected method WriteStartElement(String) Writes an opening element tag, including any attributes.
Protected method WriteStartElement(String, String) Writes an opening element tag, including any attributes.
Protected method WriteStartElement(String, String, Boolean) Writes an opening element tag, including any attributes.
Protected method WriteStartElement(String, String, Object) Writes an opening element tag, including any attributes.
Protected method WriteStartElement(String, String, Object, Boolean) Writes an opening element tag, including any attributes.
Protected method WriteStartElement(String, String, Object, Boolean, XmlSerializerNamespaces) Writes an opening element tag, including any attributes.
Protected method WriteTypedPrimitive Writes an XML element whose text body is a value of a simple XML Schema data type.
Protected method WriteValue(array<Byte[]) Writes a base-64 byte array.
Protected method WriteValue(String) Writes a specified string.
Protected method WriteXsiType Writes an xsi:type attribute for an XML element that is being serialized into a document.

Top

Remarks

During initialization, the .NET Framework XML serialization infrastructure dynamically generates and compiles a temporary class for serialization that is derived from the abstract XmlSerializationWriter class. XmlSerializationWriter is also implemented within the .NET Framework for serialization of DiscoveryDocument and ServiceDescription objects into XML documents.

You should not derive classes from XmlSerializationWriter. Instead, call the Serialize method.

Version Information

Silverlight

Supported in: 5, 4, 3

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.