+2009-05-25 Atsushi Enomoto <atsushi@ximian.com>
+
+ * SerializationMap.cs, XmlFormatterSerializer.cs :
+ collection types should not output xsi:type e.g. IList<T> should
+ not exposed xsi:type as xsi:type=List`1.
+
2009-05-18 Atsushi Enomoto <atsushi@ximian.com>
* SerializationMap.cs, XmlFormatterDeserializer.cs,
Members = new List<DataMemberInfo> ();
}
+ public virtual bool OutputXsiType {
+ get { return true; }
+ }
+
public QName XmlName { get; set; }
public CollectionDataContractAttribute GetCollectionDataContractAttribute (Type type)
}
}
+ public override bool OutputXsiType {
+ get { return false; }
+ }
+
internal virtual string CurrentNamespace {
get {
string ns = element_qname.Namespace;
writer.WriteAttributeString ("nil", XmlSchema.InstanceNamespace, "true");
else {
Type actualType = graph.GetType ();
- if (actualType != type) {
+
+ SerializationMap map = types.FindUserMap (actualType);
+ if (map == null) {
+ /* Unknown actual type */
+ types.Add (actualType);
+ map = types.FindUserMap (actualType);
+ }
+
+ if (actualType != type && (map == null || map.OutputXsiType)) {
QName qname = types.GetXmlName (actualType);
string name = qname.Name;
string ns = qname.Namespace;
if (predef != QName.Empty)
SerializePrimitive (type, graph, predef);
else
- SerializeNonPrimitive (type, graph);
+ map.Serialize (graph, this);
}
}
{
writer.WriteEndElement ();
}
-
- public void SerializeNonPrimitive (Type type, object graph)
- {
- Type actualType = graph.GetType ();
-
- SerializationMap map = types.FindUserMap (actualType);
- if (map == null) {
- /* Unknown actual type */
- types.Add (actualType);
- map = types.FindUserMap (actualType);
- }
-
- map.Serialize (graph, this);
- }
}
}
#endif