Reading special field from variable XML File c# -



Reading special field from variable XML File c# -

i have got file called xmlfile.xml:

<personen> <person> <vorname>manfred</vorname> <telefon/> <zuname>fischer</zuname> <alter>45</alter> <adresse ort="bonn" strasse="neuestr.34"></adresse> </person> </personen>

there 2 problems. first of fields of '' variable. maybe xmlfile contains 3 persons or value (of course of study contains @ to the lowest degree one). need print out 'vorname' of each person, how can so? tried code (just short view):

reader.readtofollowing("person"); string isbn = reader.getattribute("alter"); console.writeline("age: " + isbn); console.readline();

but doesn't print out age (alter), how working print out age of each person, in case there more one.

just quick search , you'll find plenty of resource read xml via fabulous linq:

linq read xml

for illustration extract persons:

xdocument xdoc = xdocument.load(yourfilename)); var persons = lv1 in xdoc.descendants("person") select lv1.value;

c# xml system.xml

Comments

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -