Cerebrus

Drilling XML with LInQ

Jan 17th, 2010
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.13 KB | None | 0 0
  1. //Related to question at:
  2. //http://groups.google.com/group/dotnetdevelopment/browse_thread/thread/c3f616038c234c2e
  3.  
  4. var Q =
  5.   from sticker in docUrunler.Elements("sticker")
  6.   select new
  7.   {
  8.     id = sticker.Element("kategori").Attribute("id").Value,
  9.     urun =
  10.       from urun in sticker.Descendants("urun")
  11.       select new
  12.       {
  13.         xid = urun.Attribute("id").Value,
  14.         baslik = urun.Element("baslik").Value,
  15.         teslimSuresi = urun.Element("teslim_suresi").Value,
  16.         urunAciklamasi = urun.Element("urun_aciklamasi").Value,
  17.         firsatUrunu = urun.Element("firsat_urunu").Value,
  18.         ilkfoto = urun.Element("fotolar").Element("listeleme").Value,
  19.         ikincifoto = urun.Element("fotolar").Element("detay").Value,
  20.         ucuncufoto = urun.Element("fotolar").Element("desen").Value,
  21.         renklerr =
  22.           from renk in urun.Element("renkler").Elements("renk")
  23.           select renk.Value,
  24.         olculer =
  25.           from olcu in urun.Element("olculer").Elements("olcu")
  26.           select olcu.Value,
  27.         fiyat = urun.Element("olculer").Element("olcu").Attribute("fiyat").Value
  28.       }
  29.   };
Advertisement
Add Comment
Please, Sign In to add comment