i have a sql table
username level1 level2 level3 level4 level5 level6 level7
and i want to generate xml file like this :
<UserName text="ane"> <Level1 text="HR"> <Level2 text="HR2"></Level2> <Level2 text="HR3"> <Level3 text="HR31"></Level3> <Level3 text="HR32"> <Level4 text="HR321"></Level4> <Level4 text="HR322"></Level4> </Level3> <Level3 text="HR33"></Level3> </Level2> <Level2 text="HR4"></Level2> </Level1> <Level1 text="Payroll"/> <Level1 text="Production"> <Level2 text="CDL"></Level2> <Level2 text="Quality Control"> <Level3 text="Aging"></Level3> <Level3 text="Expiry Summary"></Level3> </Level2> <Level2 text="Stock"> <Level3 text="Material"> <Level4 text="CBA Stock"></Level4> <Level4 text="Factory Stock"></Level4> <Level4 text="m3"></Level4> </Level3> <Level3 text="stock2"></Level3> <Level3 text="stock3"></Level3> </Level2> </Level1></UserName>
please help