xsd에서 클래스를 생성했으며 DateTime
을 직렬화하려고합니다. 내 클래스는C#에서 GMT없이 Datetime을 serialize
private System.DateTime timeGMT;
[System.Xml.Serialization.XmlElementAttribute(DataType="time")]
public System.DateTime TimeGMT {
get {
return this.timeGMT;
}
set {
this.timeGMT= value;
}
}
처럼 보인다하지만 어떤 DateTime
객체를 할당 할 때 그것은
<TimeGMT>12:00:00.0000000-04:00</TimeGMT>
같은 형식으로 직렬화하지만 내가보고했다
<TimeGMT>12:00:00</TimeGMT>
로는 직렬화 할 이 질문에 :
Serializing DateTime to time without milliseconds and gmt
내 경우와 유사합니다. 하지만 내 문제는 또한 xsd에 대해 생성 된 XML의 유효성을 검사하기를 원합니다. 그래서 문자열로 반환 형식을 변환 할 수 없습니다.
다른 방법이 거기 밖으로 (내가 반환 형식으로 문자열을 사용하는 경우
time is an invalid value for XMLElementAttribute.DataType property.The property may be specified for only primitive types.
으로 XML을 생성하는 동안 다음 예외가)? 미리 감사드립니다.