The existing code had a special code path for handling nullables that
ignored the DataType component.
This patch splits the nullable test away, allows the specified XmlDataType
to be probed and then performs the standard type lookup mechanism.
This allows this:
[XmlElement ("MyNullableTime", DataType="time", IsNullable=true)]
DateTime? myTime;
To be serialized as a "time" instead of a "datetime".
Fixes bug #329
* XmlConvert.cs : in 2.0, use F instead of f in dateTime formatting.
* XmlCustomFormatter.cs :
in 2.0, use F instead of f for dateTime formatting.
* XmlSerializationWriterTests.cs, XmlSerializerTests.cs :
fixed wrong dateTime formatting tests.
svn path=/trunk/mcs/; revision=76268
* XmlSerializationWriter.cs : WriteTypedPrimitive() does not support
XmlNode arrays.
* XmlSerializationWriterInterpreter.cs,
SerializationCodeGenerator.cs : so they have to be handled here.
* XmlSerializerTests.cs : added some XmlNode array/list tests.
* XmlSerializationWriterTests.cs : removed more NotWorking. Added
WriteTypedPrimitive() error test for XmlNode.
svn path=/trunk/mcs/; revision=72448
* XmlSerializationWriter.cs : WriteTypedPrimitive() infers the type
when the name is null (almost no need to do this, but it is easier
to remove NotWorking from extraneous tests and let them hush than
removing them).
* XmlSerializationWriterTests.cs : removed some NotWorking.
svn path=/trunk/mcs/; revision=72436
Assertion class. Added tests for FromEnum, WriteXsiType,
WriteTypedPrimitive and WritePotentiallyReferencingElement. Changed
accessibility of Reset and Content on XmlSerializationWriterTester
and added public Execute methods for WritePotentiallyReferencingElement
and WriteTypedPrimitive, to allow this class to be useful for tests
that have effect on the prefix for other tests.
* XmlSerializationReaderTests.cs: Added tests for ToEnum.
* System.Xml_test.dll.Sources: Added XmlSerializationReaderTests.cs.
* XmlSerializationWriter.cs: Implemented 2.0 version of FromEnum, and
CreateInvalidEnumValueException. Set eol-style to native.
* XmlCustomerFormatter.cs: Added FromEnum overload that takes name of
enum for which string value must be created. Set eol-style to native.
Modified FromEnum to behave more like MSFT's implementation:
- treat value as bit field.
- no longer return empty string if the value matches an id for which there's
no corresponding name.
- if one of the ids has value 0 and there's a match for the enum value
(with a zero length XML name) or the enum value is 0, then return the
corresponding XML for the id with value 0.
- in 2.0 profile, throw InvalidOperationException if no match is found
for (part of) the enum value.
Modifies ToEnum to match the MSFT implementation (as described in
.NET 2.0 SDK):
- Expect hashtable containing enum names as key, and corresponding
integral numbers as value.
- Do not report exception for whitespace-only value.
- Support space (MS docs are not clear about this) delimited list
of names.
- typeName is only used to construct exception message.
svn path=/trunk/mcs/; revision=56700