Author: kostat Date: 2007-05-07 04:49:24 -0400 (Mon, 07 May 2007) New Revision: 76810
Modified: branches/mainsoft/gh20/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationWriter.cs branches/mainsoft/gh20/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationWriterInterpreter.cs branches/mainsoft/gh20/mcs/class/System.XML/Test/System.Xml.Serialization/XmlSerializationWriterTests.cs Log: reverted r72448; see http://bugzilla.ximian.com/show_bug.cgi?id=81539 Modified: branches/mainsoft/gh20/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationWriter.cs =================================================================== --- branches/mainsoft/gh20/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationWriter.cs 2007-05-07 08:49:07 UTC (rev 76809) +++ branches/mainsoft/gh20/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationWriter.cs 2007-05-07 08:49:24 UTC (rev 76810) @@ -840,8 +840,6 @@ { string value; TypeData td = TypeTranslator.GetTypeData (o.GetType ()); - if (td.SchemaType != SchemaTypes.Primitive) - throw new InvalidOperationException ("The type of the argument object is not primitive."); if (name == null) { ns = td.IsXsdType ? XmlSchema.Namespace : XmlSerializer.WsdlTypesNamespace; @@ -851,20 +849,25 @@ name = XmlCustomFormatter.FromXmlName (name); Writer.WriteStartElement (name, ns); - if (o is XmlQualifiedName) - value = FromXmlQualifiedName ((XmlQualifiedName) o); - else - value = XmlCustomFormatter.ToXmlString (td, o); - - if (xsiType) - { - if (td.SchemaType != SchemaTypes.Primitive) - throw new InvalidOperationException (string.Format (unexpectedTypeError, o.GetType().FullName)); - WriteXsiType (td.XmlType, td.IsXsdType ? XmlSchema.Namespace : XmlSerializer.WsdlTypesNamespace); + if (o is XmlNode[]) { + foreach (XmlNode node in (XmlNode[])o) + node.WriteTo (Writer); } + else { + if (o is XmlQualifiedName) + value = FromXmlQualifiedName ((XmlQualifiedName) o); + else + value = XmlCustomFormatter.ToXmlString (td, o); - WriteValue (value); + if (xsiType) + { + if (td.SchemaType != SchemaTypes.Primitive) + throw new InvalidOperationException (string.Format (unexpectedTypeError, o.GetType().FullName)); + WriteXsiType (td.XmlType, td.IsXsdType ? XmlSchema.Namespace : XmlSerializer.WsdlTypesNamespace); + } + WriteValue (value); + } Writer.WriteEndElement (); } Modified: branches/mainsoft/gh20/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationWriterInterpreter.cs =================================================================== --- branches/mainsoft/gh20/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationWriterInterpreter.cs 2007-05-07 08:49:07 UTC (rev 76809) +++ branches/mainsoft/gh20/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationWriterInterpreter.cs 2007-05-07 08:49:24 UTC (rev 76810) @@ -114,14 +114,6 @@ return; } - if (ob.GetType ().IsArray && typeof (XmlNode).IsAssignableFrom (ob.GetType ().GetElementType ())) { - Writer.WriteStartElement (element, namesp); - foreach (XmlNode node in (IEnumerable) ob) - node.WriteTo (Writer); - Writer.WriteEndElement (); - return; - } - if (typeMap.TypeData.SchemaType == SchemaTypes.XmlSerializable) { WriteSerializable ((IXmlSerializable)ob, element, namesp, isNullable); Modified: branches/mainsoft/gh20/mcs/class/System.XML/Test/System.Xml.Serialization/XmlSerializationWriterTests.cs =================================================================== --- branches/mainsoft/gh20/mcs/class/System.XML/Test/System.Xml.Serialization/XmlSerializationWriterTests.cs 2007-05-07 08:49:07 UTC (rev 76809) +++ branches/mainsoft/gh20/mcs/class/System.XML/Test/System.Xml.Serialization/XmlSerializationWriterTests.cs 2007-05-07 08:49:24 UTC (rev 76810) @@ -1358,6 +1358,9 @@ [Test] [ExpectedException (typeof (InvalidOperationException))] +#if TARGET_JVM + [Ignore ("reverted r72448")] +#endif public void TestWriteTypedPrimitive_NonPrimitive () { // The type System.Version was not expected. Use the XmlInclude @@ -1368,6 +1371,9 @@ [Test] [ExpectedException (typeof (InvalidOperationException))] +#if TARGET_JVM + [Ignore ("reverted r72448")] +#endif public void TestWriteTypedPrimitive_XmlNode () { WriteTypedPrimitive ("x", ANamespace, new XmlDocument ().CreateElement ("foo"), false); _______________________________________________ Mono-patches maillist - [email protected] http://lists.ximian.com/mailman/listinfo/mono-patches
