I created a C # class file using an XSD file as input. One of my properties looks like this:
private System.DateTime timeField; [System.Xml.Serialization.XmlElementAttribute(DataType="time")] public System.DateTime Time { get { return this.timeField; } set { this.timeField = value; } }
When serialized, the contents of the file now look like this:
<Time>14:04:02.1661975+02:00</Time>
Is it possible, with the XmlAttributes in a property, to render it without milliseconds and GMT values like this?
<Time>14:04:02</Time>
Is this possible, or do I need to hack some kind of xsl / xpath-replace-magic after the class has been serialized?
This is not a solution for changing an object to String, because it is used as a DateTime in the rest of the application and allows us to create an xml view from an object using the XmlSerializer.Serialize () method.
The reason I need to remove additional information from the field is because the receiving system does not meet the w3c standards for the time data type.
Espo Sep 19 '08 at 12:44 2008-09-19 12:44
source share