Class XmiSerializer
- Namespace
- NMF.Serialization.Xmi
- Assembly
- NMF.Serialization.dll
Denotes a serializer implementation that serializes objects to XMI
public class XmiSerializer : XmlSerializer
- Inheritance
-
XmiSerializer
- Derived
- Inherited Members
Constructors
XmiSerializer()
Creates a new XmiSerializer with default settings and no preloaded types
public XmiSerializer()
XmiSerializer(XmlSerializationSettings)
Creates a new XmiSerializer with the specified settings
public XmiSerializer(XmlSerializationSettings settings)
Parameters
settingsXmlSerializationSettingsSerializer-settings for the serializer. Can be null or Nothing in Visual Basic. In this case, the default settings will be used.
XmiSerializer(XmlSerializationSettings, IEnumerable<Type>)
Creates a new XmiSerializer with the specified settings and the given preloaded types
public XmiSerializer(XmlSerializationSettings settings, IEnumerable<Type> additionalTypes)
Parameters
settingsXmlSerializationSettingsThe settings to use for the serializer
additionalTypesIEnumerable<Type>Set of types to load into the serializer
Remarks
The types will be loaded with the specified settings
XmiSerializer(XmlSerializer)
Creates a new XmlSerializer and copies settings and known types from the given serializer
public XmiSerializer(XmlSerializer parent)
Parameters
parentXmlSerializerAn XML serializer to copy settings and known type information from
XmiSerializer(XmlSerializer, XmlSerializationSettings)
Creates a new XmlSerializer and copies settings and known types from the given serializer
public XmiSerializer(XmlSerializer parent, XmlSerializationSettings settings)
Parameters
parentXmlSerializerAn XML serializer to copy settings and known type information from
settingsXmlSerializationSettingsNew settings
XmiSerializer(IEnumerable<Type>)
Creates a new XmiSerializer with default settings
public XmiSerializer(IEnumerable<Type> additionalTypes)
Parameters
additionalTypesIEnumerable<Type>Set of types to preload into the serializer
Remarks
Types will be loaded with default settings
Fields
XMINamespace
Denotes the XMI namespace
public static readonly string XMINamespace
Field Value
XMIPrefix
Denotes the standard prefix for the XMI namespace
public static readonly string XMIPrefix
Field Value
XMLSchemaInstanceNamespace
Denotes the namespace for XML schema instance
public static readonly string XMLSchemaInstanceNamespace
Field Value
XMLSchemaInstancePrefix
Denotes the standard prefix to use for the XML schema instance namespace
public static readonly string XMLSchemaInstancePrefix
Field Value
Properties
IdAttribute
Gets the attribute used for identifiers
protected virtual IPropertySerializationInfo IdAttribute { get; }
Property Value
RootPrefix
Gets or sets the root prefix
public string RootPrefix { get; set; }
Property Value
Methods
CreateSerializationContext(object)
Creates a serialization context for the given root element
protected override XmlSerializationContext CreateSerializationContext(object root)
Parameters
rootobjectThe root element of the serialization
Returns
- XmlSerializationContext
A serialization context
GetElementTypeInfo(XmlReader, IPropertySerializationInfo)
Gets the type information for the current property
protected override ITypeSerializationInfo GetElementTypeInfo(XmlReader reader, IPropertySerializationInfo property)
Parameters
readerXmlReaderThe xml reader
propertyIPropertySerializationInfoThe current property
Returns
- ITypeSerializationInfo
The type serialization info that should be used in the remainder
GoToPropertyContent(XmlReader)
Moves the reader to the content of the property
protected override bool GoToPropertyContent(XmlReader reader)
Parameters
readerXmlReaderthe Xml reader
Returns
- bool
true, if the reader could be moved sucessfully, otherwise false
HandleUnknownAttribute(XmlReader, object, ITypeSerializationInfo, XmlSerializationContext)
Handles an attribute that was not known to the serializer
protected override void HandleUnknownAttribute(XmlReader reader, object obj, ITypeSerializationInfo info, XmlSerializationContext context)
Parameters
readerXmlReaderThe current reader position
objobjectThe object that is currently deserialized
infoITypeSerializationInfoThe type serialization information of the object
contextXmlSerializationContextThe serialization context
InitializeElementProperties(XmlReader, ref object, ITypeSerializationInfo, XmlSerializationContext)
Initializes the element properties from the xml reader position
protected override void InitializeElementProperties(XmlReader reader, ref object obj, ITypeSerializationInfo info, XmlSerializationContext context)
Parameters
readerXmlReaderthe xml reader
objobjectthe element
infoITypeSerializationInfothe type serialization information
contextXmlSerializationContextthe serialization context
InitializeTypeSerializationInfo(Type, ITypeSerializationInfo)
Initializes the given type serialization information for the given type
protected override void InitializeTypeSerializationInfo(Type type, ITypeSerializationInfo serializationInfo)
Parameters
typeTypethe system type
serializationInfoITypeSerializationInfothe serialization information object
OverrideIdentifiedObject(object, XmlReader, XmlSerializationContext)
Determines whether the already identified element should be overridden
protected override bool OverrideIdentifiedObject(object obj, XmlReader reader, XmlSerializationContext context)
Parameters
objobjectThe object that would be overridden
readerXmlReaderThe current reader position
contextXmlSerializationContextThe serialization context
Returns
- bool
true, if the element shall be overridden, otherwise false
WriteBeginElement(XmlWriter, object, ITypeSerializationInfo)
Writes the beginning of an element
protected override void WriteBeginElement(XmlWriter writer, object obj, ITypeSerializationInfo info)
Parameters
writerXmlWriterThe xml writer to write to
objobjectThe element
infoITypeSerializationInfoThe serialization information of the objects type
WriteBeginRootElement(XmlWriter, object, ITypeSerializationInfo)
Writes the root element to the given writer
protected override void WriteBeginRootElement(XmlWriter writer, object root, ITypeSerializationInfo info)
Parameters
writerXmlWriterThe xml writer to write to
rootobjectThe root element
infoITypeSerializationInfoThe serialization information of the objects type
WriteElementProperties(XmlWriter, object, ITypeSerializationInfo, XmlSerializationContext)
Writes the element properties of the given object to the provided writer
protected override void WriteElementProperties(XmlWriter writer, object obj, ITypeSerializationInfo info, XmlSerializationContext context)
Parameters
writerXmlWriterThe xml writer to write to
objobjectThe element
infoITypeSerializationInfoThe serialization information of the objects type
contextXmlSerializationContextThe serialization context
WriteEndElement(XmlWriter, object, ITypeSerializationInfo)
Completes the current element for the provided object
protected override void WriteEndElement(XmlWriter writer, object obj, ITypeSerializationInfo info)
Parameters
writerXmlWriterThe xml writer to write to
objobjectThe element
infoITypeSerializationInfoThe serialization information of the objects type
WriteEndRootElement(XmlWriter, object, ITypeSerializationInfo)
Completes the root element
protected override void WriteEndRootElement(XmlWriter writer, object root, ITypeSerializationInfo info)
Parameters
writerXmlWriterThe xml writer to write to
rootobjectThe element
infoITypeSerializationInfoThe serialization information of the objects type
WriteIdentifiedObject(XmlWriter, object, XmlIdentificationMode, ITypeSerializationInfo, XmlSerializationContext)
Writes the provided identified object
protected override bool WriteIdentifiedObject(XmlWriter writer, object obj, XmlIdentificationMode identificationMode, ITypeSerializationInfo info, XmlSerializationContext context)
Parameters
writerXmlWriterThe xml writer to write to
objobjectThe element
identificationModeXmlIdentificationModeThe identification mode for the current object
infoITypeSerializationInfoThe serialization information of the objects type
contextXmlSerializationContextThe serialization context
Returns
- bool
true, if the object could be written as identified object, otherwise false