Je chargement d'un xml quelques informations sur les points de la ville d'intérêt, et ma structure xml ressemble à ceci:LINQ to XML requête
<InterestPoint>
<id>2</id>
<name>Residencia PAC</name>
<images>
<image>C:\Pictures\Alien Places in The World\20090625-alien11.jpg</image>
<image>C:\Alien Places in The World\20090625-alien13.jpg</image>
</images>
<desc>blah blah blah blah</desc>
<Latitude>40.286458</Latitude>
<Longitude>-7.511921</Longitude>
</InterestPoint>
Je vais avoir du mal à récupérer les informations d'images, je m seulement capable d'obtenir une image, mais dans cet exemple, il y en a deux. La requête Linq que j'utilise est:
CityPins = (from c in PointofInterest.Descendants("InterestPoint")
select new InterestPoint
{
// = c.Attribute("Latitude").Value,
//longitude = c.Attribute("Longitude").Value,
Name = c.Element("nome").Value,
LatLong = new VELatLong(double.Parse(c.Element("Latitude").Value), double.Parse(c.Element("Longitude").Value)),
Desc = c.Element("descricao").Value,
Images = (from img in c.Descendants("imagens")
select new POIimage
{
image = new Uri(img.Element("imagem").Value),
}).ToList<POIimage>(),
}).ToList<InterestPoint>();
Images est un List<POIimages>
où POIimage est une classe avec un champ Uri.
Quelqu'un pourrait-il m'aider à résoudre cette requête?
Peut-il y avoir plusieurs éléments ''? –
SLaks