c# - How can I display IEnumarable<XElement> type in GridView? -
i need retrieve data xml
file display result set in gridview
using linq
.
i have read xml
file disk , fetched elements want, need display these results in table. should do?
c# code :
protected void page_load(object sender, eventargs e) { xelement xml = xelement.load(@"c:\veri.xml"); ienumerable<xelement> urunler = xml.elements("urun"); }
my xml schema :
<?xml version="1.0" encoding="utf-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/xmlschema" elementformdefault="qualified"> <xs:element name="root"> <xs:complextype> <xs:sequence> <xs:element maxoccurs="unbounded" ref="urun"/> </xs:sequence> </xs:complextype> </xs:element> <xs:element name="urun"> <xs:complextype> <xs:sequence> <xs:element ref="urunid"/> <xs:element ref="urunkodu"/> <xs:element ref="urunadi"/> <xs:element ref="urunlink"/> <xs:element ref="urundetay"/> <xs:element ref="marka"/> <xs:element ref="urunkategori"/> <xs:element ref="kategorinav"/> <xs:element ref="resimler"/> <xs:element ref="fiyat"/> <xs:element ref="toplamstok"/> <xs:element ref="stokbilgileri"/> <xs:element ref="ozellikler"/> </xs:sequence> </xs:complextype> </xs:element> <xs:element name="urunid" type="xs:integer"/> <xs:element name="urunkodu" type="xs:string"/> <xs:element name="urunadi" type="xs:string"/> <xs:element name="urunlink" type="xs:anyuri"/> <xs:element name="urundetay" type="xs:string"/> <xs:element name="marka"> <xs:complextype> <xs:sequence> <xs:element ref="markaadi"/> <xs:element ref="markaid"/> </xs:sequence> </xs:complextype> </xs:element> <xs:element name="markaadi" type="xs:string"/> <xs:element name="markaid" type="xs:integer"/> <xs:element name="urunkategori"> <xs:complextype> <xs:sequence> <xs:element ref="kategoriadi"/> <xs:element ref="kategoriid"/> </xs:sequence> </xs:complextype> </xs:element> <xs:element name="kategoriadi" type="xs:string"/> <xs:element name="kategoriid" type="xs:integer"/> <xs:element name="kategorinav"> <xs:complextype> <xs:sequence> <xs:element maxoccurs="unbounded" ref="kategori"/> </xs:sequence> </xs:complextype> </xs:element> <xs:element name="kategori" type="xs:string"/> <xs:element name="resimler"> <xs:complextype> <xs:sequence> <xs:element maxoccurs="unbounded" ref="resim"/> </xs:sequence> </xs:complextype> </xs:element> <xs:element name="resim" type="xs:anyuri"/> <xs:element name="fiyat"> <xs:complextype> <xs:sequence> <xs:element ref="kdvoran"/> <xs:element ref="bayifiyat"/> <xs:element ref="bayifiyatkdvli"/> <xs:element ref="perakendefiyat"/> </xs:sequence> </xs:complextype> </xs:element> <xs:element name="kdvoran" type="xs:integer"/> <xs:element name="bayifiyat" type="xs:string"/> <xs:element name="bayifiyatkdvli" type="xs:string"/> <xs:element name="perakendefiyat" type="xs:string"/> <xs:element name="toplamstok" type="xs:integer"/> <xs:element name="stokbilgileri"> <xs:complextype> <xs:sequence> <xs:element maxoccurs="unbounded" ref="stokkayit"/> </xs:sequence> </xs:complextype> </xs:element> <xs:element name="stokkayit"> <xs:complextype> <xs:sequence> <xs:element ref="renk"/> <xs:element ref="beden"/> <xs:element ref="stokadet"/> </xs:sequence> </xs:complextype> </xs:element> <xs:element name="renk" type="xs:string"/> <xs:element name="beden" type="xs:nmtoken"/> <xs:element name="stokadet" type="xs:integer"/> <xs:element name="ozellikler"> <xs:complextype> <xs:sequence> <xs:element ref="aynigunkargo"/> <xs:element ref="hizligonderi"/> <xs:element ref="onsiparisliurun"/> <xs:element ref="sinirlistok"/> <xs:element ref="ucretsizkargo"/> <xs:element ref="stoksorunuz"/> <xs:element ref="desi"/> </xs:sequence> </xs:complextype> </xs:element> <xs:element name="aynigunkargo" type="xs:ncname"/> <xs:element name="hizligonderi" type="xs:ncname"/> <xs:element name="onsiparisliurun" type="xs:ncname"/> <xs:element name="sinirlistok" type="xs:ncname"/> <xs:element name="ucretsizkargo" type="xs:ncname"/> <xs:element name="stoksorunuz" type="xs:ncname"/> <xs:element name="desi" type="xs:integer"/> </xs:schema>
Comments
Post a Comment