Xml attendance: output attendance of selected student c# -
i'm having little trouble. xml like:
<?xml version="1.0" encoding="iso-8859-1"?> <students xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:nonamespaceschemalocation="student.xsd"> <student> <studentid>001</studentid> <firstn>john</firstn> <lastn>doe</lastn> <seat>a1</seat> <presenton>10/7/2013 8:55:52 am</presenton> <presenton>10/7/2013 8:55:52 am</presenton> <presenton>10/7/2013 8:55:52 am</presenton> </student> <student> <studentid>001</studentid> <firstn>jane</firstn> <lastn>doe</lastn> <seat>a2</seat> <presenton>10/7/2013 8:55:52 am</presenton> <presenton>10/7/2013 8:55:52 am</presenton> <presenton>10/7/2013 8:55:52 am</presenton> </student> </students> i'm having no problem going specific student, jane doe, when try output presenton dates, first 1 shows on richtextbox. i've set presenton element on .xsd able occur multiple times if that's help.
how go outputting presenton dates , not one, i'm using xmlnodelist foreach(xmlnode node in xmlnodelist) , find student , i'm able output first date, have no idea how output presenton more once.
here's code i'm using find student:
xmldocument students = new xmldocument(); students.load(@"c:\seatingchart\studentcopy.xml"); xmlnodelist studentid = students.selectnodes("students/student"); //user chooses student id combobox string stuid = removetextboxspace(combobox1.getitemtext(combobox1.selecteditem)); foreach (xmlnode node in studentid) { try { string xmlid = node["studentid"].innertext.tostring(); if (stuid.equals(xmlid)) { //messagebox showing students name verify correct student string preson = node["presenton"].innertext.tostring(); richtextbox1.appendtext("present on: " + preson.tostring() + "\n"); } that's have far, new @ , still learn.
Comments
Post a Comment