XML in WebServices in formatted structure

Posted by Murugavelmsc under C# on 7/29/2015 | Points: 10 | Views : 299 | Status : [Member] | Replies : 1
Hi Experts,

I have the following table. I need to develop a webservices to populate the data in XML format structure:

Please help me.

Thanks in advance,
Murugavel S

Output


StudentID StudentName Class Month Rank Total
1 ABC V Jun 5 400
1 ABC V Jul 7 380
1 ABC V Aug 6 397
1 ABC V Sep 11 280
1 ABC V Oct 10 390
1 ABC V Nov 2 440
2 XYZ V Jun 17 280
2 XYZ V Jul 15 300
2 XYZ V Aug 12 397
2 XYZ V Sep 18 280
2 XYZ V Oct 19 190
2 XYZ V Nov 16 220

Output as:

<Students>
<Student>
<StudentID>1</StudentID>
<StudentName>ABC</StudentName>
<Class>V</Class>
<Grade>
<Rank Month = 'Jun'>5</Rank>
<Rank Month = 'Jul'>7</Rank>
.....
<Total Month = 'Jun'>400</Rank>
<Total Month = 'Jul'>380</Rank>
...
</Grade>
</Student>

<Student>
<StudentID>2</StudentID>
<StudentName>XYZ</StudentName>
<Class>V</Class>
<Grade>
<Rank Month = 'Jun'>17</Rank>
<Rank Month = 'Jul'>15</Rank>
.....
<Total Month = 'Jun'>280</Rank>
<Total Month = 'Jul'>300</Rank>
...
</Grade>
</Student>
</Students>

Regards,
Murugavel S
murugavel.sadagopan@gmail.com
http://murugavelmsc.blogspot.in/



Responses

Posted by: Rajayadav on: 8/21/2015 [Member] Starter | Points: 25

Up
0
Down
Hi,

Please checkout bellow url for your reference

http://www.codeproject.com/Articles/54584/Controlling-the-XML-output-when-using-the-FOR-XML

Thanks

Thanks
-Raja

Murugavelmsc, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response