Hello Everyone,
I have below models and i need the return xml response like below. Here how to do this. please help me
Output
Thanks,
King
I have below models and i need the return xml response like below. Here how to do this. please help me
C#:
public class School
{
public List<Student> StudentList;
public int? SchoolID { get; set; }
public int? SchoolName { get; set; }
}
public class Student
{
public string StudentName { get; set; }
public string ClassName { get; set; }
public string Age { get; set; }
}
XML:
<RESPONSE>
<School>
<SchoolID>102</SchoolID>
<SchoolName>ABC</SchoolName>
<StudentList>
<Student>
<StudentName>JOHN</StudentName>
<ClassName>IX</ClassName>
<Age>13</Age>
</Student>
<Student>
<StudentName>Taylor</StudentName>
<ClassName>IIX</ClassName>
<Age>11</Age>
</Student>
</StudentList>
</School>
<School>
<SchoolID>103</SchoolID>
<SchoolName>BCD</SchoolName>
<StudentList>
<Student>
<StudentName>CHRIS</StudentName>
<ClassName>IV</ClassName>
<Age>9</Age>
</Student>
<Student>
</StudentList>
</School>
</RESPONSE>
Thanks,
King
Last edited by a moderator: