Bonjour ,

j'ai un parsing d'un xml comme ceci :

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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
 
byteArray = Encoding.UTF8.GetBytes(drBio.GetString(drBio.GetOrdinal("compterendu")));
System.IO.MemoryStream stream = new System.IO.MemoryStream(byteArray);
 
XPathDocument doc = new XPathDocument(stream);
XPathNavigator nav = doc.CreateNavigator();
 
XPathExpression expr;
expr = nav.Compile("/kmehrmessage/folder/transaction/heading/item");
XPathNodeIterator iterator = nav.Select(expr);
 
XPathNavigator Node;
 
//Si c'est la première BIO avant la séance on récupère les valeurs
if (drBio.GetDateTime(drBio.GetOrdinal("dtebio")).Date <= FirstSeance.Value)
{
	while (iterator.MoveNext())
	{
		if (iterator.Current.SelectSingleNode("cd[@S='LOCAL']").Value.ToUpper() == "CR_IND"
		|| iterator.Current.SelectSingleNode("cd[@S='LOCAL']").Value.ToUpper() == "CRX"
		|| iterator.Current.SelectSingleNode("cd[@S='LOCAL']").Value.ToUpper() == "CRU")
		{
			Node = null;
 
			if (iterator.Current.SelectSingleNode("content/decimal") != null)
				Node = iterator.Current.SelectSingleNode("content/decimal");
			else if (iterator.Current.SelectSingleNode("content/text") != null)
				Node = iterator.Current.SelectSingleNode("content/text");
 
			if (Node != null)
			{
				if (drBio.GetDateTime(drBio.GetOrdinal("dtebio")).Date == FirstSeance.Value)
				{
					if (CreatAvtEER.Length == 0)
						CreatAvtEER = Node.Value;
				}
				else
					CreatAvtEER = Node.Value;
			}
		}
 
		if (iterator.Current.SelectSingleNode("cd[@S='LOCAL']").Value.ToUpper() == "CLCR_C")
		{
			if (iterator.Current.SelectSingleNode("content/decimal") != null)
			{
				if (drBio.GetDateTime(drBio.GetOrdinal("dtebio")).Date == FirstSeance.Value)
				{
					if (ClCreatAvtEER.Length == 0)
						ClCreatAvtEER = iterator.Current.SelectSingleNode("content/decimal").Value;
				}
				else
					ClCreatAvtEER = iterator.Current.SelectSingleNode("content/decimal").Value;
			}
		}
 
		if (iterator.Current.SelectSingleNode("cd[@S='LOCAL']").Value.ToUpper() == "CLUREE_C")
		{
			if (iterator.Current.SelectSingleNode("content/decimal") != null)
			{
				if (drBio.GetDateTime(drBio.GetOrdinal("dtebio")).Date == FirstSeance.Value)
				{
					if (ClUreeAvtEER.Length == 0)
					{
						ClUreeAvtEER = iterator.Current.SelectSingleNode("content/decimal").Value;
					}
				}
				else
					ClUreeAvtEER = iterator.Current.SelectSingleNode("content/decimal").Value;
			}
		}
	}
}
else
{
	TimeSpan Ts;
	if (FirstSeance.Value > drBio.GetDateTime(drBio.GetOrdinal("dtebio")).Date)
		Ts = FirstSeance.Value - drBio.GetDateTime(drBio.GetOrdinal("dtebio")).Date;
	else
		Ts = drBio.GetDateTime(drBio.GetOrdinal("dtebio")).Date - FirstSeance.Value;
 
	// Si c'est la première Bio 1 mois après la première séance
	if (Ts.TotalDays > 30)
	{
		while (iterator.MoveNext())
		{
			if (iterator.Current.SelectSingleNode("cd[@S='LOCAL']").Value.ToUpper() == "CR_IND"
			|| iterator.Current.SelectSingleNode("cd[@S='LOCAL']").Value.ToUpper() == "CRX"
			|| iterator.Current.SelectSingleNode("cd[@S='LOCAL']").Value.ToUpper() == "CRU")
			{
				if (iterator.Current.SelectSingleNode("content/decimal") != null)
				{
					if (iterator.Current.SelectSingleNode("content/decimal").Value != "")
						CreatAfterOneMonth = iterator.Current.SelectSingleNode("content/decimal").Value;
					break;
				}
			}
		}
	}
 
	// Si nous n'avons pas encore trouvé la date du grand Bilan de cette année
	if (!DteGrdBilan.HasValue)
	{
		while (iterator.MoveNext())
		{
			if (iterator.Current.SelectSingleNode("cd[@S='LOCAL']").Value.ToUpper() == "PTH")
			{
				DteGrdBilan = drBio.GetDateTime(drBio.GetOrdinal("dtebio")).Date;
				break;
			}
		}
	}
}
Pensez-vous que je pourrais accélérer le processus en utilisant linq en sachant que ce code est exécuté environ 23000 fois pour une récupération de données ?