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
settings
XmlSerializationSettingsSerializer-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
settings
XmlSerializationSettingsThe settings to use for the serializer
additionalTypes
IEnumerable<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
parent
XmlSerializerAn 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
parent
XmlSerializerAn XML serializer to copy settings and known type information from
settings
XmlSerializationSettingsNew settings
XmiSerializer(IEnumerable<Type>)
Creates a new XmiSerializer with default settings
public XmiSerializer(IEnumerable<Type> additionalTypes)
Parameters
additionalTypes
IEnumerable<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
root
objectThe 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
reader
XmlReaderThe xml reader
property
IPropertySerializationInfoThe 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
reader
XmlReaderthe 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
reader
XmlReaderThe current reader position
obj
objectThe object that is currently deserialized
info
ITypeSerializationInfoThe type serialization information of the object
context
XmlSerializationContextThe 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
reader
XmlReaderthe xml reader
obj
objectthe element
info
ITypeSerializationInfothe type serialization information
context
XmlSerializationContextthe serialization context
InitializeTypeSerializationInfo(Type, ITypeSerializationInfo)
Initializes the given type serialization information for the given type
protected override void InitializeTypeSerializationInfo(Type type, ITypeSerializationInfo serializationInfo)
Parameters
type
Typethe system type
serializationInfo
ITypeSerializationInfothe 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
obj
objectThe object that would be overridden
reader
XmlReaderThe current reader position
context
XmlSerializationContextThe 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
writer
XmlWriterThe xml writer to write to
obj
objectThe element
info
ITypeSerializationInfoThe 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
writer
XmlWriterThe xml writer to write to
root
objectThe root element
info
ITypeSerializationInfoThe 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
writer
XmlWriterThe xml writer to write to
obj
objectThe element
info
ITypeSerializationInfoThe serialization information of the objects type
context
XmlSerializationContextThe 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
writer
XmlWriterThe xml writer to write to
obj
objectThe element
info
ITypeSerializationInfoThe 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
writer
XmlWriterThe xml writer to write to
root
objectThe element
info
ITypeSerializationInfoThe 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
writer
XmlWriterThe xml writer to write to
obj
objectThe element
identificationMode
XmlIdentificationModeThe identification mode for the current object
info
ITypeSerializationInfoThe serialization information of the objects type
context
XmlSerializationContextThe serialization context
Returns
- bool
true, if the object could be written as identified object, otherwise false