How to run foreach cycle for every ROW in my xml c# -
i use code every attribute
row
var dict = xdoc.xpathselectelement("//ns:rowdata/ns:row", mgr) .attributes() .todictionary(a => a.name, => a.value); string insertfields = "";
can tell me how make foreach cycle, cycle trought every row , fill dict code posted above.
the xml looks
<?xml version="1.0" encoding="windows-1251"?> <datapacket version="2.0" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns="http://www.seavus.com/aml/xml-schema/ctr_single.xsd"> <banka> <!-- banka children --> </banka> <metadata> <fields> <!-- fields --> </fields> <params lcid="0" /> </metadata> <rowdata> <row bank_id="370" aktivnost_se_vrsi_vo_19="Г" naziv_21="xxxxx" sediste_21="xx" danocen_broj_21="12333" broj_smetka_21="123333" banka_21="330" datum_22="03.01.2017" cas_22="13:30" vid_aktiv_23="xxx" iznos_24="12" valuta_24="807" datum_25="04.01.2017" vreme_25="12:55" sifra_26="800" opis_27="xxxxxxx" /> <row bank_id="370" aktivnost_se_vrsi_vo_19="Г" naziv_21="xxxxx" sediste_21="xx" danocen_broj_21="12333" broj_smetka_21="123333" banka_21="330" datum_22="03.01.2017" cas_22="13:30" vid_aktiv_23="xxx" iznos_24="12" valuta_24="807" datum_25="04.01.2017" vreme_25="12:55" sifra_26="800" opis_27="xxxxxxx" /> <row bank_id="370" aktivnost_se_vrsi_vo_19="Г" naziv_21="xxxxx" sediste_21="xx" danocen_broj_21="12333" broj_smetka_21="123333" banka_21="330" datum_22="03.01.2017" cas_22="13:30" vid_aktiv_23="xxx" iznos_24="12" valuta_24="807" datum_25="04.01.2017" vreme_25="12:55" sifra_26="800" opis_27="xxxxxxx" /> </rowdata> </datapacket>
somthing that?
var rows = xdoc.xpathselectelements("//ns:rowdata/ns:row", mgr) foreach(var row in rows) { var attributes = row.attributes(); // todo: code }
Comments
Post a Comment