Public Class ApplicationJMO Public Property Name() As String Private privateHost As String Public Property Host() As String Get If String.IsNullOrWhiteSpace(privateHost) Then 'si mon host est vide, je retourne celui de mon parent Return Parent.Host End If Return privateHost End Get Set(ByVal value As String) privateHost = value End Set End Property Public Property Parent() As EnvironnementJMO Public Property Jobs() As List(Of Job) Public Property Ressources() As List(Of RessourceApp) Public ReadOnly Property LesRessources As String Get Return String.Join(", ", Ressources) End Get End Property End Class
Public Class RessourceApp Public Property Name() As String Public Property Type() As String Public Property Valeur() As String Public Overrides Function ToString() As String Return String.Format("{0} [{1}] {2}", Name, Type,Valeur) 'concaténation d'une ressource dans le ToString de substitution End Function End Class
Dim maListe As List(Of EnvironnementJMO) = ( From e In xDoc.Descendants("Environment") Select New EnvironnementJMO With {.Name = e.Attribute("name").Value, .Host = e.Attribute("host").Value, .Applications = ( From a In e.Descendants("Application") Select New ApplicationJMO With { .Name = a.Attribute("name").Value, .Host = If(a.Attributes("host").Count() > 0, a.Attribute("host").Value, Nothing), .Ressources = (From r In a.Descendants("ExpectedResource") Select New RessourceApp With { .Name = r.Attribute("resource").Value, .Type = r.Attribute("operator").Value, .Valeur = r.Element("Value").Value }).ToList(), .Jobs = ( From j In a.Descendants("Job") Select New Job With {.Name = j.Attribute("name").Value, .Host = If(j.Attributes("host").Count() > 0, j.Attribute("host").Value, Nothing)}).ToList()}).ToList()}).ToList()
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionPublic ReadOnly Property RessourceApp() As StringLe résultat est presque OK !!!
Get
Return parent.LesRessources
End Get
End Property
RessourceAppJ'ai un doute sur "[14]" de "<Value><![CDATA[14]]></Value>" qui me semble être un index.
PRES_0056 [OK] , PRES_0056_TOPFIL [P]
PRES_0046_FIC01 [OK] , PRES_0046_FIC02 [OK]
QRES_PRE-BI_M3 [!] 14, QRES_FIN_SAUVE [=] TRUE ' ici l'exemple <Application name="A-Q0086H01">
QRES_PRE-BI_M3 [!] 10, QRES_FIN_SAUVE [=] TRUE