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

maven fortify plugin : Unable to load build session with ID XXXXX .. See log file for more details -

c# - Primavera WebServices does not return any data -

android - Display emoji panel with genymotion - keyboard/touch input? -