Bonjour,
Je cherche a deserialiser une date dans une class.
Pas de probleme quand c'est un integer ou string mais avec une date, j'obtiens ce message:
"The string '#2015-10-16 00:00:00#' is not a valid AllXsd value."
Peut etre ce n'est pas possible. quelqu'un peut il m'eclairer.
Merci.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53 Public Class Form1 Public List_Scan As New List(Of Class_ID_Conf_Scan) 'Collection de Livre Public XML_Class_File As String = "ID_Conf_Scan_File.xml" Public Sub Scan_Xml_Load(ByRef list_Rwy As Collections.Generic.List(Of Class_ID_Conf_Scan)) Dim streamIO As StreamReader = Nothing Dim serialXML As Xml.Serialization.XmlSerializer = Nothing serialXML = New Xml.Serialization.XmlSerializer(GetType(Collections.Generic.List(Of Class_ID_Conf_Scan))) ' Ouverture d'un flux en lecture sur le fichier XML des contacts streamIO = New StreamReader(XML_Class_File) ' Désérialisation de la liste des contacts list_Rwy = CType(serialXML.Deserialize(streamIO), Collections.Generic.List(Of Class_ID_Conf_Scan)) end sub End class Public Class Class_ID_Conf_Scan Private XML_Date_Start As Date Private XML_Date_Stop As String Private XML_Conf_Id As Integer Public Property Date_Start_C() As Date Get Return XML_Date_Start End Get Set(ByVal value As Date) XML_Date_Start = value End Set End Property Public Property Date_Stop_C() As String Get Return XML_Date_Stop End Get Set(ByVal value As String) XML_Date_Stop = value End Set End Property Public Property Conf_Id_C() As Integer Get Return XML_Conf_Id End Get Set(ByVal value As Integer) XML_Conf_Id = value End Set End Property end Class <ArrayOfClass_ID_Conf_Scan xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <Class_ID_Conf_Scan> <Date_Start_C>#2015-10-16 00:00:00#</Date_Start_C> <Date_Stop_C>2016-02-17 23:59:59</Date_Stop_C> <Conf_Id_C>00</Conf_Id_C> </Class_ID_Conf_Scan> </ArrayOfClass_ID_Conf_Scan>
Partager